Merge pull request #217 from libtom/scan-build

Travis-CI: clang static analyzer
This commit is contained in:
Steffen Jaeckel 2017-06-14 09:19:19 +02:00 committed by GitHub
commit 23d5a02ecd
3 changed files with 37 additions and 7 deletions

View File

@ -1,18 +1,25 @@
dist: trusty
sudo: required
language: c
addons:
apt:
sources:
- debian-sid
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- binutils
- libtommath-dev
- clang-3.8
install:
- sudo apt-get update -qq
- sudo apt-get install libtommath-dev
before_script:
- gem install coveralls-lcov
- curl http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz | tar xz
- export PATH=$PATH:`pwd`/lcov-1.11/bin
- curl -s https://packagecloud.io/install/repositories/libtom/tomsfastmath/script.deb.sh | sudo bash
- curl -s https://packagecloud.io/install/repositories/libtom/packages/script.deb.sh | sudo bash
- sudo apt-get install libtfm-dev=0.13-5
matrix:
@ -25,13 +32,17 @@ compiler:
- gcc
- clang
script:
- bash "${BUILDSCRIPT}" "${BUILDNAME}" "${BUILDOPTIONS}" "makefile V=1" "-DUSE_LTM -DLTM_DESC" "/usr/lib/x86_64-linux-gnu/libtommath.a"
- bash "${BUILDSCRIPT}" "${BUILDNAME}" "${BUILDOPTIONS}" "makefile V=1" "-DUSE_LTM -DLTM_DESC" "-ltommath"
- bash "${BUILDSCRIPT}" "${BUILDNAME}" "${BUILDOPTIONS}" "makefile.shared V=1" "-DUSE_TFM -DTFM_DESC" "-ltfm"
env:
- |
BUILDSCRIPT="check_source.sh"
BUILDNAME="CHECK_SOURCES"
BUILDOPTIONS=" "
- |
BUILDSCRIPT="scan_build.sh"
BUILDNAME="SCAN_BUILD"
BUILDOPTIONS=" "
- |
BUILDSCRIPT="coverage.sh"
BUILDNAME="COVERAGE"

View File

@ -17,8 +17,8 @@ if [ -z "$(echo $CC | grep "gcc")" ]; then
exit 0
fi
if [ "$(echo $2 | grep -v 'makefile[.]')" == "" ]; then
echo "only run coverage for the regular makefile, early exit success"
if [ "$(echo $3 | grep -v 'makefile[.]')" == "" ]; then
echo "only run $0 for the regular makefile, early exit success"
exit 0
fi

19
scan_build.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
[ "$TRAVIS_CI" != "" ] && { [ -z "$(which scan-build)" ] && { echo "installing clang"; sudo apt-get install clang -y -qq; }; } || true
if [ "$#" = "5" -a "$(echo $3 | grep -v 'makefile[.]')" = "" ]; then
echo "only run $0 for the regular makefile, early exit success"
exit 0
fi
# output version
bash printinfo.sh
make clean > /dev/null
scan_build=$(which scan-build)
[ -z "$scan_build" ] && scan_build=$(find /usr/bin/ -name 'scan-build-*' | sort -nr | head -n1) || true
[ -z "$scan_build" ] && { echo "couldn't find clang scan-build"; exit 1; } || echo "run $scan_build"
export CFLAGS="-DUSE_LTM -DLTM_DESC -I/usr/include"
export EXTRALIBS="-ltommath"
$scan_build make -f makefile.unix all CFLAGS="$CFLAGS" EXTRALIBS="$EXTRALIBS"