@@ -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} $*"
@@ -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
@@ -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.
@@ -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.
@@ -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
}
This patch combines the existing ubsan and asan GitHub actions tests into one. Signed-off-by: Eelco Chaudron <echaudro@redhat.com> --- 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(-)