From 01ffc392690f14be3a8b7310c570aca925bf9716 Mon Sep 17 00:00:00 2001 From: benrubson Date: Tue, 8 Aug 2017 17:50:44 +0200 Subject: [PATCH 1/5] Re-enable integration tests in Travis --- .travis.yml | 2 +- INSTALL.md | 10 +++++++--- build.sh | 5 +++++ ci/{check.sh => build.sh} | 1 + 4 files changed, 14 insertions(+), 4 deletions(-) rename ci/{check.sh => build.sh} (93%) diff --git a/.travis.yml b/.travis.yml index 5bd591f..2af3032 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ before_script: - ./ci/setup.sh script: - - ./ci/check.sh + - ./ci/build.sh addons: apt: diff --git a/INSTALL.md b/INSTALL.md index 662f4d0..f8f0302 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -10,7 +10,11 @@ Compiling EncFS EncFS uses the CMake toolchain to create makefiles. -Steps to build EncFS: +Quickest way to build and test EncFS : + + ./build.sh + +Or following are the detailed steps to build EncFS: mkdir build cd build @@ -29,11 +33,11 @@ encrypted filesystem and run tests on it: make integration The compilation process creates two executables, encfs and encfsctl in -the encfs directory. You can install to in a system directory via +the encfs directory. You can install to in a system directory via: make install -. If the default path (`/usr/local`) is not where you want things +If the default path (`/usr/local`) is not where you want things installed, then set the CMAKE_INSTALL_PREFIX option when running cmake. Eg: cmake .. -DCMAKE_INSTALL_PREFIX=/opt/local diff --git a/build.sh b/build.sh index 87985de..de8b847 100755 --- a/build.sh +++ b/build.sh @@ -12,4 +12,9 @@ then fi make -j2 -C build +make test -C build +make integration -C build + +echo +echo 'Everything looks good, you can install via "make install -C build".' diff --git a/ci/check.sh b/ci/build.sh similarity index 93% rename from ci/check.sh rename to ci/build.sh index 5d5e9ca..4d30a46 100755 --- a/ci/check.sh +++ b/ci/build.sh @@ -16,6 +16,7 @@ cd build cmake .. ${CFG} make -j2 make test +make integration cd .. From 5dfa28508e399a0b96ffe57d0f968e4beed2f471 Mon Sep 17 00:00:00 2001 From: Valient Gough Date: Tue, 8 Aug 2017 23:34:32 -0400 Subject: [PATCH 2/5] switch to osx_image xcode8.3 --- .travis.yml | 18 ++++++------------ devmode | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5bd591f..1518736 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,15 @@ -dist: trusty - language: cpp sudo: true -os: - - linux - - osx - -compiler: - - clang - - gcc - matrix: - exclude: - - os: osx + include: + - os: linux compiler: gcc + dist: trusty + - os: osx + compiler: clang + osx_image: xcode8.3 branches: only: diff --git a/devmode b/devmode index f77a73a..33df3a2 100755 --- a/devmode +++ b/devmode @@ -2,4 +2,4 @@ # After running, chdir to the build subdir ane run "make" mkdir build cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug -DLINT=ON \ - -DCMAKE_CXX_FLAGS="-O1 -fsanitize=address -fno-omit-frame-pointer" $@ + -DCMAKE_CXX_FLAGS="-O0 -g -fsanitize=address -fno-omit-frame-pointer" $@ From dd0df7c60cdcbadc92b93d2148117bb6c584c5b6 Mon Sep 17 00:00:00 2001 From: benrubson Date: Thu, 10 Aug 2017 20:49:39 +0200 Subject: [PATCH 3/5] Add current path to perl integration tests --- integration.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration.sh b/integration.sh index 032adcc..d76c345 100755 --- a/integration.sh +++ b/integration.sh @@ -3,4 +3,4 @@ # Make sure we are in the directory this script is in. cd "$(dirname "$0")" -perl -MTest::Harness -e '$$Test::Harness::debug=1; runtests @ARGV;' integration/*.t.pl +perl -I. -MTest::Harness -e '$$Test::Harness::debug=1; runtests @ARGV;' integration/*.t.pl From 636766e62039493d149e46da089bcfafa7c1c3a6 Mon Sep 17 00:00:00 2001 From: Code7R Date: Sun, 20 Aug 2017 08:37:52 +0200 Subject: [PATCH 4/5] link with libatomic (#387) * link with libatomic when available * Use --as-needed flag to avoid libatomic reference where not required --- CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bceacec..c7a79c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,6 +93,23 @@ check_cxx_source_compiles ("#include int main() { getxattr(0,0,0,0,0,0); return 1; } " XATTR_ADD_OPT) +# If awailable on current architecture (typically embedded 32-bit), link with it explicitly; +# GCC autodetection is faulty, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358 and +# find_libray is no great help here since it is sometimes(!) not in standard paths. +set(CMAKE_REQUIRED_FLAGS "-latomic") +CHECK_CXX_SOURCE_COMPILES("int main() {return 0;}" COMPILER_NEEDS_LATOMIC) +if(COMPILER_NEEDS_LATOMIC) + set(ATOMIC_LIBRARY atomic) +endif() +# compensate the effect of extra linking of libatomic on platforms where intrinsics are used +set(CMAKE_REQUIRED_FLAGS "-Wl,--as-needed") +CHECK_CXX_SOURCE_COMPILES("int main() {return 0;}" LINKER_SUPPORTS_WLASNEEDED) +if(LINKER_SUPPORTS_WLASNEEDED) + list(APPEND EXTRA_LINKER_FLAGS "-Wl,--as-needed") +endif() + +set(CMAKE_REQUIRED_FLAGS) + # Check if we have some standard functions. include (CheckFuncs) check_function_exists_glibc (lchmod HAVE_LCHMOD) @@ -214,12 +231,14 @@ set_target_properties(encfs PROPERTIES VERSION ${ENCFS_VERSION} SOVERSION ${ENCFS_SOVERSION}) target_link_libraries(encfs + ${EXTRA_LINKER_FLAGS} ${FUSE_LIBRARIES} ${OPENSSL_LIBRARIES} ${TINYXML_LIBRARIES} ${EASYLOGGING_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Intl_LIBRARIES} + ${ATOMIC_LIBRARY} ) if (INSTALL_LIBENCFS) install (TARGETS encfs DESTINATION ${LIB_INSTALL_DIR}) From 56978fb905047f10e3d2807eb9344999860944fe Mon Sep 17 00:00:00 2001 From: Valient Gough Date: Mon, 21 Aug 2017 21:09:42 -0700 Subject: [PATCH 5/5] drop circle, add clang-tidy to travis build (#389) * drop circle, improve ci scripts * allow branch builds * travis: turn off sudo for one of the builds --- .travis.yml | 58 +++++++++++++++++++++++++++++++---------------- CMakeLists.txt | 4 +++- README.md | 1 - build.sh | 33 +++++++++++++++++++-------- ci/build.sh | 22 ------------------ ci/config.sh | 5 ---- ci/install-gcc.sh | 5 ---- ci/setup.sh | 21 +++++++++++++---- circle.yml | 14 ------------ 9 files changed, 81 insertions(+), 82 deletions(-) delete mode 100755 ci/build.sh delete mode 100755 ci/config.sh delete mode 100755 ci/install-gcc.sh delete mode 100644 circle.yml diff --git a/.travis.yml b/.travis.yml index abeb6ad..61cf5e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,35 +1,53 @@ language: cpp -sudo: true - matrix: include: - os: linux compiler: gcc dist: trusty + sudo: false + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - attr + - fuse + - libfuse-dev + - gettext + - cmake3 + env: + - INTEGRATION=false + + - os: linux + compiler: clang + dist: trusty + sudo: true + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-trusty-4.0 + packages: + - attr + - fuse + - libfuse-dev + - gettext + - cmake3 + - clang-4.0 + - clang-tidy-4.0 + env: + - CC=clang-4.0 CXX=clang++-4.0 CHECK=true INTEGRATION=true + - os: osx compiler: clang osx_image: xcode8.3 - -branches: - only: - - master - - travis + sudo: true + env: + - INTEGRATION=true before_script: - ./ci/setup.sh script: - - ./ci/build.sh - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - attr - - clang - - fuse - - libfuse-dev - - gettext - - cmake3 + - ./build.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index c7a79c2..76e617a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,7 +163,7 @@ if (ENABLE_NLS) endif (ENABLE_NLS) if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.5) # Need 3.6 or above. - find_program(CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable") + find_program(CLANG_TIDY_EXE NAMES "clang-tidy" "clang-tidy-4.0" DOC "Path to clang-tidy executable") if(NOT CLANG_TIDY_EXE) message(STATUS "clang-tidy not found.") else() @@ -171,6 +171,8 @@ if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.5) # Need 3.6 or abo set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks=*,-modernize-loop-convert,-cppcoreguidelines-pro-*,-readability-inconsistent-declaration-parameter-name,-google-readability-casting,-cert-err58-cpp,-google-runtime-int,-readability-named-parameter,-google-build-using-namespace,-misc-unused-parameters,-google-runtime-references") #set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-fix" "-checks=-*,google-readability-redundant-smartptr-get") endif() +else() + message(STATUS "clang-tidy check skipped, need newer cmake") endif() if (USE_INTERNAL_TINYXML) diff --git a/README.md b/README.md index cf19cce..26285d6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # EncFS - an Encrypted Filesystem _Build Status_ - - Circle: [![Circle CI](https://circleci.com/gh/vgough/encfs.svg?style=svg)](https://circleci.com/gh/vgough/encfs) - Travis: [![Travis CI](https://travis-ci.org/vgough/encfs.svg?branch=master)](https://travis-ci.org/vgough/encfs) ## About diff --git a/build.sh b/build.sh index de8b847..af1b323 100755 --- a/build.sh +++ b/build.sh @@ -1,20 +1,33 @@ #!/bin/bash -eu -# Make sure we are in the directory this script is in. -cd "$(dirname "$0")" +: ${CHECK:=false} +: ${INTEGRATION:=true} + +cmake --version + +CFG=$* +if [[ "$CHECK" == "true" ]]; then + CFG="-DLINT=ON $CFG" +fi + +if uname -s | grep -q Darwin; then + CFG="-DENABLE_NLS=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl $CFG" +fi if [[ ! -d build ]] then - mkdir build - cd build - cmake .. $* - cd .. + mkdir build fi -make -j2 -C build -make test -C build -make integration -C build +cd build +cmake .. ${CFG} +make -j2 +make test +if [[ "$INTEGRATION" == "true" ]]; then + make integration +fi + +cd .. echo echo 'Everything looks good, you can install via "make install -C build".' - diff --git a/ci/build.sh b/ci/build.sh deleted file mode 100755 index 4d30a46..0000000 --- a/ci/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -eu - -cmake --version - -CFG="" -if [ "$TRAVIS_OS_NAME" = "osx" ]; then - CFG="-DENABLE_NLS=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl" -fi - -if [[ ! -d build ]] -then - mkdir build -fi - -cd build -cmake .. ${CFG} -make -j2 -make test -make integration - -cd .. - diff --git a/ci/config.sh b/ci/config.sh deleted file mode 100755 index 96c4ee3..0000000 --- a/ci/config.sh +++ /dev/null @@ -1,5 +0,0 @@ -set -x -set -e -mkdir build -cd build -cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/encfs -DCMAKE_BUILD_TYPE=Debug .. diff --git a/ci/install-gcc.sh b/ci/install-gcc.sh deleted file mode 100755 index c147819..0000000 --- a/ci/install-gcc.sh +++ /dev/null @@ -1,5 +0,0 @@ -set -x -set -e -sudo apt-get install -y gcc-4.8 g++-4.8 -sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100 -sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 100 diff --git a/ci/setup.sh b/ci/setup.sh index 1482194..81bc0ce 100755 --- a/ci/setup.sh +++ b/ci/setup.sh @@ -1,10 +1,23 @@ #!/bin/bash -eu -if [ "$TRAVIS_OS_NAME" == "linux" ]; then - sudo modprobe fuse +: ${INTEGRATION:=false} +: ${CHECK:=false} + +if [[ "$INTEGRATION" == "true" ]]; then + if uname -s | grep -q Linux; then + sudo modprobe fuse + elif uname -s | grep -q Darwin; then + brew cask install osxfuse + fi fi -if [ "$TRAVIS_OS_NAME" == "osx" ]; then - brew cask install osxfuse +if [[ "$CHECK" == "true" ]]; then + if uname -s | grep -q Linux; then + wget https://cmake.org/files/v3.9/cmake-3.9.1-Linux-x86_64.tar.gz -O /tmp/cmake.tar.gz + tar -C /tmp/ -xf /tmp/cmake.tar.gz + sudo rm -f $(which cmake) + sudo ln -s $(ls -1 /tmp/cmake*/bin/cmake) /bin/ + fi fi + diff --git a/circle.yml b/circle.yml deleted file mode 100644 index c570296..0000000 --- a/circle.yml +++ /dev/null @@ -1,14 +0,0 @@ -machine: - timezone: - America/Los_Angeles - -dependencies: - pre: - - sudo apt-get install cmake libfuse-dev libgettextpo-dev - - bash ./ci/install-gcc.sh - -test: - override: - - bash ./ci/config.sh - - cd build && make && make test && make install - - /tmp/encfs/bin/encfsctl --version