2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

ci: Combine the ubsan and asan sanitizer runs.

This patch combines the existing ubsan and asan GitHub actions
tests into one.

Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
This commit is contained in:
Eelco Chaudron
2024-01-10 11:22:23 +01:00
parent 48d4f6963b
commit fc13c0d65f
5 changed files with 12 additions and 28 deletions

View File

@@ -128,17 +128,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} $*"

View File

@@ -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

View File

@@ -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.

View File

@@ -211,8 +211,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.

View File

@@ -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
}