Travis CI: Add source check by Clang Static Analyzer
authorIvan Maidanski <ivmai@mail.ru>
Mon, 13 Feb 2017 21:34:07 +0000 (00:34 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 13 Feb 2017 21:34:07 +0000 (00:34 +0300)
.travis.yml

index 9ad49bd..08fd70c 100644 (file)
@@ -16,6 +16,7 @@ env:
       CFLAGS_EXTRA="-march=native"
       CONF_ASSERTIONS=--enable-assertions
   - CONF_GCOV=--enable-gcov
+  - CSA_CHECK=true
 
 matrix:
   exclude:
@@ -23,6 +24,8 @@ matrix:
     compiler: gcc
   - compiler: clang
     env: CONF_GCOV=--enable-gcov
+  - compiler: clang
+    env: CSA_CHECK=true
 
 sudo: required
 
@@ -42,8 +45,16 @@ install:
 
 script:
   - ./configure $CONF_ASSERTIONS $CONF_GCOV $CONF_SHARED --enable-werror
-  - make -j check CFLAGS_EXTRA="$CFLAGS_EXTRA $CFLAGS_EXTRA_M"
+  - if [[ "$CSA_CHECK" == true ]]; then
+      make --directory tests list_atomic.c test_atomic_include.h;
+    else
+      make -j check CFLAGS_EXTRA="$CFLAGS_EXTRA $CFLAGS_EXTRA_M";
+    fi
   - if [ -f tests/test_atomic.log ]; then cat tests/test_atomic*.log; fi
+  - if [[ "$CSA_CHECK" == true ]]; then
+      clang --analyze -Xanalyzer -analyzer-output=text -Werror -I src
+            -DAO_TRACE_MALLOC -DVERBOSE tests/*.c src/*.c;
+    fi
 
 after_success:
   - if [[ "$CONF_GCOV" == --en* ]]; then