Travis CI: Also test with Unexpected behavior sanitizer (UBSan)
authorIvan Maidanski <ivmai@mail.ru>
Fri, 3 Mar 2017 15:24:43 +0000 (18:24 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 3 Mar 2017 15:24:43 +0000 (18:24 +0300)
.travis.yml

index 7414568..8278b1f 100644 (file)
@@ -20,6 +20,8 @@ env:
   - CSA_CHECK=true CFLAGS_EXTRA_M=-m32
   - CPPCHECK=ALL_EXCEPT_UNUSED
   - CPPCHECK=UNUSED_FUNC
+  - SANITIZE=undefined CONF_M_UNMAP=--enable-munmap
+# TODO: Add testing with ASan/MSan when clang-3.8 available.
 
 matrix:
   exclude:
@@ -39,6 +41,10 @@ matrix:
     env: CPPCHECK=ALL_EXCEPT_UNUSED
   - compiler: clang
     env: CPPCHECK=UNUSED_FUNC
+  - compiler: gcc
+    env: SANITIZE=undefined CONF_M_UNMAP=--enable-munmap
+  - os: osx
+    env: SANITIZE=undefined CONF_M_UNMAP=--enable-munmap
 
 sudo: required
 
@@ -67,6 +73,9 @@ before_install:
         CPPCHECK_ENABLE="--enable=unusedFunction";
       fi;
     fi
+  - if [[ "$SANITIZE" != "" ]]; then
+      CFLAGS_EXTRA="$CFLAGS_EXTRA -fsanitize=$SANITIZE -fno-common -fno-omit-frame-pointer";
+    fi
 
 install:
   - git clone --depth=50 https://github.com/ivmai/libatomic_ops.git
@@ -106,6 +115,9 @@ script:
                 *.cc cord/*.c cord/tests/*.c extra/*.c extra/*.cpp
                 tests/*.c tests/*.cc tools/*.c;
     fi
+  - if [[ "$SANITIZE" == *memory* || "$SANITIZE" == *undefined* ]]; then
+      UBSAN_OPTIONS="halt_on_error=1" make check-without-test-driver;
+    fi
 
 after_success:
   - if [[ "$CONF_GCOV" == --en* ]]; then