From c2b4379787efd59c214faf72c954c8d075a86fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Hunold?= Date: Sun, 6 Aug 2017 17:54:25 +0200 Subject: [PATCH] Activated coverity support --- .travis.yml | 186 ++++++++++++++++++++++++++++++++++++++-------------- README.md | 14 ++-- covscan.sh | 38 +++++++++++ 3 files changed, 185 insertions(+), 53 deletions(-) create mode 100755 covscan.sh diff --git a/.travis.yml b/.travis.yml index 64ba930..b103bf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,64 +4,154 @@ # # Copyright Rene Rivera 2015-2016. +sudo: false +dist: trusty +language: cpp + branches: only: - master - develop -dist: trusty +env: + global: + # see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties + # to use the default for a given environment, comment it out; recommend you build debug and release however.. + # - B2_ADDRESS_MODEL=address-model=64,32 + # - B2_LINK=link=shared,static + # - B2_THREADING=threading=multi,single + - B2_VARIANT=variant=release,debug -language: cpp +install: + - export SELF=`basename $TRAVIS_BUILD_DIR` + - cd .. + - git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + - cd boost-root + - git submodule update --init tools/boostdep + - git submodule update --init tools/build + - git submodule update --init tools/inspect + - cp -r $TRAVIS_BUILD_DIR/* libs/$SELF + - export BOOST_ROOT="`pwd`" + - export PATH="`pwd`":$PATH + - python tools/boostdep/depinst/depinst.py $SELF + - ./bootstrap.sh + - ./b2 headers + +addons: + apt: + packages: + - binutils-gold + - gdb + - libc6-dbg + +script: + - |- + echo "using $TOOLSET : : $COMPILER : -std=$CXXSTD ;" > ~/user-config.jam + - ./b2 libs/$SELF/test toolset=$TOOLSET $CXXFLAGS $LINKFLAGS $B2_ADDRESS_MODEL $B2_LINK $B2_THREADING $B2_VARIANT -j3 + + +jobs: + include: + # C++03 using stock compilers + - os: linux + env: + - TOOLSET=gcc + - CXXSTD=c++03 + - os: linux + env: + - TOOLSET=clang + - CXXSTD=c++03 + + # C++17 using the latest compilers + - os: linux + env: + - TOOLSET=gcc + - COMPILER=g++-7 + - CXXSTD=c++17 + addons: + apt: + packages: + - g++-7 + sources: + - ubuntu-toolchain-r-test + - os: linux + env: + - TOOLSET=clang + - COMPILER=clang++-5.0 + - CXXSTD=c++17 + addons: + apt: + packages: + - clang-5.0 + - g++-7 + sources: + - llvm-toolchain-trusty-5.0 + - ubuntu-toolchain-r-test + + - os: osx + env: + - TOOLSET=clang + - CXXSTD=c++03 + + - os: osx + osx_image: xcode9.1 + env: + - TOOLSET=clang + - CXXSTD=c++03 + + # Coverity Scan - runs on pull requests into master + - os: linux + if: branch = master or branch = develop + script: + - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- + - libs/$SELF/covscan.sh + env: + - COMMENT="Coverity Scan" + + # UBSAN build + - os: linux + env: + - COMMENT="UBSAN" + - B2_VARIANT=variant=debug + - TOOLSET=clang + - COMPILER=clang++-5.0 + - CXXSTD=c++03 + - CXXFLAGS="cxxflags=-fno-omit-frame-pointer cxxflags=-fsanitize=undefined cxxflags=-fsanitize=integer" + - LINKFLAGS="linkflags=-fsanitize=undefined" + addons: + apt: + packages: + - clang-5.0 + - g++-7 + sources: + - llvm-toolchain-trusty-5.0 + - ubuntu-toolchain-r-test + +after_success: + # If this is not a profiling build skip the rest... + - if [[ "$COVERALL" -ne "1" ]]; then exit 0; fi + + # Copying Coveralls data to a separate folder + - wget https://github.com/linux-test-project/lcov/archive/v1.13.zip + - unzip v1.13.zip + - LCOV="`pwd`/lcov-1.13/bin/lcov --gcov-tool gcov-6" + + # Preparing Coveralls data + - mkdir -p $TRAVIS_BUILD_DIR/coverals + - $LCOV --directory bin.v2/libs/$SELF --base-directory libs/$SELF --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info --no-external + - $LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info "*/$SELF/test/*" --output-file $TRAVIS_BUILD_DIR/coverals/coverage-filtered.info + + # Sending data to Coveralls + - cd $TRAVIS_BUILD_DIR + - gem install coveralls-lcov + - coveralls-lcov coverals/coverage-filtered.info notifications: email: recipients: - jhunold@gmx.eu -sudo: required -env: - matrix: - - TRAVIS_EMPTY_JOB_WORKAROUND=true - -matrix: - exclude: - - env: TRAVIS_EMPTY_JOB_WORKAROUND=true - include: - - env: TOOLSET=clang-3.9 - os: linux - - env: TOOLSET=clang-4.0 - os: linux - - env: TOOLSET=clang-3.6 - os: linux - - env: TOOLSET=gcc-4.7 - os: linux - - env: TOOLSET=gcc-4.8 - os: linux - - env: TOOLSET=gcc-4.9 - os: linux - - env: TOOLSET=gcc-5.1 - os: linux - - env: TOOLSET=gcc-6 - os: linux - - env: TOOLSET=gcc-7 - os: linux - - env: TOOLSET=xcode-7.3 - os: osx - osx_image: xcode7.3 - - env: TOOLSET=xcode-8.3 - os: osx - osx_image: xcode8.3 - -before_install: - # Fetch the scripts to do the actual building/testing. - - | - wget "https://raw.githubusercontent.com/boostorg/regression/develop/ci/src/ci_boost_common.py" -P .. - wget "https://raw.githubusercontent.com/boostorg/regression/develop/ci/src/ci_boost_library_test.py" -P .. - -install: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" install -before_script: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" before_script -script: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" script -after_success: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" after_success -after_failure: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" after_failure -after_script: python "${TRAVIS_BUILD_DIR}/../ci_boost_library_test.py" after_script +cache: + directories: + - $HOME/boost-root diff --git a/README.md b/README.md index 54a0834..685cb46 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ Boost.Units =========== -Boost.Units, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), -implements dimensional analysis in a general and extensible manner, -treating it as a generic compile-time metaprogramming problem. -With appropriate compiler optimization, no runtime execution cost is introduced, +Boost.Units, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), +implements dimensional analysis in a general and extensible manner, +treating it as a generic compile-time metaprogramming problem. +With appropriate compiler optimization, no runtime execution cost is introduced, facilitating the use of this library to provide dimension checking in performance-critical code. ### Directories @@ -12,7 +12,7 @@ facilitating the use of this library to provide dimension checking in performanc * **doc** - QuickBook documentation sources * **example** - examples * **images** - images for documention -* **include** - Interface headers +* **include** - Interface headers * **test** - unit tests * **test_headers** - unit tests for self containment of headers * **tutorial** - tutorial @@ -24,6 +24,10 @@ facilitating the use of this library to provide dimension checking in performanc master | [![Build Status](https://travis-ci.org/boostorg/units.svg?branch=master)](https://travis-ci.org/boostorg/units) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/units?branch=master&svg=true)](https://ci.appveyor.com/project/boostorg/units) develop | [![Build Status](https://travis-ci.org/boostorg/units.svg)](https://travis-ci.org/boostorg/units) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/units?svg=true)](https://ci.appveyor.com/project/boostorg/units) + + Coverity Scan Build Status + ### More information diff --git a/covscan.sh b/covscan.sh new file mode 100755 index 0000000..88e08d3 --- /dev/null +++ b/covscan.sh @@ -0,0 +1,38 @@ +#! /bin/bash +# +# Copyright 2017 James E. King, III +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# Bash script to run in travis to perform a Coverity Scan build +# + +# +# Environment Variables +# +# COVERITY_SCAN_NOTIFICATION_EMAIL - email address to notify +# COVERITY_SCAN_TOKEN - the Coverity Scan token (should be secure) +# SELF - the boost libs directory name + +set -ex + +pushd /tmp +rm -rf coverity_tool.tgz cov-analysis* +wget -nv https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=boostorg/$SELF" -O coverity_tool.tgz +tar xzf coverity_tool.tgz +COVBIN=$(echo $(pwd)/cov-analysis*/bin) +export PATH=$COVBIN:$PATH +popd + +cd libs/$SELF/test +../../../b2 toolset=gcc clean +rm -rf cov-int/ +cov-build --dir cov-int ../../../b2 toolset=gcc -q -j3 +tar cJf cov-int.tar.xz cov-int/ +curl --form token="$COVERITY_SCAN_TOKEN" \ + --form email="$COVERITY_SCAN_NOTIFICATION_EMAIL" \ + --form file=@cov-int.tar.xz \ + --form version="$(git describe --tags)" \ + --form description="boostorg/$SELF" \ + https://scan.coverity.com/builds?project="boostorg/$SELF"