diff mbox series

[ovs-dev,v2,1/3] tests: Set handle_segv fpr UBSAN to allow SIGSEGV tests.

Message ID 170488141483.2356299.17040818647820951043.stgit@ebuild
State Rejected
Headers show
Series [ovs-dev,v2,1/3] tests: Set handle_segv fpr UBSAN to allow SIGSEGV tests. | expand

Commit Message

Eelco Chaudron Jan. 10, 2024, 10:10 a.m. UTC
Previously tests that were generating a SIGSEGV were excluded
from UBSAN runs. With the correct environment variable, these
tests can be run. This is working even with the clang version
supplied by Ubuntu 20.04.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
---
 tests/atlocal.in      |   10 ----------
 tests/daemon.at       |   28 ++++++++--------------------
 tests/ovsdb-server.at |   28 ++++++++--------------------
 3 files changed, 16 insertions(+), 50 deletions(-)
diff mbox series

Patch

diff --git a/tests/atlocal.in b/tests/atlocal.in
index 1013098a1..372576a91 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -194,16 +194,6 @@  else
     DIFF_SUPPORTS_NORMAL_FORMAT=no
 fi
 
-# Check whether UB Sanitizer is being used.
-case "$CFLAGS" in
-*fsanitize=undefined*)
-    TESTS_WITH_UBSAN=yes
-    ;;
-*)
-    TESTS_WITH_UBSAN=no
-    ;;
-esac
-
 # Turn off proxies.
 unset http_proxy
 unset https_proxy
diff --git a/tests/daemon.at b/tests/daemon.at
index 2c7fac57c..6cb8b9888 100644
--- a/tests/daemon.at
+++ b/tests/daemon.at
@@ -78,12 +78,9 @@  AT_CLEANUP
 AT_SETUP([daemon --monitor])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 
-# This test intentionally causes SIGSEGV, so make Address Sanitizer ignore it.
+# This test intentionally causes SIGSEGV, so make sanitizers ignore it.
 ASAN_OPTIONS=$ASAN_OPTIONS:handle_segv=0; export ASAN_OPTIONS
-
-# Skip it if UB Sanitizer is being used.  There's no way to disable the
-# SEGV check at runtime.
-AT_SKIP_IF([test $TESTS_WITH_UBSAN = yes])
+UBSAN_OPTIONS=$UBSAN_OPTIONS:handle_segv=0; export UBSAN_OPTIONS
 
 # Start the daemon and wait for the pidfile to get created.
 on_exit 'kill $(cat *.pid)'
@@ -150,12 +147,9 @@  AT_CLEANUP
 AT_SETUP([daemon --detach --monitor])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 
-# This test intentionally causes SIGSEGV, so make Address Sanitizer ignore it.
+# This test intentionally causes SIGSEGV, so make sanitizers ignore it.
 ASAN_OPTIONS=$ASAN_OPTIONS:handle_segv=0; export ASAN_OPTIONS
-
-# Skip it if UB Sanitizer is being used.  There's no way to disable the
-# SEGV check at runtime.
-AT_SKIP_IF([test $TESTS_WITH_UBSAN = yes])
+UBSAN_OPTIONS=$UBSAN_OPTIONS:handle_segv=0; export UBSAN_OPTIONS
 
 on_exit 'kill $(cat *.pid)'
 
@@ -239,12 +233,9 @@  AT_SETUP([backtrace without monitor])
 AT_SKIP_IF([test "$HAVE_BACKTRACE" = "no" && test "$HAVE_UNWIND" = "no"])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 
-# This test intentionally causes SIGSEGV, so make Address Sanitizer ignore it.
+# This test intentionally causes SIGSEGV, so make sanitizers ignore it.
 ASAN_OPTIONS=$ASAN_OPTIONS:handle_segv=0; export ASAN_OPTIONS
-
-# Skip it if UB Sanitizer is being used.  There's no way to disable the
-# SEGV check at runtime.
-AT_SKIP_IF([test $TESTS_WITH_UBSAN = yes])
+UBSAN_OPTIONS=$UBSAN_OPTIONS:handle_segv=0; export UBSAN_OPTIONS
 
 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --no-db \
                        --log-file --verbose=DBG], [0], [ignore], [ignore])
@@ -263,12 +254,9 @@  AT_SETUP([backtrace with monitor])
 AT_SKIP_IF([test "$HAVE_BACKTRACE" = "no" && test "$HAVE_UNWIND" = "no"])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 
-# This test intentionally causes SIGSEGV, so make Address Sanitizer ignore it.
+# This test intentionally causes SIGSEGV, so make sanitizers ignore it.
 ASAN_OPTIONS=$ASAN_OPTIONS:handle_segv=0; export ASAN_OPTIONS
-
-# Skip it if UB Sanitizer is being used.  There's no way to disable the
-# SEGV check at runtime.
-AT_SKIP_IF([test $TESTS_WITH_UBSAN = yes])
+UBSAN_OPTIONS=$UBSAN_OPTIONS:handle_segv=0; export UBSAN_OPTIONS
 
 on_exit 'kill $(cat *.pid)'
 
diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at
index d36c3c117..6916c0742 100644
--- a/tests/ovsdb-server.at
+++ b/tests/ovsdb-server.at
@@ -302,12 +302,9 @@  AT_SETUP([ovsdb-server/add-db with --monitor])
 AT_KEYWORDS([ovsdb server positive])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 
-# This test intentionally causes SIGSEGV, so make Address Sanitizer ignore it.
+# This test intentionally causes SIGSEGV, so make sanitizers ignore it.
 ASAN_OPTIONS=$ASAN_OPTIONS:handle_segv=0; export ASAN_OPTIONS
-
-# Skip it if UB Sanitizer is being used.  There's no way to disable the
-# SEGV check at runtime.
-AT_SKIP_IF([test $TESTS_WITH_UBSAN = yes])
+UBSAN_OPTIONS=$UBSAN_OPTIONS:handle_segv=0; export UBSAN_OPTIONS
 
 # Start ovsdb-server, initially with one db.
 ordinal_schema > schema
@@ -344,12 +341,9 @@  AT_SETUP([ovsdb-server/add-db and remove-db with --monitor])
 AT_KEYWORDS([ovsdb server positive])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 
-# This test intentionally causes SIGSEGV, so make Address Sanitizer ignore it.
+# This test intentionally causes SIGSEGV, so make sanitizers ignore it.
 ASAN_OPTIONS=$ASAN_OPTIONS:handle_segv=0; export ASAN_OPTIONS
-
-# Skip it if UB Sanitizer is being used.  There's no way to disable the
-# SEGV check at runtime.
-AT_SKIP_IF([test $TESTS_WITH_UBSAN = yes])
+UBSAN_OPTIONS=$UBSAN_OPTIONS:handle_segv=0; export UBSAN_OPTIONS
 
 # Start ovsdb-server, initially with one db.
 ordinal_schema > schema
@@ -503,12 +497,9 @@  AT_SETUP([ovsdb-server/add-remote with --monitor])
 AT_KEYWORDS([ovsdb server positive])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 
-# This test intentionally causes SIGSEGV, so make Address Sanitizer ignore it.
+# This test intentionally causes SIGSEGV, so make sanitizers ignore it.
 ASAN_OPTIONS=$ASAN_OPTIONS:handle_segv=0; export ASAN_OPTIONS
-
-# Skip it if UB Sanitizer is being used.  There's no way to disable the
-# SEGV check at runtime.
-AT_SKIP_IF([test $TESTS_WITH_UBSAN = yes])
+UBSAN_OPTIONS=$UBSAN_OPTIONS:handle_segv=0; export UBSAN_OPTIONS
 
 # Start ovsdb-server, initially with no remotes.
 ordinal_schema > schema
@@ -545,12 +536,9 @@  AT_SETUP([ovsdb-server/add-remote and remove-remote with --monitor])
 AT_KEYWORDS([ovsdb server positive])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
 
-# This test intentionally causes SIGSEGV, so make Address Sanitizer ignore it.
+# This test intentionally causes SIGSEGV, so make sanitizers ignore it.
 ASAN_OPTIONS=$ASAN_OPTIONS:handle_segv=0; export ASAN_OPTIONS
-
-# Skip it if UB Sanitizer is being used.  There's no way to disable the
-# SEGV check at runtime.
-AT_SKIP_IF([test $TESTS_WITH_UBSAN = yes])
+UBSAN_OPTIONS=$UBSAN_OPTIONS:handle_segv=0; export UBSAN_OPTIONS
 
 # Start ovsdb-server, initially with no remotes.
 ordinal_schema > schema