No parallel execution after 3.4

I have multi-project build and test module that has multiple projects that are doing integration testing (Starting spring context with h2 database etc)

project(":tests") {
    build.dependsOn(subprojects*.build)

    task buildTests(dependsOn: build)
}

project(":tests:test-integration-testing-a") {
    dependencies {
        compile project(":tests:test")
    }
}

project(":tests:test-integration-testing-b") {
    dependencies {
        compile project(":tests:test")
    }
}

After switching to 3.4 and now to 3.5 I can see that only one executor is used to run module tests

./gradlew :tests:test --parallel --continue

<============-> 98% EXECUTING
> IDLE
> IDLE
> IDLE
> :tests:test-integration-two:test > 86 tests completed
> IDLE
> IDLE
> IDLE

After one task is finished another is starting. Do you have any idea what can cause to execute them sequentially?

I looks like problem is more complicated, some tasks are run sequentially, one is finished another is starting.

I played around with --parallel with Gradle 3.5 a bit and cannot see an issue. The issue might be related to the fact how you model task or project dependencies. Could you please put together a sample project that reproduces the issue?

Hi Denis,

I hope you find it nice that this problem is now much more obvious with Gradle 3.5. A couple notes:

  • The console does not reflect the status of test workers, which there can be many (maxParallelForks). This is a gap we hope to fill very soon.
  • You can get really great visualization of this looking at a build scan timeline view like this one (though the feature is hardly done justice with just this scan). This may include additional information that would help you identify the problem.

As Ben said, a complete example would be really helpful to determine the exact cause.

1 Like

Found out it was related to ‘jacoco’ plugin integration:

        jacoco {
            enabled = project.hasProperty("codecoverage")
            append = true
            destinationFile = file("${buildDir}/jacoco/merged.exec")
        }

looks like Gradle correctly recognized that builds should run seq.

This helped:

configure(allprojects.findAll { it.hasProperty('codecoverage') }

Looks like you are making all tests write their coverage into the same coverage file. So they can’t run in parallel. Consider letting them have their own file and merging those after.