Is there an equivalent to `maxParallelForks` for `...
# gradle
j
Is there an equivalent to 
maxParallelForks
 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)
e
afaik Gradle doesn't run tasks within the same project in parallel unless they're using workers or configuration cache is on, so I somewhat doubt your diagnosis… you could try logging in the test tasks' doFirst/doLast to confirm
j
It's not about tasks running in parallel, it's about tests within a single test task
e
hmm well the test task just execs a native binary so I'm pretty sure that is solidly #kotlin-native
I'd be surprised if it were parallel, I thought the native test runner ran everything in series from the main thread, but I haven't played around with it much…
you could try adding logging in `@BeforeTest`/`@AfterTest` to your tests to confirm
j
AFAIU, the test task may execute multiple processes to run tests in parallel, at least that's how I understood the
KotlinJvmTest
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 case
e