diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/ci-build.sh | 58 |
1 files changed, 33 insertions, 25 deletions
diff --git a/test/ci-build.sh b/test/ci-build.sh index 28ff0d8..a023c15 100755 --- a/test/ci-build.sh +++ b/test/ci-build.sh @@ -3,6 +3,10 @@ set -e TEST_CMD="python3 -m pytest --maxfail=99 test/" +SAN="-Db_sanitize=address,undefined" + +# not default +export UBSAN_OPTIONS=halt_on_error=1 # Make sure binaries can be accessed when invoked by root. umask 0022 @@ -14,6 +18,9 @@ umask 0022 # readable/executable. SOURCE_DIR="$(readlink -f .)" TEST_DIR="$(mktemp -dt libfuse-build-XXXXXX)" + +PREFIX_DIR="$(mktemp -dt libfuse-install-XXXXXXX)" + chmod 0755 "${TEST_DIR}" cd "${TEST_DIR}" echo "Running in ${TEST_DIR}" @@ -26,7 +33,7 @@ export CC # Standard build for CC in gcc gcc-9 gcc-10 clang; do echo "=== Building with ${CC} ===" - mkdir build-${CC}; cd build-${CC} + mkdir build-${CC}; pushd build-${CC} if [ "${CC}" == "clang" ]; then export CXX="clang++" export TEST_WITH_VALGRIND=false @@ -43,60 +50,61 @@ for CC in gcc gcc-9 gcc-10 clang; do else build_opts='' fi - meson setup -D werror=true ${build_opts} "${SOURCE_DIR}" || (cat meson-logs/meson-log.txt; false) + meson setup -Dprefix=${PREFIX_DIR} -D werror=true ${build_opts} "${SOURCE_DIR}" || (cat meson-logs/meson-log.txt; false) ninja + sudo ninja install + + # libfuse will first try the install path and then system defaults + sudo chmod 4755 ${PREFIX_DIR}/bin/fusermount3 - sudo chown root:root util/fusermount3 - sudo chmod 4755 util/fusermount3 ${TEST_CMD} - cd .. + popd + rm -fr build-${CC} + sudo rm -fr ${PREFIX_DIR} done -(cd build-$CC; sudo ninja install) sanitized_build() -{ - san=$1 - additonal_option=$2 +( + echo "=== Building with clang and sanitizers" - echo "=== Building with clang and ${san} sanitizer ===" - [ -n ${additonal_option} ] || echo "Additional option: ${additonal_option}" + mkdir build-san; pushd build-san - mkdir build-${san}; pushd build-${san} + meson setup -Dprefix=${PREFIX_DIR} -D werror=true\ + "${SOURCE_DIR}" \ + || (ct meson-logs/meson-log.txt; false) + meson configure $SAN # b_lundef=false is required to work around clang # bug, cf. https://groups.google.com/forum/#!topic/mesonbuild/tgEdAXIIdC4 - meson setup -D b_sanitize=${san} -D b_lundef=false -D werror=true\ - ${additonal_option} "${SOURCE_DIR}" \ - || (cat meson-logs/meson-log.txt; false) + meson configure -D b_lundef=false + + meson configure ninja + sudo ninja install + sudo chmod 4755 ${PREFIX_DIR}/bin/fusermount3 # Test as root and regular user sudo ${TEST_CMD} - sudo chown root:root util/fusermount3 - sudo chmod 4755 util/fusermount3 # Cleanup temporary files (since they are now owned by root) sudo rm -rf test/.pytest_cache/ test/__pycache__ ${TEST_CMD} popd - rm -fr build-${san} -} + rm -fr build-san + sudo rm -fr ${PREFIX_DIR} +) # Sanitized build CC=clang CXX=clang++ TEST_WITH_VALGRIND=false -for san in undefined address; do - sanitized_build ${san} -done +sanitized_build $SAN # Sanitized build without libc versioned symbols CC=clang CXX=clang++ -for san in undefined address; do - sanitized_build ${san} "-Ddisable-libc-symbol-version=true" -done +sanitized_build # Documentation. (cd "${SOURCE_DIR}"; doxygen doc/Doxyfile) |