Travis: Add scan-build Static Code Analysis
Add scan-build static code analyzer for clang and gcc to Travis CI.
Fix unchecked index warning in session-util.c found by scan-build.
Fixes #969.
Signed-off-by: Dan Anderson <daniel.anderson@intel.com>
diff --git a/.travis.yml b/.travis.yml
index a75cc25..f4a3230 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -85,9 +85,19 @@
if [ "$CC" == "gcc" ]; then
export CONFIGURE_OPTIONS="--enable-code-coverage";
fi
- - ../configure --enable-unit --enable-integration $CONFIGURE_OPTIONS
+ - |
+ if [ "$CC" == "clang" ]; then
+ scan-build ../configure --enable-unit --enable-integration $CONFIGURE_OPTIONS
+ else
+ ../configure --enable-unit --enable-integration $CONFIGURE_OPTIONS
+ fi
- make -j$(nproc) distcheck
- - make -j$(nproc) check
+ - |
+ if [ "$CC" == "clang" ]; then
+ scan-build --status-bugs make -j$(nproc) check
+ else
+ make -j$(nproc) check
+ fi
- cat test-suite.log
- |
for LOG in $(ls -1 test/unit/*.log); do