diff --git a/.travis.yml b/.travis.yml index 20bf726..77e5254 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/coverage.sh b/coverage.sh index d582f92..48ef7f1 100755 --- a/coverage.sh +++ b/coverage.sh @@ -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 diff --git a/scan_build.sh b/scan_build.sh new file mode 100755 index 0000000..571ec4d --- /dev/null +++ b/scan_build.sh @@ -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"