ci: enable AddressSanitizer for unit tests

Change-Id: Iaf4c24f7e6f79d2915bf8ef78cff398876091c73
Refs: #2589
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index 3c975e0..5b13951 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -32,8 +32,10 @@
 # Configure/build in debug mode with tests and without precompiled headers
 if [[ "$JOB_NAME" == *"code-coverage" ]]; then
     COVERAGE="--with-coverage"
+elif ! has OSX-10.9 $NODE_LABELS && ! has OSX-10.11 $NODE_LABELS; then
+    ASAN="--with-sanitizer=address"
 fi
-./waf -j1 --color=yes configure --debug --with-tests --without-pch $COVERAGE
+./waf -j1 --color=yes configure --debug --with-tests --without-pch $COVERAGE $ASAN
 ./waf -j1 --color=yes build
 
 # (tests will be run against debug version)
diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
index 88c9948..0cf6990 100755
--- a/.jenkins.d/20-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -31,6 +31,17 @@
     fi
 }
 
+ASAN_OPTIONS="color=always"
+ASAN_OPTIONS+=":detect_leaks=false"
+ASAN_OPTIONS+=":detect_stack_use_after_return=true"
+ASAN_OPTIONS+=":check_initialization_order=true"
+ASAN_OPTIONS+=":strict_init_order=true"
+ASAN_OPTIONS+=":detect_invalid_pointer_pairs=1"
+ASAN_OPTIONS+=":detect_container_overflow=false"
+ASAN_OPTIONS+=":strict_string_checks=true"
+ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
+export ASAN_OPTIONS
+
 # First run all tests as unprivileged user
 ./build/unit-tests-core $(ut_log_args)
 ./build/unit-tests-daemon $(ut_log_args)