Skip to content

Commit fedd9e0

Browse files
committed
Try to enable parallel test running for all tests except JS tests
1 parent d6ba245 commit fedd9e0

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

.gitlab-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ test:linux:
3737
- mkdir cpp_build && cd cpp_build
3838
- cmake ..
3939
- make install & cd ..
40-
- ./gradlew test --info --stacktrace
40+
- ./gradlew check --info --stacktrace

build.gradle

+29-5
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,43 @@ application {
4242
mainClass = 'de.hhu.stups.codegenerator.CodeGenerator'
4343
}
4444

45+
// The JavaScript tests currently cannot run in parallel,
46+
// because multiple tests copy files to the same location and conflict with each other.
47+
final noParallelTests = [
48+
"de.hhu.stups.codegenerator.js.*",
49+
]
50+
4551
test {
46-
// We could enable executing tests in parallel, as recommended here:
52+
// Execute tests in parallel where possible, as recommended here:
4753
// https://docs.gradle.org/8.12/userguide/performance.html#execute_tests_in_parallel
48-
// But this currently doesn't work with the JavaScript tests,
49-
// because multiple tests copy files to the same location and conflict with each other.
50-
//maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
54+
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
55+
56+
filter {
57+
excludePatterns += noParallelTests
58+
}
59+
}
60+
61+
final testNoParallel = tasks.register("testNoParallel", Test) {
62+
description = "Runs tests that cannot be executed in parallel."
63+
group = "verification"
64+
65+
testClassesDirs = sourceSets.test.output.classesDirs
66+
classpath = sourceSets.test.runtimeClasspath
5167

68+
filter {
69+
includePatterns += noParallelTests
70+
}
71+
}
72+
tasks.named("check").configure {
73+
dependsOn += [testNoParallel]
74+
}
75+
76+
tasks.withType(Test).configureEach {
5277
testLogging {
5378
events += [TestLogEvent.PASSED]
5479
}
5580
}
5681

57-
5882
jar {
5983
manifest {
6084
attributes(

0 commit comments

Comments
 (0)