Skip to content

Commit 30d85e0

Browse files
committed
ci: Run EUnit tests in parallel on CI workers
1 parent f519c1b commit 30d85e0

1 file changed

Lines changed: 51 additions & 30 deletions

File tree

build-aux/Jenkinsfile

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ MAXIMUM_ERLANG_VERSION = '28.3.2'
3333
// works.
3434
INTERMEDIATE_ERLANG_VERSION = '27.3.4.8'
3535

36+
// Default GNU Make Eunit Options for supported platforms
37+
DEFAULT_GNU_MAKE_EUNIT_OPTS = '-j2 --output-sync=target'
38+
3639
// Use these to detect if just documents changed
3740
docs_changed = "git diff --name-only origin/${env.CHANGE_TARGET} | grep -q '^src/docs/'"
3841
github_changed = "git diff --name-only origin/${env.CHANGE_TARGET} | grep -q '^.github'"
@@ -48,7 +51,8 @@ meta = [
4851
with_clouseau: false,
4952
clouseau_java_home: '/usr',
5053
quickjs_test262: true,
51-
image: "apache/couchdbci-centos:8-erlang-${ERLANG_VERSION}"
54+
image: "apache/couchdbci-centos:8-erlang-${ERLANG_VERSION}",
55+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
5256
],
5357

5458
'centos9': [
@@ -58,7 +62,8 @@ meta = [
5862
with_clouseau: false,
5963
clouseau_java_home: '/usr',
6064
quickjs_test262: true,
61-
image: "apache/couchdbci-centos:9-erlang-${ERLANG_VERSION}"
65+
image: "apache/couchdbci-centos:9-erlang-${ERLANG_VERSION}",
66+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
6267
],
6368

6469
'centos10': [
@@ -68,7 +73,8 @@ meta = [
6873
with_clouseau: false,
6974
clouseau_java_home: '/usr',
7075
quickjs_test262: true,
71-
image: "apache/couchdbci-centos:10-erlang-${ERLANG_VERSION}"
76+
image: "apache/couchdbci-centos:10-erlang-${ERLANG_VERSION}",
77+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
7278
],
7379

7480
'jammy': [
@@ -78,7 +84,8 @@ meta = [
7884
with_clouseau: false,
7985
clouseau_java_home: '/opt/java/openjdk',
8086
quickjs_test262: true,
81-
image: "apache/couchdbci-ubuntu:jammy-erlang-${ERLANG_VERSION}"
87+
image: "apache/couchdbci-ubuntu:jammy-erlang-${ERLANG_VERSION}",
88+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
8289
],
8390

8491
'noble': [
@@ -88,7 +95,8 @@ meta = [
8895
with_clouseau: false,
8996
clouseau_java_home: '/opt/java/openjdk',
9097
quickjs_test262: true,
91-
image: "apache/couchdbci-ubuntu:noble-erlang-${ERLANG_VERSION}"
98+
image: "apache/couchdbci-ubuntu:noble-erlang-${ERLANG_VERSION}",
99+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
92100
],
93101

94102
'bullseye': [
@@ -98,7 +106,8 @@ meta = [
98106
with_clouseau: false,
99107
clouseau_java_home: '/opt/java/openjdk',
100108
quickjs_test262: true,
101-
image: "apache/couchdbci-debian:bullseye-erlang-${ERLANG_VERSION}"
109+
image: "apache/couchdbci-debian:bullseye-erlang-${ERLANG_VERSION}",
110+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
102111
],
103112

104113
// Sometimes we "pick up" ppc64le workers from the asf jenkins intance That
@@ -115,7 +124,8 @@ meta = [
115124
// with_clouseau: true,
116125
// quickjs_test262: true,
117126
// image: "${DOCKER_IMAGE_BASE}-${ERLANG_VERSION}",
118-
// node_label: 'ppc64le'
127+
// node_label: 'ppc64le',
128+
// gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
119129
// ],
120130

121131
// Just like in the ppc64le case we sometimes "pick up" built-in s390x workers added to
@@ -131,7 +141,8 @@ meta = [
131141
// // Test262Error: 51539607552,42,0,4,5,6,7,8
132142
// quickjs_test262: false,
133143
// image: "${DOCKER_IMAGE_BASE}-${ERLANG_VERSION}",
134-
// node_label: 's390x'
144+
// node_label: 's390x',
145+
// gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
135146
// ],
136147

137148
'base': [
@@ -142,7 +153,8 @@ meta = [
142153
clouseau_java_home: '/opt/java/openjdk',
143154
// Test this in in the bookworm-quickjs variant
144155
quickjs_test262: false,
145-
image: "${DOCKER_IMAGE_BASE}-${ERLANG_VERSION}"
156+
image: "${DOCKER_IMAGE_BASE}-${ERLANG_VERSION}",
157+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
146158
],
147159

148160
'base-max-erlang': [
@@ -152,7 +164,8 @@ meta = [
152164
with_clouseau: false,
153165
clouseau_java_home: '/opt/java/openjdk',
154166
quickjs_test262: false,
155-
image: "${DOCKER_IMAGE_BASE}-${MAXIMUM_ERLANG_VERSION}"
167+
image: "${DOCKER_IMAGE_BASE}-${MAXIMUM_ERLANG_VERSION}",
168+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
156169
],
157170

158171
'base-intermediate-erlang': [
@@ -162,7 +175,8 @@ meta = [
162175
with_clouseau: false,
163176
clouseau_java_home: '/opt/java/openjdk',
164177
quickjs_test262: false,
165-
image: "${DOCKER_IMAGE_BASE}-${INTERMEDIATE_ERLANG_VERSION}"
178+
image: "${DOCKER_IMAGE_BASE}-${INTERMEDIATE_ERLANG_VERSION}",
179+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
166180
],
167181

168182
'base-quickjs': [
@@ -172,7 +186,8 @@ meta = [
172186
with_clouseau: false,
173187
clouseau_java_home: '/opt/java/openjdk',
174188
quickjs_test262: true,
175-
image: "${DOCKER_IMAGE_BASE}-${ERLANG_VERSION}"
189+
image: "${DOCKER_IMAGE_BASE}-${ERLANG_VERSION}",
190+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
176191
],
177192

178193
// This runs on a docker ARM64 host. Normally we should be able to run all
@@ -192,7 +207,8 @@ meta = [
192207
// Test this in in the bookworm-quickjs variant
193208
quickjs_test262: false,
194209
image: "${DOCKER_IMAGE_BASE}-${ERLANG_VERSION}",
195-
node_label: 'docker-arm64'
210+
node_label: 'docker-arm64',
211+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
196212
],
197213

198214
'trixie': [
@@ -202,16 +218,19 @@ meta = [
202218
with_clouseau: false,
203219
clouseau_java_home: '/opt/java/openjdk',
204220
quickjs_test262: true,
205-
image: "apache/couchdbci-debian:trixie-erlang-${ERLANG_VERSION}"
221+
image: "apache/couchdbci-debian:trixie-erlang-${ERLANG_VERSION}",
222+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
206223
],
207224

208225
'freebsd-x86_64': [
209226
name: 'FreeBSD x86_64',
210227
spidermonkey_vsn: '91',
228+
with_nouveau: true,
211229
with_clouseau: true,
212230
clouseau_java_home: '/usr/local/openjdk21',
213231
quickjs_test262: false,
214-
gnu_make: 'gmake'
232+
gnu_make: 'gmake',
233+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
215234
],
216235

217236
// Spidermonkey 91 has issues on ARM64 FreeBSD
@@ -223,17 +242,18 @@ meta = [
223242
// with_clouseau: true,
224243
// clouseau_java_home: '/usr/local/openjdk21',
225244
// quickjs_test262: false,
226-
// gnu_make: 'gmake'
245+
// gnu_make: 'gmake',
246+
// gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
227247
// ],
228248

229249
'macos': [
230250
name: 'macOS',
231251
disable_spidermonkey: true,
232-
with_nouveau: false,
252+
with_nouveau: true,
233253
with_clouseau: true,
234254
clouseau_java_home: '/opt/homebrew/opt/openjdk@21',
235255
gnu_make: 'gmake',
236-
gnu_make_eunit_opts: '-j4 --output-sync=target'
256+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
237257
],
238258

239259
'win2022': [
@@ -242,7 +262,8 @@ meta = [
242262
with_clouseau: true,
243263
clouseau_java_home: /C:\tools\zulu21.46.19-ca-jdk21.0.9-win_x64/,
244264
quickjs_test262: false,
245-
node_label: 'win'
265+
node_label: 'win',
266+
gnu_make_eunit_opts: "${DEFAULT_GNU_MAKE_EUNIT_OPTS}"
246267
]
247268
]
248269

@@ -298,15 +319,11 @@ def generateNativeStage(platform) {
298319
dir( "${platform}/build" ) {
299320
sh "${configure(meta[platform])}"
300321
sh '$MAKE'
301-
eunit_opts = ''
302-
if ( meta[platform].gnu_make_eunit_opts ) {
303-
eunit_opts = meta[platform].gnu_make_eunit_opts
304-
}
305-
retry (3) {sh '$MAKE eunit ' + eunit_opts}
322+
retry (3) {sh "$MAKE ${meta[platform].gnu_make_eunit_opts} eunit" }
306323
if (meta[platform].quickjs_test262) {retry(3) {sh 'make quickjs-test262'}}
307324
retry (3) {sh '$MAKE elixir'}
308-
retry (3) {sh '$MAKE elixir-search ERLANG_COOKIE=crumbles'}
309-
retry (3) {sh '$MAKE mango-test ERLANG_COOKIE=crumbles'}
325+
retry (3) {timeout(time: 5, unit: "MINUTES") {sh '$MAKE elixir-search ERLANG_COOKIE=crumbles'}}
326+
retry (3) {timeout(time: 5, unit: "MINUTES") {sh '$MAKE mango-test ERLANG_COOKIE=crumbles'}}
310327
retry (3) {sh '$MAKE weatherreport-test'}
311328
retry (3) {sh '$MAKE nouveau-test'}
312329
}
@@ -361,7 +378,7 @@ def generateNativeStage(platform) {
361378
..\\..\\couchdb-glazier\\bin\\shell.ps1
362379
Write-Output 'The following tests are skipped:'
363380
..\\..\\couchdb-glazier\\bin\\exclude_tests_win.ps1 -Path . | Out-Host
364-
make -j 4 -f Makefile.win eunit
381+
make ${meta[platform].gnu_make_eunit_opts} -f Makefile.win eunit
365382
""", label: 'EUnit tests')
366383
}
367384

@@ -469,11 +486,15 @@ def generateContainerStage(platform) {
469486
dir( "${platform}/build" ) {
470487
sh "${configure(meta[platform])}"
471488
sh 'make'
472-
retry(3) {sh 'make eunit'}
489+
eunit_opts = ''
490+
if ( meta[platform].gnu_make_eunit_opts ) {
491+
eunit_opts = meta[platform].gnu_make_eunit_opts
492+
}
493+
retry (3) {sh "make ${eunit_opts} eunit" }
473494
if (meta[platform].quickjs_test262) {retry(3) {sh 'make quickjs-test262'}}
474495
retry(3) {sh 'make elixir'}
475-
retry(3) {sh "${setClouseauJavaHome}timeout 5m make elixir-search ERLANG_COOKIE=crumbles"}
476-
retry(3) {sh "${setClouseauJavaHome}timeout 5m make mango-test ERLANG_COOKIE=crumbles"}
496+
retry(3) {timeout(time: 5, unit: "MINUTES") {{sh "${setClouseauJavaHome}make elixir-search ERLANG_COOKIE=crumbles"}}
497+
retry(3) {timeout(time: 5, unit: "MINUTES") {{sh "${setClouseauJavaHome}make mango-test ERLANG_COOKIE=crumbles"}}
477498
retry(3) {sh 'make weatherreport-test'}
478499
retry(3) {sh 'make nouveau-test'}
479500
}

0 commit comments

Comments
 (0)