Skip to content

Commit 59e217d

Browse files
committed
Merge branch 'automake-tests-parallel-v4' (*includes ci bits also*)
This patch set runs tests in parallel (on travis/appveyor/vagrant), it includes cmake/autotools(automake). It should significantly decrease time that tests tooks on travis-ci (3-4 times lower, right now it is about 14-17 hours - too long!), but not without downsides, now because travis-ci workers has limited resources we will have more timing-related failures, but this is another storry, anyway ~16 hours is not acceptable. Anyway if machine has enough resources it is great to have ability to run tests in parallel (which automake couldn't do before). Changes for common test env: - autotools: before 17m / after 3m - cmake: before 15m / after 87 sec * automake-tests-parallel-v4: Run tests in parallel (they are lightweight), on CI and vagrant boxes travis-ci: install cmake from xenial (CTEST_PARALLEL_LEVEL support) test: register different tests in automake test: run different tests under different options (in a wrapper) automake: do not use serial-tests if parallel-test-harness available Fixes: libevent#439
2 parents 9c9be39 + 108b5fe commit 59e217d

File tree

7 files changed

+115
-54
lines changed

7 files changed

+115
-54
lines changed

.travis.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ os:
22
- linux
33
- osx
44
sudo: false
5+
dist: trusty
56

67
env:
78
matrix:
@@ -27,6 +28,8 @@ before_install:
2728
- if [ -n "$COVERALLS" ]; then
2829
pip install --user cpp-coveralls;
2930
fi
31+
- export JOBS=20
32+
- export TIMEOUT=50
3033
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
3134
brew update;
3235
brew uninstall libtool && brew install libtool;
@@ -43,32 +46,41 @@ before_install:
4346
export
4447
CFLAGS=-I$CMAKE_INCLUDE_PATH
4548
LDFLAGS=-L$CMAKE_LIBRARY_PATH;
49+
50+
export JOBS=4;
4651
fi
4752

4853
addons:
4954
apt:
55+
sources:
56+
- xenial
57+
- sourceline: 'deb http://archive.ubuntu.com/ubuntu xenial main'
5058
packages:
51-
- zlib1g-dev
52-
- libssl-dev
53-
- build-essential
54-
- automake
55-
- autoconf
56-
- cmake
57-
- lcov
59+
- zlib1g-dev
60+
- libssl-dev
61+
- build-essential
62+
- automake
63+
- autoconf
64+
- cmake
65+
- lcov
5866

5967
script:
6068
- if [ "$EVENT_BUILD_METHOD" = "autotools" ]; then
6169
./autogen.sh &&
6270
./configure $EVENT_CONFIGURE_OPTIONS &&
6371
make &&
64-
make verify;
72+
travis_wait $TIMEOUT make -j $JOBS verify;
6573
fi
6674
- if [ "$EVENT_BUILD_METHOD" = "cmake" ]; then
75+
export
76+
CTEST_PARALLEL_LEVEL=$JOBS
77+
CTEST_OUTPUT_ON_FAILURE=1;
78+
6779
mkdir build &&
6880
cd build &&
6981
cmake .. $EVENT_CMAKE_OPTIONS &&
70-
cmake --build . &&
71-
CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target verify;
82+
travis_wait $TIMEOUT
83+
cmake --build . --target verify;
7284
fi
7385

7486
after_script:

Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
#
55
# See LICENSE for copying information.
66

7+
# 'foreign' means that we're not enforcing GNU package rules strictly.
8+
# '1.9' means that we need automake 1.9 or later (and we do).
9+
AUTOMAKE_OPTIONS = foreign 1.9 subdir-objects
10+
711
ACLOCAL_AMFLAGS = -I m4
812

913
# This is the "Release" of the Libevent ABI. It takes precedence over

Vagrantfile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Vagrant.configure("2") do |config|
6161
6262
export CTEST_TEST_TIMEOUT=1800
6363
export CTEST_OUTPUT_ON_FAILURE=1
64-
export CTEST_PARALLEL_LEVEL=10
64+
export CTEST_PARALLEL_LEVEL=20
6565
cmake --build . --target verify
6666
SHELL
6767
end
@@ -71,7 +71,7 @@ Vagrant.configure("2") do |config|
7171
cd /vagrant
7272
./autogen.sh
7373
./configure
74-
make -j4 verify
74+
make -j20 verify
7575
SHELL
7676
end
7777
end
@@ -102,7 +102,7 @@ Vagrant.configure("2") do |config|
102102
103103
export CTEST_TEST_TIMEOUT=1800
104104
export CTEST_OUTPUT_ON_FAILURE=1
105-
export CTEST_PARALLEL_LEVEL=10
105+
export CTEST_PARALLEL_LEVEL=20
106106
cmake --build . --target verify
107107
SHELL
108108
end
@@ -112,7 +112,7 @@ Vagrant.configure("2") do |config|
112112
cd /vagrant
113113
./autogen.sh
114114
./configure
115-
make -j4 verify
115+
make -j20 verify
116116
SHELL
117117
end
118118
end
@@ -141,7 +141,7 @@ Vagrant.configure("2") do |config|
141141
142142
export CTEST_TEST_TIMEOUT=1800
143143
export CTEST_OUTPUT_ON_FAILURE=1
144-
export CTEST_PARALLEL_LEVEL=10
144+
export CTEST_PARALLEL_LEVEL=20
145145
cmake --build . --target verify
146146
SHELL
147147
end
@@ -151,7 +151,7 @@ Vagrant.configure("2") do |config|
151151
cd /vagrant
152152
./autogen.sh
153153
./configure
154-
make -j4 verify
154+
make -j20 verify
155155
SHELL
156156
end
157157
end
@@ -200,7 +200,7 @@ Vagrant.configure("2") do |config|
200200
201201
export CTEST_TEST_TIMEOUT=1800
202202
export CTEST_OUTPUT_ON_FAILURE=1
203-
export CTEST_PARALLEL_LEVEL=10
203+
export CTEST_PARALLEL_LEVEL=20
204204
cmake --build . --target verify
205205
SHELL
206206
end
@@ -212,7 +212,7 @@ Vagrant.configure("2") do |config|
212212
cd ~/vagrant
213213
./autogen.sh
214214
MAKE=gmake ./configure
215-
gmake -j4 verify
215+
gmake -j20 verify
216216
SHELL
217217
end
218218
end
@@ -249,7 +249,7 @@ Vagrant.configure("2") do |config|
249249
250250
export CTEST_TEST_TIMEOUT=1800
251251
export CTEST_OUTPUT_ON_FAILURE=1
252-
export CTEST_PARALLEL_LEVEL=10
252+
export CTEST_PARALLEL_LEVEL=20
253253
cmake --build . --target verify
254254
SHELL
255255
end
@@ -263,7 +263,7 @@ Vagrant.configure("2") do |config|
263263
cd /vagrant
264264
./autogen.sh
265265
./configure
266-
make -j4 verify
266+
make -j20 verify
267267
SHELL
268268
end
269269
end
@@ -300,7 +300,7 @@ Vagrant.configure("2") do |config|
300300
301301
export CTEST_TEST_TIMEOUT=1800
302302
export CTEST_OUTPUT_ON_FAILURE=1
303-
export CTEST_PARALLEL_LEVEL=10
303+
export CTEST_PARALLEL_LEVEL=20
304304
cmake --build . --target verify
305305
SHELL
306306
end
@@ -310,7 +310,7 @@ Vagrant.configure("2") do |config|
310310
cd /vagrant
311311
./autogen.sh
312312
./configure
313-
make -j4 verify
313+
make -j20 verify
314314
SHELL
315315
end
316316
end
@@ -390,7 +390,7 @@ Vagrant.configure("2") do |config|
390390
bash -lc "echo 'C:/OpenSSL-Win32 /ssl ntfs binary 0 0' >> /etc/fstab"
391391
bash -lc "echo 'C:/vagrant /vagrant ntfs binary 0 0' >> /etc/fstab"
392392
393-
bash -lc "exec 0</dev/null; exec 2>&1; cd /vagrant; bash -x ./autogen.sh && ./configure LDFLAGS='-L/ssl -L/ssl/lib -L/ssl/lib/MinGW' CFLAGS=-I/ssl/include && make -j4 verify"
393+
bash -lc "exec 0</dev/null; exec 2>&1; cd /vagrant; bash -x ./autogen.sh && ./configure LDFLAGS='-L/ssl -L/ssl/lib -L/ssl/lib/MinGW' CFLAGS=-I/ssl/include && make -j20 verify"
394394
SHELL
395395
end
396396
end

appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ build_script:
4949
bash -lc "echo 'C:\MinGW /mingw' > /etc/fstab"
5050
bash -lc "echo 'C:\OpenSSL-Win32 /ssl' >> /etc/fstab"
5151
$env:APPVEYOR_BUILD_FOLDER = $env:APPVEYOR_BUILD_FOLDER -replace "\\", "/"
52-
bash -lc "exec 0</dev/null; exec 2>&1; cd $env:APPVEYOR_BUILD_FOLDER; bash -x ./autogen.sh && ./configure LDFLAGS='-L/ssl -L/ssl/lib -L/ssl/lib/MinGW' CFLAGS=-I/ssl/include $env:EVENT_CONFIGURE_OPTIONS && make && make verify"
52+
bash -lc "exec 0</dev/null; exec 2>&1; cd $env:APPVEYOR_BUILD_FOLDER; bash -x ./autogen.sh && ./configure LDFLAGS='-L/ssl -L/ssl/lib -L/ssl/lib/MinGW' CFLAGS=-I/ssl/include $env:EVENT_CONFIGURE_OPTIONS && make && make verify -j20"
5353
} else {
5454
md build
5555
cd build
5656
cmake .. $env:EVENT_CMAKE_OPTIONS
5757
cmake --build .
58+
$env:CTEST_PARALLEL_LEVEL="20"
5859
ctest --output-on-failure
5960
}

configure.ac

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,7 @@ AC_PREREQ(2.59)
1010
AC_CONFIG_SRCDIR(event.c)
1111

1212
AC_CONFIG_MACRO_DIR([m4])
13-
14-
# 'foreign' means that we're not enforcing GNU package rules strictly.
15-
# '1.9' means that we need automake 1.9 or later (and we do).
16-
# serial-tests means that we don't need parallel test harness
17-
AM_INIT_AUTOMAKE(m4_esyscmd([echo foreign 1.9 subdir-objects
18-
case `automake --version | head -n 1` in
19-
*1.9*);;
20-
*1.10*);;
21-
*1.11*);;
22-
*) echo serial-tests;;
23-
esac]))
24-
13+
AM_INIT_AUTOMAKE
2514
dnl AM_SILENT_RULES req. automake 1.11. [no] defaults V=1
2615
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
2716
AC_CONFIG_HEADERS(config.h evconfig-private.h:evconfig-private.h.in)

test/include.am

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,41 @@ noinst_HEADERS+= \
4242
test/tinytest_local.h \
4343
test/tinytest_macros.h
4444

45-
# We need to copy this file, since automake doesn't want us to use top_srcdir
46-
# in TESTS.
47-
TESTS = test/test-script.sh
45+
TESTS = \
46+
test_runner_epoll \
47+
test_runner_select \
48+
test_runner_kqueue \
49+
test_runner_evport \
50+
test_runner_devpoll \
51+
test_runner_poll \
52+
test_runner_win32 \
53+
test_runner_timerfd \
54+
test_runner_changelist \
55+
test_runner_timerfd_changelist
56+
LOG_COMPILER = true
57+
TESTS_COMPILER = true
58+
59+
test_runner_epoll: test/test.sh
60+
test/test.sh -b EPOLL
61+
test_runner_select: test/test.sh
62+
test/test.sh -b SELECT
63+
test_runner_kqueue: test/test.sh
64+
test/test.sh -b KQUEUE
65+
test_runner_evport: test/test.sh
66+
test/test.sh -b EVPORT
67+
test_runner_devpoll: test/test.sh
68+
test/test.sh -b DEVPOLL
69+
test_runner_poll: test/test.sh
70+
test/test.sh -b POLL
71+
test_runner_win32: test/test.sh
72+
test/test.sh -b WIN32
73+
test_runner_timerfd: test/test.sh
74+
test/test.sh -b "" -t
75+
test_runner_changelist: test/test.sh
76+
test/test.sh -b "" -c
77+
test_runner_timerfd_changelist: test/test.sh
78+
test/test.sh -b "" -T
4879

49-
test/test-script.sh: test/test.sh
50-
cp $(top_srcdir)/test/test.sh $@
51-
52-
DISTCLEANFILES += test/test-script.sh
5380
DISTCLEANFILES += test/regress.gen.c test/regress.gen.h
5481

5582
if BUILD_REGRESS

test/test.sh

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fi
2828
TEST_DIR=.
2929
TEST_SRC_DIR=.
3030

31-
T=`echo "$0" | sed -e 's/test.sh$//' | sed -e 's/test-script.sh//' `
31+
T=`echo "$0" | sed -e 's/test.sh$//'`
3232
if test -x "$T/test-init"
3333
then
3434
TEST_DIR="$T"
@@ -146,15 +146,43 @@ do_test() {
146146
run_tests
147147
}
148148

149-
announce "Running tests:"
149+
usage()
150+
{
151+
cat <<EOL
152+
-b - specify backends
153+
-t - run timerfd test
154+
-c - run changelist test
155+
-T - run timerfd+changelist test
156+
EOL
157+
}
158+
main()
159+
{
160+
backends=$BACKENDS
161+
timerfd=0
162+
changelist=0
163+
timerfd_changelist=0
164+
165+
while getopts "b:tcT" c; do
166+
case "$c" in
167+
b) backends="$OPTARG";;
168+
t) timerfd=1;;
169+
c) changelist=1;;
170+
T) timerfd_changelist=1;;
171+
?*) usage && exit 1;;
172+
esac
173+
done
150174

151-
do_test EPOLL "(timerfd)"
152-
do_test EPOLL "(changelist)"
153-
do_test EPOLL "(timerfd+changelist)"
154-
for i in $BACKENDS; do
155-
do_test $i
156-
done
175+
announce "Running tests:"
157176

158-
if test "$FAILED" = "yes"; then
159-
exit 1
160-
fi
177+
[ $timerfd -eq 0 ] || do_test EPOLL "(timerfd)"
178+
[ $changelist -eq 0 ] || do_test EPOLL "(changelist)"
179+
[ $timerfd_changelist -eq 0 ] || do_test EPOLL "(timerfd+changelist)"
180+
for i in $backends; do
181+
do_test $i
182+
done
183+
184+
if test "$FAILED" = "yes"; then
185+
exit 1
186+
fi
187+
}
188+
main "$@"

0 commit comments

Comments
 (0)