summaryrefslogtreecommitdiff
path: root/.ci
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@ovn.org>2021-01-22 17:05:56 +0100
committerIlya Maximets <i.maximets@ovn.org>2021-02-17 21:23:16 +0100
commit5740843c4404caba7a38e1920fd0ed8a23a84084 (patch)
treeaa65bbae547744a3d967ced279bafd9c114123c4 /.ci
parent77cccc74deede443e8b9102299efc869a52b65b2 (diff)
downloadopenvswitch-5740843c4404caba7a38e1920fd0ed8a23a84084.tar.gz
github: Run clang test with AddressSanitizer enabled.
This commit is based on a similar one from OVN by Dumitru Ceara: a429b24f7bf5 ("ci: Enable AddressSanitizer in Linux clang CI test runs.") It's useful to run testsuite with address sanitizer enabled to catch memory leaks and invalid memory accesses. Skipping re-check if AddressSanitizer reports are present in the test run directory to not lose them. Right now OVS has no memory leaks detected on a testsuite run with -O1. With -O2 there are few false-positive leak reports in test-ovsdb application, so not using this optimization level for now. For the same reason not enabling leak detection by default for everyone. Enabled only in CI. AddressSanitizer increases execution time for this job from ~12 to ~16 minutes, but it looks like a reasonable sacrifice. Acked-by: Dumitru Ceara <dceara@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to '.ci')
-rwxr-xr-x.ci/linux-build.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 3e5136fd4..581a8888b 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -226,6 +226,15 @@ elif [ "$TRAVIS_ARCH" != "aarch64" ]; then
CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${SPARSE_FLAGS}"
fi
+if [ "$ASAN" ]; then
+ # This will override default option configured in tests/atlocal.in.
+ export ASAN_OPTIONS='detect_leaks=1'
+ # -O2 generates few false-positive memory leak reports in test-ovsdb
+ # application, so lowering optimizations to -O1 here.
+ CLFAGS_ASAN="-O1 -fno-omit-frame-pointer -fno-common -fsanitize=address"
+ CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${CLFAGS_ASAN}"
+fi
+
save_OPTS="${OPTS} $*"
OPTS="${EXTRA_OPTS} ${save_OPTS}"