mirror of
https://github.com/openvswitch/ovs
synced 2025-09-02 07:15:17 +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:
@@ -128,17 +128,11 @@ else
|
|||||||
CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${SPARSE_FLAGS}"
|
CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${SPARSE_FLAGS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ASAN" ]; then
|
if [ "$SANITIZERS" ]; then
|
||||||
# This will override default option configured in tests/atlocal.in.
|
# This will override default ASAN options configured in tests/atlocal.in.
|
||||||
export ASAN_OPTIONS='detect_leaks=1'
|
export ASAN_OPTIONS='detect_leaks=1'
|
||||||
CFLAGS_ASAN="-fno-omit-frame-pointer -fno-common -fsanitize=address"
|
CFLAGS_FOR_SAN="-fno-omit-frame-pointer -fno-common -fsanitize=$SANITIZERS"
|
||||||
CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${CFLAGS_ASAN}"
|
CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${CFLAGS_FOR_SAN}"
|
||||||
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}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OPTS="${EXTRA_OPTS} ${OPTS} $*"
|
OPTS="${EXTRA_OPTS} ${OPTS} $*"
|
||||||
|
8
.github/workflows/build-and-test.yml
vendored
8
.github/workflows/build-and-test.yml
vendored
@@ -78,14 +78,13 @@ jobs:
|
|||||||
automake libtool gcc bc libjemalloc2 libjemalloc-dev libssl-dev \
|
automake libtool gcc bc libjemalloc2 libjemalloc-dev libssl-dev \
|
||||||
llvm-dev libnuma-dev libpcap-dev selinux-policy-dev libbpf-dev \
|
llvm-dev libnuma-dev libpcap-dev selinux-policy-dev libbpf-dev \
|
||||||
lftp libreswan
|
lftp libreswan
|
||||||
ASAN: ${{ matrix.asan }}
|
|
||||||
UBSAN: ${{ matrix.ubsan }}
|
|
||||||
CC: ${{ matrix.compiler }}
|
CC: ${{ matrix.compiler }}
|
||||||
DPDK: ${{ matrix.dpdk }}
|
DPDK: ${{ matrix.dpdk }}
|
||||||
DPDK_SHARED: ${{ matrix.dpdk_shared }}
|
DPDK_SHARED: ${{ matrix.dpdk_shared }}
|
||||||
LIBS: ${{ matrix.libs }}
|
LIBS: ${{ matrix.libs }}
|
||||||
M32: ${{ matrix.m32 }}
|
M32: ${{ matrix.m32 }}
|
||||||
OPTS: ${{ matrix.opts }}
|
OPTS: ${{ matrix.opts }}
|
||||||
|
SANITIZERS: ${{ matrix.sanitizers }}
|
||||||
STD: ${{ matrix.std }}
|
STD: ${{ matrix.std }}
|
||||||
TESTSUITE: ${{ matrix.testsuite }}
|
TESTSUITE: ${{ matrix.testsuite }}
|
||||||
TEST_RANGE: ${{ matrix.test_range }}
|
TEST_RANGE: ${{ matrix.test_range }}
|
||||||
@@ -111,11 +110,8 @@ jobs:
|
|||||||
- compiler: gcc
|
- compiler: gcc
|
||||||
testsuite: test
|
testsuite: test
|
||||||
- compiler: clang
|
- compiler: clang
|
||||||
|
sanitizers: address,undefined
|
||||||
testsuite: test
|
testsuite: test
|
||||||
asan: asan
|
|
||||||
- compiler: clang
|
|
||||||
testsuite: test
|
|
||||||
ubsan: ubsan
|
|
||||||
|
|
||||||
- compiler: gcc
|
- compiler: gcc
|
||||||
testsuite: test
|
testsuite: test
|
||||||
|
@@ -217,12 +217,12 @@ export OVS_CTL_TIMEOUT
|
|||||||
#
|
#
|
||||||
# We disable leak detection because otherwise minor leaks that don't
|
# We disable leak detection because otherwise minor leaks that don't
|
||||||
# matter break everything.
|
# 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
|
export ASAN_OPTIONS
|
||||||
|
|
||||||
# Add some default flags for UndefinedBehaviorSanitizer, if it was used
|
# Add some default flags for UndefinedBehaviorSanitizer, if it was used
|
||||||
# for the build.
|
# 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
|
export UBSAN_OPTIONS
|
||||||
|
|
||||||
# Check whether Python test requirements are available.
|
# Check whether Python test requirements are available.
|
||||||
|
@@ -211,8 +211,7 @@ AUTOTEST_PATH = utilities:vswitchd:ovsdb:vtep:tests:ipsec:$(PTHREAD_WIN32_DIR_DL
|
|||||||
check-local:
|
check-local:
|
||||||
set $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH); \
|
set $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH); \
|
||||||
"$$@" $(TESTSUITEFLAGS) || \
|
"$$@" $(TESTSUITEFLAGS) || \
|
||||||
(test -z "$$(find $(TESTSUITE_DIR) -name 'asan.*')" && \
|
(test -z "$$(find $(TESTSUITE_DIR) -name 'sanitizers.*')" && \
|
||||||
test -z "$$(find $(TESTSUITE_DIR) -name 'ubsan.*')" && \
|
|
||||||
test X'$(RECHECK)' = Xyes && "$$@" --recheck)
|
test X'$(RECHECK)' = Xyes && "$$@" --recheck)
|
||||||
|
|
||||||
# Python Coverage support.
|
# Python Coverage support.
|
||||||
|
@@ -211,14 +211,9 @@ m4_divert_pop([PREPARE_TESTS])
|
|||||||
|
|
||||||
OVS_START_SHELL_HELPERS
|
OVS_START_SHELL_HELPERS
|
||||||
ovs_cleanup() {
|
ovs_cleanup() {
|
||||||
if test "$(echo asan.*)" != 'asan.*'; then
|
if test "$(echo sanitizers.*)" != 'sanitizers.*'; then
|
||||||
echo "Address Sanitizer reported errors in:" asan.*
|
echo "Undefined Behavior Sanitizer or Address Sanitizer reported errors in:" sanitizers.*
|
||||||
cat asan.*
|
cat sanitizers.*
|
||||||
AT_FAIL_IF([:])
|
|
||||||
fi
|
|
||||||
if test "$(echo ubsan.*)" != 'ubsan.*'; then
|
|
||||||
echo "Undefined Behavior Sanitizer reported errors in:" ubsan.*
|
|
||||||
cat ubsan.*
|
|
||||||
AT_FAIL_IF([:])
|
AT_FAIL_IF([:])
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user