Skip to content

Commit b0bff8d

Browse files
committed
parallelize build
1 parent d54c7ec commit b0bff8d

File tree

3 files changed

+46
-35
lines changed

3 files changed

+46
-35
lines changed

.travis.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ language: c
44

55
cache:
66
- pip
7+
- ccache
78

89
addons:
910
apt:
1011
packages:
1112
- shellcheck
1213
- valgrind
13-
- gcc
14-
- clang
1514
- python-docutils
1615
- python3-pip
1716
- python3-setuptools
1817
- ninja-build
1918
- meson
2019
- python3-pytest
2120
- libglib2.0-dev
21+
- ccache
2222

2323
install: test/travis-install.sh
2424

@@ -27,5 +27,17 @@ jobs:
2727
- name: Lint
2828
script: ./test/lint.sh
2929
install: skip
30-
- name: Build + Test
30+
- name: Build + Test (clang)
31+
compiler: clang
32+
script: test/travis-build.sh
33+
- name: Build + Test (gcc)
34+
compiler: gcc
35+
script: test/travis-build.sh
36+
- name: Build with sanitizer (undefined)
37+
compiler: clang
38+
env: SANITIZER=undefined
39+
script: test/travis-build.sh
40+
- name: Build with sanitizer (address)
41+
compiler: clang
42+
env: SANITIZER=address
3143
script: test/travis-build.sh

test/build_test_all.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -e
3+
4+
CC=gcc test/travis-build.sh
5+
CC=clang test/travis-build.sh
6+
CC=clang SANITIZER=undefined test/travis-build.sh
7+
CC=clang SANITIZER=address test/travis-build.sh

test/travis-build.sh

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,31 @@ set -e
77
export ASAN_OPTIONS="detect_leaks=0"
88

99
export LSAN_OPTIONS="suppressions=${PWD}/test/lsan_suppress.txt"
10-
export CC
1110

1211
TEST_CMD="python3 -m pytest --maxfail=99 test/"
1312

13+
build_opts='-D werror=true'
14+
15+
if [ -n "$SANITIZER" ]; then
16+
build_type=$SANITIZER
17+
build_opts="${build_opts} -D b_sanitize=${SANITIZER}"
18+
else
19+
build_type=$CC
20+
export TEST_WITH_VALGRIND=true
21+
fi
22+
23+
# b_lundef=false is required to work around clang
24+
# bug, cf. https://groups.google.com/forum/#!topic/mesonbuild/tgEdAXIIdC4
25+
if [[ "${CC}" == 'gcc-6' || "${CC}" =~ "clang" ]]; then
26+
build_opts="${build_opts} -D b_lundef=false"
27+
fi
28+
1429
# Standard build with Valgrind
15-
for CC in gcc clang; do
16-
(
17-
mkdir "build-${CC}"; cd "build-${CC}"
18-
if [ "${CC}" == 'gcc-6' ]; then
19-
build_opts='-D b_lundef=false'
20-
else
21-
build_opts=''
22-
fi
23-
# shellcheck disable=SC2086
24-
meson -D werror=true ${build_opts} ../
25-
ninja
26-
27-
TEST_WITH_VALGRIND=true ${TEST_CMD}
28-
)
29-
done
30-
(cd "build-${CC}"; sudo ninja install)
31-
32-
# Sanitized build
33-
CC=clang
34-
for san in undefined address; do
35-
(
36-
mkdir "build-${san}"
37-
cd "build-${san}"
38-
# b_lundef=false is required to work around clang
39-
# bug, cf. https://groups.google.com/forum/#!topic/mesonbuild/tgEdAXIIdC4
40-
meson -D b_sanitize=${san} -D b_lundef=false -D werror=true ..
41-
ninja
42-
${TEST_CMD}
43-
sudo ninja install
44-
)
45-
done
30+
mkdir "build-${build_type}"
31+
cd "build-${build_type}"
32+
#shellcheck disable=SC2086
33+
meson ${build_opts} ..
34+
ninja
35+
36+
${TEST_CMD}
37+
sudo ninja install

0 commit comments

Comments
 (0)