about summary refs log tree commit diff homepage
path: root/.travis/sanitizer_flags.sh
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2016-11-20 15:29:26 +0000
committerDan Liew <daniel.liew@imperial.ac.uk>2017-01-19 11:50:10 +0000
commit1ffef7b5a0bf78bd4b4a31c626f20e150229d814 (patch)
tree88720bf42b1564b4875b6adfad34e91ac5d70efb /.travis/sanitizer_flags.sh
parent1ffda389d8d20c212884b8a669ebb4cb24f1fa01 (diff)
downloadklee-1ffef7b5a0bf78bd4b4a31c626f20e150229d814.tar.gz
[TravisCI] Modify TravisCI/Docker build scripts to support doing ASan/UBSan builds
of KLEE.

Two configurations (one for each build system) have been added to
TravisCI to do an ASan build.
Diffstat (limited to '.travis/sanitizer_flags.sh')
-rw-r--r--.travis/sanitizer_flags.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/.travis/sanitizer_flags.sh b/.travis/sanitizer_flags.sh
new file mode 100644
index 00000000..4d3dce2c
--- /dev/null
+++ b/.travis/sanitizer_flags.sh
@@ -0,0 +1,39 @@
+# This file is meant to be included by shell scripts
+# that need to do a sanitized build.
+
+# Users of this script can use this variable
+# to detect if a Sanitized build was enabled.
+IS_SANITIZED_BUILD=0
+
+# AddressSanitizer
+if [ "X${ASAN_BUILD}" == "X1" ]; then
+  echo "Using ASan"
+  ASAN_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
+  ASAN_C_FLAGS="${ASAN_CXX_FLAGS}"
+  ASAN_LD_FLAGS="${ASAN_CXX_FLAGS}"
+  IS_SANITIZED_BUILD=1
+else
+  echo "Not using ASan"
+  ASAN_CXX_FLAGS=""
+  ASAN_C_FLAGS=""
+  ASAN_LD_FLAGS=""
+fi
+
+# Undefined Behaviour Sanitizer
+if [ "X${UBSAN_BUILD}" == "X1" ]; then
+  echo "Using UBSan"
+  UBSAN_CXX_FLAGS="-fsanitize=undefined"
+  UBSAN_C_FLAGS="${UBSAN_CXX_FLAGS}"
+  UBSAN_LD_FLAGS="${UBSAN_CXX_FLAGS}"
+  IS_SANITIZED_BUILD=1
+else
+  echo "Not using UBSan"
+  UBSAN_CXX_FLAGS=""
+  UBSAN_C_FLAGS=""
+  UBSAN_LD_FLAGS=""
+fi
+
+# Set variables to be used by clients.
+SANITIZER_CXX_FLAGS="${ASAN_CXX_FLAGS} ${UBSAN_CXX_FLAGS}"
+SANITIZER_C_FLAGS="${ASAN_C_FLAGS} ${UBSAN_C_FLAGS}"
+SANITIZER_LD_FLAGS="${ASAN_LD_FLAGS} ${UBSAN_LD_FLAGS}"