Skip to content

Commit 1e7f2bc

Browse files
authored
Merge pull request diffblue#1907 from chrisr-diffblue/travis-test-speedups
Travis test speedups
2 parents 2e7f785 + 691816b commit 1e7f2bc

File tree

3 files changed

+71
-37
lines changed

3 files changed

+71
-37
lines changed

.travis.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
- libwww-perl
6363
- g++-5
6464
- libubsan0
65+
- parallel
6566
before_install:
6667
- mkdir bin ; ln -s /usr/bin/gcc-5 bin/gcc
6768
# env: COMPILER=g++-5 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover -fno-omit-frame-pointer"
@@ -76,7 +77,7 @@ jobs:
7677
compiler: gcc
7778
cache: ccache
7879
before_install:
79-
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
80+
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache parallel
8081
- export PATH=$PATH:/usr/local/opt/ccache/libexec
8182
env: COMPILER="ccache g++"
8283

@@ -87,7 +88,7 @@ jobs:
8788
compiler: clang
8889
cache: ccache
8990
before_install:
90-
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
91+
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache parallel
9192
- export PATH=$PATH:/usr/local/opt/ccache/libexec
9293
env:
9394
- COMPILER="ccache clang++"
@@ -132,6 +133,7 @@ jobs:
132133
- clang-3.7
133134
- libstdc++-5-dev
134135
- libubsan0
136+
- parallel
135137
before_install:
136138
- mkdir bin ; ln -s /usr/bin/clang-3.7 bin/gcc
137139
- export CCACHE_CPP2=yes
@@ -258,7 +260,7 @@ install:
258260

259261
script:
260262
- if [ -e bin/gcc ] ; then export PATH=$PWD/bin:$PATH ; fi ;
261-
- env UBSAN_OPTIONS=print_stacktrace=1 make -C regression test "CXX=${COMPILER} ${EXTRA_CXXFLAGS}" -j2
263+
- env UBSAN_OPTIONS=print_stacktrace=1 make -C regression test-parallel "CXX=${COMPILER} ${EXTRA_CXXFLAGS}" -j2 JOBS=2
262264
- make -C unit "CXX=${COMPILER} ${EXTRA_CXXFLAGS}" -j2
263265
- make -C unit test
264266

regression/CMakeLists.txt

+18-14
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,29 @@ macro(add_test_pl_tests cmdline)
2020
add_test_pl_profile("${TEST_DIR_NAME}" "${cmdline}" -K KNOWNBUG ${ARGN})
2121
endmacro(add_test_pl_tests)
2222

23-
add_subdirectory(ansi-c)
23+
# For the best possible utilisation of multiple cores when
24+
# running tests in parallel, it is important that these directories are
25+
# listed with decreasing runtimes (i.e. longest running at the top)
2426
add_subdirectory(cbmc)
25-
add_subdirectory(cbmc-cover)
26-
add_subdirectory(cbmc-cpp)
2727
add_subdirectory(cbmc-java)
28-
add_subdirectory(cbmc-java-inheritance)
29-
add_subdirectory(cpp)
3028
add_subdirectory(goto-analyzer)
31-
add_subdirectory(goto-analyzer-taint)
32-
add_subdirectory(goto-cc-cbmc)
33-
add_subdirectory(goto-cc-goto-analyzer)
34-
add_subdirectory(goto-diff)
29+
add_subdirectory(ansi-c)
30+
add_subdirectory(jbmc-strings)
3531
add_subdirectory(goto-instrument)
32+
add_subdirectory(cpp)
33+
add_subdirectory(strings-smoke-tests)
34+
add_subdirectory(cbmc-cover)
3635
add_subdirectory(goto-instrument-typedef)
36+
add_subdirectory(strings)
37+
add_subdirectory(invariants)
38+
add_subdirectory(goto-diff)
39+
add_subdirectory(test-script)
40+
add_subdirectory(goto-analyzer-taint)
41+
add_subdirectory(cbmc-java-inheritance)
3742
if(NOT WIN32)
3843
add_subdirectory(goto-gcc)
3944
endif()
40-
add_subdirectory(invariants)
41-
add_subdirectory(jbmc-strings)
42-
add_subdirectory(strings)
43-
add_subdirectory(strings-smoke-tests)
44-
add_subdirectory(test-script)
45+
add_subdirectory(goto-cc-cbmc)
46+
add_subdirectory(cbmc-cpp)
47+
add_subdirectory(goto-cc-goto-analyzer)
48+

regression/Makefile

+48-20
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,62 @@
1-
DIRS = ansi-c \
2-
cbmc \
3-
cbmc-cover \
4-
cbmc-cpp \
1+
# For the best possible utilisation of multiple cores when
2+
# running tests in parallel, it is important that these directories are
3+
# listed with decreasing runtimes (i.e. longest running at the top)
4+
DIRS = cbmc \
55
cbmc-java \
6-
cbmc-java-inheritance \
7-
cpp \
86
goto-analyzer \
9-
goto-analyzer-taint \
10-
goto-cc-cbmc \
11-
goto-cc-goto-analyzer \
12-
goto-diff \
13-
goto-gcc \
7+
ansi-c \
8+
jbmc-strings \
149
goto-instrument \
10+
cpp \
11+
strings-smoke-tests \
12+
cbmc-cover \
1513
goto-instrument-typedef \
16-
invariants \
1714
strings \
18-
jbmc-strings \
19-
strings-smoke-tests \
15+
invariants \
16+
goto-diff \
2017
test-script \
18+
goto-analyzer-taint \
19+
cbmc-java-inheritance \
20+
goto-gcc \
21+
goto-cc-cbmc \
22+
cbmc-cpp \
23+
goto-cc-goto-analyzer \
2124
# Empty last line
2225

23-
# Check for the existence of $dir. Tests under goto-gcc cannot be run on
24-
# Windows, so appveyor.yml unlinks the entire directory under Windows.
26+
# Tests under goto-gcc cannot be run on Windows, so appveyor.yml unlinks
27+
# the entire directory under Windows. This variable will contain the list
28+
# of directories that actually exist on the current platform.
29+
PLATFORM_DIRS = $(wildcard $(DIRS))
30+
31+
# Run all test directories in sequence
32+
.PHONY: test
2533
test:
26-
@for dir in $(DIRS); do \
27-
if [ -d "$$dir" ]; then \
28-
$(MAKE) -C "$$dir" test || exit 1; \
29-
fi; \
34+
@for dir in $(PLATFORM_DIRS); do \
35+
$(MAKE) "$$dir" || exit 1; \
3036
done;
3137

38+
# Pattern to execute a single test suite directory
39+
.PHONY: $(PLATFORM_DIRS)
40+
$(PLATFORM_DIRS):
41+
@echo "Running $@..." ;
42+
$(MAKE) -C "$@" test || exit 1;
43+
44+
# Run all test directories using GNU Parallel
45+
.PHONY: test-parallel
46+
.NOTPARALLEL: test-parallel
47+
test-parallel:
48+
@echo "Building with $(JOBS) jobs"
49+
parallel \
50+
--halt soon,fail=1 \
51+
--tag \
52+
--tagstring '{#}:' \
53+
--linebuffer \
54+
--jobs $(JOBS) \
55+
$(MAKE) "{}" \
56+
::: $(PLATFORM_DIRS)
57+
58+
59+
.PHONY: clean
3260
clean:
3361
@for dir in *; do \
3462
if [ -d "$$dir" ]; then \

0 commit comments

Comments
 (0)