This patch combines the existing ubsan and asan GitHub actions tests into one.
Signed-off-by: Eelco Chaudron <[email protected]> --- v2: - Combined the log path of both asan and ubsan - Directly pass the sanitizer options to -fsanitize .ci/linux-build.sh | 14 ++++---------- .github/workflows/build-and-test.yml | 8 ++------ tests/atlocal.in | 4 ++-- tests/automake.mk | 3 +-- tests/ovs-macros.at | 11 +++-------- 5 files changed, 12 insertions(+), 28 deletions(-) diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh index 90581c10b..d29f78cab 100755 --- a/.ci/linux-build.sh +++ b/.ci/linux-build.sh @@ -102,17 +102,11 @@ else CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${SPARSE_FLAGS}" fi -if [ "$ASAN" ]; then - # This will override default option configured in tests/atlocal.in. +if [ "$SANITIZERS" ]; then + # This will override default ASAN options configured in tests/atlocal.in. export ASAN_OPTIONS='detect_leaks=1' - CFLAGS_ASAN="-fno-omit-frame-pointer -fno-common -fsanitize=address" - CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${CFLAGS_ASAN}" -fi - -if [ "$UBSAN" ]; then - # Use the default options configured in tests/atlocal.in, in UBSAN_OPTIONS. - CFLAGS_UBSAN="-fno-omit-frame-pointer -fno-common -fsanitize=undefined" - CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${CFLAGS_UBSAN}" + CFLAGS_FOR_SAN="-fno-omit-frame-pointer -fno-common -fsanitize=$SANITIZERS" + CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${CFLAGS_FOR_SAN}" fi OPTS="${EXTRA_OPTS} ${OPTS} $*" diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 710757693..1b9dc4ef3 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -78,14 +78,13 @@ jobs: automake libtool gcc bc libjemalloc2 libjemalloc-dev libssl-dev \ llvm-dev libnuma-dev libpcap-dev selinux-policy-dev libbpf-dev \ lftp libreswan - ASAN: ${{ matrix.asan }} - UBSAN: ${{ matrix.ubsan }} CC: ${{ matrix.compiler }} DPDK: ${{ matrix.dpdk }} DPDK_SHARED: ${{ matrix.dpdk_shared }} LIBS: ${{ matrix.libs }} M32: ${{ matrix.m32 }} OPTS: ${{ matrix.opts }} + SANITIZERS: ${{ matrix.sanitizers }} STD: ${{ matrix.std }} TESTSUITE: ${{ matrix.testsuite }} TEST_RANGE: ${{ matrix.test_range }} @@ -111,11 +110,8 @@ jobs: - compiler: gcc testsuite: test - compiler: clang + sanitizers: address,undefined testsuite: test - asan: asan - - compiler: clang - testsuite: test - ubsan: ubsan - compiler: gcc testsuite: test diff --git a/tests/atlocal.in b/tests/atlocal.in index 372576a91..f321bae55 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -217,12 +217,12 @@ export OVS_CTL_TIMEOUT # # We disable leak detection because otherwise minor leaks that don't # matter break everything. -ASAN_OPTIONS=detect_leaks=0:abort_on_error=true:log_path=asan:$ASAN_OPTIONS +ASAN_OPTIONS=detect_leaks=0:abort_on_error=true:log_path=sanitizers:$ASAN_OPTIONS export ASAN_OPTIONS # Add some default flags for UndefinedBehaviorSanitizer, if it was used # for the build. -UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=true:log_path=ubsan:$UBSAN_OPTIONS +UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=true:log_path=sanitizers:$UBSAN_OPTIONS export UBSAN_OPTIONS # Check whether Python test requirements are available. diff --git a/tests/automake.mk b/tests/automake.mk index f8a925012..d5b301eda 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -215,8 +215,7 @@ AUTOTEST_PATH = utilities:vswitchd:ovsdb:vtep:tests:ipsec:$(PTHREAD_WIN32_DIR_DL check-local: set $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH); \ "$$@" $(TESTSUITEFLAGS) || \ - (test -z "$$(find $(TESTSUITE_DIR) -name 'asan.*')" && \ - test -z "$$(find $(TESTSUITE_DIR) -name 'ubsan.*')" && \ + (test -z "$$(find $(TESTSUITE_DIR) -name 'sanitizers.*')" && \ test X'$(RECHECK)' = Xyes && "$$@" --recheck) # Python Coverage support. diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at index 39fbfceeb..06c978555 100644 --- a/tests/ovs-macros.at +++ b/tests/ovs-macros.at @@ -211,14 +211,9 @@ m4_divert_pop([PREPARE_TESTS]) OVS_START_SHELL_HELPERS ovs_cleanup() { - if test "$(echo asan.*)" != 'asan.*'; then - echo "Address Sanitizer reported errors in:" asan.* - cat asan.* - AT_FAIL_IF([:]) - fi - if test "$(echo ubsan.*)" != 'ubsan.*'; then - echo "Undefined Behavior Sanitizer reported errors in:" ubsan.* - cat ubsan.* + if test "$(echo sanitizers.*)" != 'sanitizers.*'; then + echo "Undefined Behavior Sanitizer or Address Sanitizer reported errors in:" sanitizers.* + cat sanitizers.* AT_FAIL_IF([:]) fi } -- 2.43.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
