about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2018-06-09 19:36:01 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2018-07-04 22:14:58 +0100
commit8f2b9b543b7e226c6ea06917a720452267012c22 (patch)
tree25bb4b5f3657003c4e3615be00104ee6855c9495
parenteb75a38011726d4a045f3db3edbfef924f62c737 (diff)
downloadklee-8f2b9b543b7e226c6ea06917a720452267012c22.tar.gz
Support sanitizer suppression files with lit-based testing
-rw-r--r--CMakeLists.txt1
-rw-r--r--test/lit.site.cfg.in4
-rw-r--r--unittests/lit-unit-tests-common.site.cfg.in2
-rw-r--r--utils/sanitizers/lsan.txt7
-rw-r--r--utils/sanitizers/ubsan.txt3
5 files changed, 14 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 99508bb2..1beaa30e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -629,6 +629,7 @@ include_directories("${CMAKE_SOURCE_DIR}/include")
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+set(KLEE_UTILS_DIR ${CMAKE_SOURCE_DIR}/utils)
 
 
 ################################################################################
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 300c70c5..6a90bb4c 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -28,6 +28,10 @@ config.have_selinux = True if @HAVE_SELINUX@ == 1 else False
 config.enable_stp = True if @ENABLE_STP@ == 1 else False
 config.enable_z3 = True if @ENABLE_Z3@ == 1 else False
 
+# Add sanitizer list
+config.environment['LSAN_OPTIONS'] = "suppressions=@KLEE_UTILS_DIR@/sanitizers/lsan.txt"
+config.environment['UBSAN_OPTIONS'] = "suppressions=@KLEE_UTILS_DIR@/sanitizers/ubsan.txt"
+
 # Current target
 config.target_triple = "@TARGET_TRIPLE@"
 
diff --git a/unittests/lit-unit-tests-common.site.cfg.in b/unittests/lit-unit-tests-common.site.cfg.in
index f106152f..38626995 100644
--- a/unittests/lit-unit-tests-common.site.cfg.in
+++ b/unittests/lit-unit-tests-common.site.cfg.in
@@ -7,3 +7,5 @@ config.unit_test_exe_suffix = "@UNIT_TEST_EXE_SUFFIX@"
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@CMAKE_SOURCE_DIR@/unittests/lit-unit-tests-common.cfg")
+config.environment['LSAN_OPTIONS'] = "suppressions=@KLEE_UTILS_DIR@/sanitizers/lsan.txt"
+config.environment['UBSAN_OPTIONS'] = "suppressions=@KLEE_UTILS_DIR@/sanitizers/ubsan.txt"
diff --git a/utils/sanitizers/lsan.txt b/utils/sanitizers/lsan.txt
index e88f078b..45e4c3fd 100644
--- a/utils/sanitizers/lsan.txt
+++ b/utils/sanitizers/lsan.txt
@@ -6,6 +6,7 @@
 # The suppressions below are what's needed for ``make unittests`` and ``make check`` to not
 # fail due to leaks.
 
-# Low priority
-leak:tools/kleaver/main.cpp
-leak:lib/Expr/Parser.cpp
+# Ignore tcmalloc
+leak:src/malloc_extension.cc
+# Memory leak from klee_replay
+leak:klee-replay.c
diff --git a/utils/sanitizers/ubsan.txt b/utils/sanitizers/ubsan.txt
new file mode 100644
index 00000000..97a66000
--- /dev/null
+++ b/utils/sanitizers/ubsan.txt
@@ -0,0 +1,3 @@
+# Runtime suppression of undefined behavior
+#
+vptr_check:Module.h