[ovs-dev] [PATCH ovn 2/2] ci: Enable AddressSanitizer in Linux CI runs.
Dumitru Ceara
dceara at redhat.com
Wed Dec 16 08:11:05 UTC 2020
To make sure no memory leaks or invalid accesses reported by
AddressSanitizer are missed, also skip rechecking tests if
AddressSanitizer reports are present in the test run directory.
Note: This doubles GitHub Actions CI time from ~9 minutes (before the
change) to ~18 minutes (after the change).
Signed-off-by: Dumitru Ceara <dceara at redhat.com>
---
.ci/linux-build.sh | 2 +-
tests/automake.mk | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 0e9f87f..6943b01 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -3,7 +3,7 @@
set -o errexit
set -x
-CFLAGS=""
+CFLAGS="-fsanitize=address -fno-omit-frame-pointer -fno-common"
SPARSE_FLAGS=""
EXTRA_OPTS="--enable-Werror"
diff --git a/tests/automake.mk b/tests/automake.mk
index c5c286e..34464c7 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -52,6 +52,7 @@ check_SCRIPTS += tests/atlocal
TESTSUITE = $(srcdir)/tests/testsuite
TESTSUITE_PATCH = $(srcdir)/tests/testsuite.patch
+TESTSUITE_DIR = $(abs_top_builddir)/tests/testsuite.dir
SYSTEM_KMOD_TESTSUITE = $(srcdir)/tests/system-kmod-testsuite
SYSTEM_USERSPACE_TESTSUITE = $(srcdir)/tests/system-userspace-testsuite
DISTCLEANFILES += tests/atconfig tests/atlocal
@@ -61,8 +62,11 @@ AUTOTEST_PATH = $(ovs_builddir)/utilities:$(ovs_builddir)/vswitchd:$(ovs_builddi
export ovs_srcdir
check-local:
+ find $(TESTSUITE_DIR) -name 'asan.*' | xargs -n1 rm -f
set $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH); \
- "$$@" $(TESTSUITEFLAGS) || (test X'$(RECHECK)' = Xyes && "$$@" --recheck)
+ "$$@" $(TESTSUITEFLAGS) || \
+ (test -z "$$(find $(TESTSUITE_DIR) -name 'asan.*')" && \
+ test X'$(RECHECK)' = Xyes && "$$@" --recheck)
# Python Coverage support.
# Requires coverage.py http://nedbatchelder.com/code/coverage/.
More information about the dev
mailing list