Merge pull request #217 from libtom/scan-build
Travis-CI: clang static analyzer
This commit is contained in:
commit
23d5a02ecd
21
.travis.yml
21
.travis.yml
@ -1,18 +1,25 @@
|
|||||||
|
dist: trusty
|
||||||
|
sudo: required
|
||||||
|
|
||||||
language: c
|
language: c
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- debian-sid
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.8
|
||||||
packages:
|
packages:
|
||||||
- binutils
|
- clang-3.8
|
||||||
- libtommath-dev
|
|
||||||
|
install:
|
||||||
|
- sudo apt-get update -qq
|
||||||
|
- sudo apt-get install libtommath-dev
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- gem install coveralls-lcov
|
- gem install coveralls-lcov
|
||||||
- curl http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz | tar xz
|
- 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
|
- 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
|
- sudo apt-get install libtfm-dev=0.13-5
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
@ -25,13 +32,17 @@ compiler:
|
|||||||
- gcc
|
- gcc
|
||||||
- clang
|
- clang
|
||||||
script:
|
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"
|
- bash "${BUILDSCRIPT}" "${BUILDNAME}" "${BUILDOPTIONS}" "makefile.shared V=1" "-DUSE_TFM -DTFM_DESC" "-ltfm"
|
||||||
env:
|
env:
|
||||||
- |
|
- |
|
||||||
BUILDSCRIPT="check_source.sh"
|
BUILDSCRIPT="check_source.sh"
|
||||||
BUILDNAME="CHECK_SOURCES"
|
BUILDNAME="CHECK_SOURCES"
|
||||||
BUILDOPTIONS=" "
|
BUILDOPTIONS=" "
|
||||||
|
- |
|
||||||
|
BUILDSCRIPT="scan_build.sh"
|
||||||
|
BUILDNAME="SCAN_BUILD"
|
||||||
|
BUILDOPTIONS=" "
|
||||||
- |
|
- |
|
||||||
BUILDSCRIPT="coverage.sh"
|
BUILDSCRIPT="coverage.sh"
|
||||||
BUILDNAME="COVERAGE"
|
BUILDNAME="COVERAGE"
|
||||||
|
@ -17,8 +17,8 @@ if [ -z "$(echo $CC | grep "gcc")" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(echo $2 | grep -v 'makefile[.]')" == "" ]; then
|
if [ "$(echo $3 | grep -v 'makefile[.]')" == "" ]; then
|
||||||
echo "only run coverage for the regular makefile, early exit success"
|
echo "only run $0 for the regular makefile, early exit success"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
19
scan_build.sh
Executable file
19
scan_build.sh
Executable 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"
|
Loading…
Reference in New Issue
Block a user