diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e2c06c32552714c1c4d6b35c45e92a1e46c76db1..5ce615fd086a3b0932595831c3e1d543dd0d7dab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,4 +37,4 @@ test:linux: - mkdir cpp_build && cd cpp_build - cmake .. - make install & cd .. - - ./gradlew test --info --stacktrace + - ./gradlew check --info --stacktrace diff --git a/build.gradle b/build.gradle index 8fd51fa970897e0067384e13316b1023cd97f4d5..18639151c65140cf2340d01b087c10713755f79b 100644 --- a/build.gradle +++ b/build.gradle @@ -42,19 +42,43 @@ application { mainClass = 'de.hhu.stups.codegenerator.CodeGenerator' } +// The JavaScript tests currently cannot run in parallel, +// because multiple tests copy files to the same location and conflict with each other. +final noParallelTests = [ + "de.hhu.stups.codegenerator.js.*", +] + test { - // We could enable executing tests in parallel, as recommended here: + // Execute tests in parallel where possible, as recommended here: // https://docs.gradle.org/8.12/userguide/performance.html#execute_tests_in_parallel - // But this currently doesn't work with the JavaScript tests, - // because multiple tests copy files to the same location and conflict with each other. - //maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 + maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 + + filter { + excludePatterns += noParallelTests + } +} + +final testNoParallel = tasks.register("testNoParallel", Test) { + description = "Runs tests that cannot be executed in parallel." + group = "verification" + + testClassesDirs = sourceSets.test.output.classesDirs + classpath = sourceSets.test.runtimeClasspath + filter { + includePatterns += noParallelTests + } +} +tasks.named("check").configure { + dependsOn += [testNoParallel] +} + +tasks.withType(Test).configureEach { testLogging { events += [TestLogEvent.PASSED] } } - jar { manifest { attributes(