Skip to content

Commit 5cdb92e

Browse files
committed
Enable ubsan and improve build coverage
1 parent d95d316 commit 5cdb92e

File tree

2 files changed

+203
-119
lines changed

2 files changed

+203
-119
lines changed

.travis.yml

Lines changed: 121 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,24 @@
55

66
#
77
# Generic Travis CI build script for boostorg repositories
8+
# See: https://github.com/boostorg/boost-ci
89
#
910
# Instructions for customizing this script for your library:
1011
#
11-
# 1. Copy the ci/ directory from the same source into your project:
12-
# ci/build.sh runs the build
13-
# ci/codecov.sh is used to run a profiling build and upload results to codecov.io
14-
# ci/coverity.sh is used to run a coverity build and upload results coverity scan
15-
# 2. Customize the compilers and language levels you want. Default is C++03.
16-
# 3. Update the global B2 environment settings to your liking.
17-
# 4. If you have more than include/, src/, and test/ directories then
18-
# add them to the depinst.py line as "--include tools" for tools/ (you
19-
# can put multiple --include on the command line).
20-
# 5. If you want to enable Coverity Scan, you need to provide the environment
12+
# 1. Customize the compilers and language levels you want in the 'jobs'.
13+
# 2. If you have more than include/, src/, test/, example/, examples/, or
14+
# tools/ directories, modify your Travis CI project and add the environment
15+
# variable DEPINST. For example if your build uses code in "bench/" and
16+
# "fog/" directories, then set DEPINST to the following:
17+
# --include bench --include fog
18+
# 3. If you want to enable Coverity Scan, you need to provide the environment
2119
# variables COVERITY_SCAN_TOKEN and COVERITY_SCAN_NOTIFICATION_EMAIL in
2220
# your github settings.
23-
# 6. Enable pull request builds in your boostorg/<library> account.
24-
# 7. Change the default C++ version in ci/*.sh (search for CXXSTD)
21+
# 4. Enable pull request builds in your boostorg/<library> account.
2522
#
2623
# That's it - the scripts will do everything else for you.
2724

28-
sudo: false
29-
dist: trusty
25+
dist: xenial
3026
language: cpp
3127

3228
env:
@@ -39,19 +35,9 @@ env:
3935
- B2_VARIANT=variant=release,debug
4036

4137
install:
42-
- export SELF=`basename $TRAVIS_BUILD_DIR`
43-
- cd ..
44-
- git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
45-
- cd boost-root
46-
- git submodule update -q --init tools/boostdep
47-
- git submodule update -q --init tools/build
48-
- git submodule update -q --init tools/inspect
49-
- cp -r $TRAVIS_BUILD_DIR/* libs/$SELF
50-
- export BOOST_ROOT="`pwd`"
51-
- export PATH="`pwd`":$PATH
52-
- python tools/boostdep/depinst/depinst.py $SELF --include example
53-
- ./bootstrap.sh
54-
- ./b2 headers
38+
- git clone https://github.com/boostorg/boost-ci.git boost-ci
39+
- cp -pr boost-ci/ci boost-ci/.codecov.yml .
40+
- source ci/travis/install.sh
5541

5642
addons:
5743
apt:
@@ -66,81 +52,131 @@ branches:
6652
- master
6753

6854
script:
69-
- cd libs/$SELF
70-
- ci/build.sh
55+
- cd $BOOST_ROOT/libs/$SELF
56+
- ci/travis/build.sh
57+
58+
#
59+
# Default toolsets in Ubuntu
60+
#
61+
# trusty xenial bionic
62+
# 14.04 16.04 18.04
63+
# ------ ------ ------
64+
# clang 3.4 3.8 6.0
65+
# gcc 4.8.2 5.3.1 7.3.0
66+
#
67+
68+
anchors:
69+
clang-34: &clang-34 { apt: { packages: [ "clang-3.4" ], sources: [ "llvm-toolchain-xenial-3.4" ] } }
70+
clang-38: &clang-38 { apt: { packages: [ "clang-3.8",
71+
"libstdc++-6-dev" ], sources: [ "llvm-toolchain-xenial-3.8",
72+
"ubuntu-toolchain-r-test" ] } }
73+
clang-4: &clang-4 { apt: { packages: [ "clang-4.0",
74+
"libstdc++-6-dev" ], sources: [ "llvm-toolchain-xenial-4.0",
75+
"ubuntu-toolchain-r-test" ] } }
76+
clang-5: &clang-5 { apt: { packages: [ "clang-5.0",
77+
"libstdc++-7-dev" ], sources: [ "llvm-toolchain-xenial-5.0",
78+
"ubuntu-toolchain-r-test" ] } }
79+
clang-6: &clang-6 { apt: { packages: [ "clang-6.0",
80+
"libc6-dbg",
81+
"libc++-dev",
82+
"libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-6.0",
83+
"ubuntu-toolchain-r-test" ] } }
84+
gcc-44: &gcc-44 { apt: { packages: [ "g++-4.4" ], sources: [ "ubuntu-toolchain-r-test" ] } }
85+
gcc-46: &gcc-46 { apt: { packages: [ "g++-4.6" ], sources: [ "ubuntu-toolchain-r-test" ] } }
86+
gcc-48: &gcc-48 { apt: { packages: [ "g++-4.8" ], sources: [ "ubuntu-toolchain-r-test" ] } }
87+
gcc-5: &gcc-5 { apt: { packages: [ "g++-5" ], sources: [ "ubuntu-toolchain-r-test" ] } }
88+
gcc-6: &gcc-6 { apt: { packages: [ "g++-6" ], sources: [ "ubuntu-toolchain-r-test" ] } }
89+
gcc-7: &gcc-7 { apt: { packages: [ "g++-7" ], sources: [ "ubuntu-toolchain-r-test" ] } }
90+
gcc-8: &gcc-8 { apt: { packages: [ "g++-8" ], sources: [ "ubuntu-toolchain-r-test" ] } }
7191

7292
jobs:
93+
allow_failures:
94+
- env:
95+
- COPY="all the environment settings from your job"
96+
7397
include:
98+
# libstdc++
99+
- { os: "linux", env: [ "TOOLSET=gcc-4.4", "CXXSTD=98,0x" ], addons: *gcc-44 }
100+
- { os: "linux", env: [ "TOOLSET=gcc-4.6", "CXXSTD=03,0x" ], addons: *gcc-46 }
101+
- { os: "linux", env: [ "TOOLSET=gcc-4.8", "CXXSTD=03,11" ], addons: *gcc-48 }
102+
- { os: "linux", env: [ "TOOLSET=gcc-5", "CXXSTD=03,11" ], addons: *gcc-5 }
103+
- { os: "linux", env: [ "TOOLSET=gcc-6", "CXXSTD=03,11,14" ], addons: *gcc-6 }
104+
- { os: "linux", env: [ "TOOLSET=gcc-7", "CXXSTD=03,11,14,17" ], addons: *gcc-7 }
105+
- { os: "linux", env: [ "TOOLSET=gcc-8", "CXXSTD=03,11,14,17,2a" ], addons: *gcc-8 }
106+
- { os: "linux", env: [ "TOOLSET=clang-3.4", "CXXSTD=03,11" ], addons: *clang-34 }
107+
- { os: "linux", env: [ "TOOLSET=clang-3.8", "CXXSTD=03,11,14" ], addons: *clang-38 }
108+
- { os: "linux", env: [ "TOOLSET=clang-4.0", "CXXSTD=03,11,14" ], addons: *clang-4 }
109+
- { os: "linux", env: [ "TOOLSET=clang-5.0", "CXXSTD=03,11,14,17" ], addons: *clang-5 }
110+
- { os: "linux", env: [ "TOOLSET=clang-6.0", "CXXSTD=03,11,14,17,2a" ], addons: *clang-6 }
111+
112+
# to enable Intel ICC define INTEL_ICC_SERIAL_NUMBER and disable the following:
113+
# - { os: "linux", env: [ "TOOLSET=intel-linux", "CXXSTD=11,14,17" ], addons: *gcc-7,
114+
# script: cd $BOOST_ROOT/libs/$SELF && ci/travis/intelicc.sh }
115+
116+
# libc++
117+
- { os: "linux", env: [ "TOOLSET=clang-6.0", "CXXSTD=03,11,14,17,2a",
118+
"CXXFLAGS=-stdlib=libc++" ], addons: *clang-6 }
119+
# the rvm environment on osx is taking over basic commands like "cd" and breaking things!
120+
# - { os: "osx" , env: [ "COMMENT=libc++",
121+
# "TOOLSET=clang", "CXXSTD=03,11,14" ] }
122+
74123
- os: linux
75124
env:
76-
- COMMENT="C++03"
77-
- TOOLSET=gcc,gcc-7
78-
addons:
79-
apt:
80-
packages:
81-
- g++-7
82-
sources:
83-
- ubuntu-toolchain-r-test
125+
- COMMENT=codecov.io
126+
- TOOLSET=gcc-7
127+
- DEFINES="define=BOOST_NO_STRESS_TEST=1"
128+
addons: *gcc-7
129+
script:
130+
- pushd /tmp && git clone https://github.com/linux-test-project/lcov.git && export PATH=/tmp/lcov/bin:$PATH && which lcov && lcov --version && popd
131+
- cd $BOOST_ROOT/libs/$SELF
132+
- ci/travis/codecov.sh
133+
84134
- os: linux
85-
env:
86-
- COMMENT="C++11"
87-
- TOOLSET=clang
88-
- CXXSTD=11
89-
addons:
90-
apt:
91-
packages:
92-
- g++-7
93-
sources:
94-
- ubuntu-toolchain-r-test
135+
env:
136+
- COMMENT=cppcheck
137+
script:
138+
- cd $BOOST_ROOT/libs/$SELF
139+
- ci/travis/cppcheck.sh
140+
95141
- os: linux
96-
env:
97-
- COMMENT=valgrind
98-
- TOOLSET=clang
142+
env:
143+
- COMMENT=ubsan
99144
- B2_VARIANT=variant=debug
100-
- TESTFLAGS=testing.launcher=valgrind
101-
addons:
102-
apt:
103-
packages:
104-
- clang-5.0
105-
- libstdc++-7-dev
106-
- valgrind
107-
sources:
108-
- llvm-toolchain-trusty-5.0
109-
- ubuntu-toolchain-r-test
145+
- TOOLSET=gcc-8
146+
- CXXSTD=03,11,14,17,2a
147+
- DEFINES="define=BOOST_NO_STRESS_TEST=1"
148+
- CXXFLAGS="cxxflags=-fno-omit-frame-pointer cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined"
149+
- LINKFLAGS="linkflags=-fsanitize=undefined linkflags=-fno-sanitize-recover=undefined linkflags=-fuse-ld=gold"
150+
- UBSAN_OPTIONS=print_stacktrace=1
151+
addons: *gcc-8
110152

111153
- os: linux
112154
env:
113-
- COMMENT=cppcheck
155+
- COMMENT=valgrind
156+
- TOOLSET=clang-6.0
157+
- CXXSTD=03,11,14,17,2a
158+
- DEFINES="define=BOOST_NO_STRESS_TEST=1"
159+
- B2_VARIANT=variant=debug
160+
- TESTFLAGS=testing.launcher=valgrind
161+
- VALGRIND_OPTS=--error-exitcode=1
162+
addons: *clang-6
114163
script:
115-
- libs/$SELF/ci/cppcheck.sh
164+
- cd $BOOST_ROOT/libs/$SELF
165+
- ci/travis/valgrind.sh
166+
167+
#################### Jobs to run on pushes to master, develop ###################
116168

169+
# Coverity Scan
117170
- os: linux
118-
env:
119-
- COMMENT=CodeCov
171+
if: (env(COVERITY_SCAN_NOTIFICATION_EMAIL) IS present) AND (branch IN (develop, master)) AND (type IN (cron, push))
172+
env:
173+
- COMMENT="Coverity Scan"
120174
- TOOLSET=gcc-7
121-
addons:
122-
apt:
123-
packages:
124-
- gcc-7
125-
- g++-7
126-
sources:
127-
- ubuntu-toolchain-r-test
175+
addons: *gcc-7
128176
script:
129-
- pushd /tmp && git clone https://github.com/linux-test-project/lcov.git && cd lcov && sudo make install && which lcov && lcov --version && popd
130-
- cd libs/$SELF
131-
- ci/codecov.sh
132-
133-
#################### Jobs to run on every pull request ####################
134-
# osx was disabled because it is very slow to start (can delay builds by 30 minutes)
135-
# - os: osx
136-
# osx_image: xcode9
137-
# env:
138-
# - TOOLSET=clang
139-
# - CXXSTD=03,11
140-
141-
#################### Jobs to run on pushes to master, develop ###################
177+
- cd $BOOST_ROOT/libs/$SELF
178+
- ci/travis/coverity.sh
142179

143180
notifications:
144181
email:
145182
false
146-

0 commit comments

Comments
 (0)