Build clang/sanitized build first
authorBernd Schubert <bschubert@ddn.com>
Tue, 19 Mar 2024 23:32:40 +0000 (00:32 +0100)
committerBernd Schubert <bschubert@ddn.com>
Wed, 20 Mar 2024 11:32:39 +0000 (12:32 +0100)
This was stalling - easier to check what happens
when it fails fast. And in general, sanitized
builds are faster than valgrind and detect almost
as much errors as valgrind (same level would be
achieved with MSAN, but that is hard to use),
so failures can be detected faster whan sanitizers
run first.

test/ci-build.sh

index 73893a689de83fc70fb4272293e179cb30707333..4d269fa328b96b802087e1e07f7aab0d793bd364 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -x
 
 set -e
 
@@ -30,42 +30,48 @@ export LSAN_OPTIONS="suppressions=$(pwd)/lsan_suppress.txt"
 export ASAN_OPTIONS="detect_leaks=1"
 export CC
 
-# Standard build
-for CC in gcc gcc-9 gcc-10 clang; do
-    echo "=== Building with ${CC} ==="
-    mkdir build-${CC}; pushd build-${CC}
-    if [ "${CC}" == "clang" ]; then
-        export CXX="clang++"
-        export TEST_WITH_VALGRIND=false
-    else
-        export TEST_WITH_VALGRIND=true
-    fi
-    if [ ${CC} == 'gcc-7' ]; then
-        build_opts='-D b_lundef=false'
-    else
-        build_opts=''
-    fi
-    if [ ${CC} == 'gcc-10' ]; then
-        build_opts='-Dc_args=-flto=auto'
-    else
-        build_opts=''
-    fi
-    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
-
-    # also needed for some of the tests
-    sudo chown root:root util/fusermount3
-    sudo chmod 4755 util/fusermount3
-
-    ${TEST_CMD}
-    popd
-    rm -fr build-${CC}
-    sudo rm -fr ${PREFIX_DIR}
-done
+non_sanitized_build()
+(
+    echo "Standard build (without sanitizers)"
+    for CC in gcc gcc-9 gcc-10 clang; do
+        echo "=== Building with ${CC} ==="
+        mkdir build-${CC}; pushd build-${CC}
+        if [ "${CC}" == "clang" ]; then
+            export CXX="clang++"
+            export TEST_WITH_VALGRIND=false
+        else
+            unset CXX
+            export TEST_WITH_VALGRIND=true
+        fi
+        if [ ${CC} == 'gcc-7' ]; then
+            build_opts='-D b_lundef=false'
+        else
+            build_opts=''
+        fi
+        if [ ${CC} == 'gcc-10' ]; then
+            build_opts='-Dc_args=-flto=auto'
+        else
+            build_opts=''
+        fi
+
+        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
+
+        # also needed for some of the tests
+        sudo chown root:root util/fusermount3
+        sudo chmod 4755 util/fusermount3
+
+        ${TEST_CMD}
+        popd
+        rm -fr build-${CC}
+        sudo rm -fr ${PREFIX_DIR}
+
+    done
+)
 
 sanitized_build()
 (
@@ -114,6 +120,8 @@ CC=clang
 CXX=clang++
 sanitized_build
 
+non_sanitized_build
+
 # Documentation.
 (cd "${SOURCE_DIR}"; doxygen doc/Doxyfile)