Joffrey
01/03/2022, 4:48 PMmaxParallelForks
for KotlinNativeTest
tasks in Gradle? I'm trying to prevent native macOS tests from running in parallel, but I can't seem to find the correct config.
Note that my diagnosis might be wrong, but I'm getting an error that I used to get because of parallelism (my tests access an external resource that doesn't support parallelism).
(this used to be posted in #kotlin-native but got no answer in a few days, so I guess this channel might be more appropriate)ephemient
01/03/2022, 5:34 PMJoffrey
01/03/2022, 5:35 PMephemient
01/03/2022, 5:40 PMephemient
01/03/2022, 5:41 PMephemient
01/03/2022, 5:43 PMJoffrey
01/03/2022, 5:52 PMKotlinJvmTest
task. maxParallelForks
controls how many test processes Gradle will launch. I believe all tests in a given test class should be run sequentially, but different test classes can be run in different JVM forks by Gradle.
This is why I'm expecting that maybe Gradle does the same for native. It could be calling an opaque binary, but still provide an argument such as a test class to run - and in this case nothing prevents gradle from spawning multiple of thoses processes, even though the native binary would run tests sequentially in the main thread. I'll look a bit more into the test tasks themselves.
What I observed so far is that it works fine with JVM , JS, iOS, tvOS and watchOS targets, all tests are green. For KotlinJvmTest
tasks I have set maxParallelForks=1
to make sure that only a single process is used to run tests. Probably the simulator-based tasks (KotlinNativeSimulatorTest
) are not run in parallel, and I'm assuming that's why I don't see a problem with those platforms. Adding a macOSX64 target fails though, hence my question about KotlinNativeTest
.
I'll mess around with before/after annotations to confirm what I'm assuming. Thanks for your help in any caseephemient
01/03/2022, 6:57 PM