[K/N][tests] Move stress tests into a separate project

This commit is contained in:
Alexander Shabalin
2024-03-07 09:56:59 +01:00
committed by Space Team
parent 60d425e2c7
commit aee87468a6
11 changed files with 142 additions and 26 deletions
@@ -90,6 +90,7 @@ private fun Test.ComputedTestProperties(init: ComputedTestProperties.() -> Unit)
* along with Kotlin/Native stdlib KLIB and Kotlin/Native platform KLIBs (the latter only if [requirePlatformLibs] is `true`).
* @param compilerPluginDependencies The [Configuration]s that provide compiler plugins to be enabled for the Kotlin/Native compiler
* for the duration of test execution.
* @param allowParallelExecution if false, force junit to execute test sequentially
*/
fun Project.nativeTest(
taskName: String,
@@ -98,6 +99,7 @@ fun Project.nativeTest(
customCompilerDependencies: List<Configuration> = emptyList(),
customTestDependencies: List<Configuration> = emptyList(),
compilerPluginDependencies: List<Configuration> = emptyList(),
allowParallelExecution: Boolean = true,
body: Test.() -> Unit = {},
) = projectTest(
taskName,
@@ -123,7 +125,7 @@ fun Project.nativeTest(
// additional stack frames more compared to the old one because of another launcher, etc. and it turns out this is not enough.
jvmArgs("-Xss2m")
val availableCpuCores: Int = Runtime.getRuntime().availableProcessors()
val availableCpuCores: Int = if (allowParallelExecution) Runtime.getRuntime().availableProcessors() else 1
if (!kotlinBuildProperties.isTeamcityBuild
&& minOf(kotlinBuildProperties.junit5NumberOfThreadsForParallelExecution ?: 16, availableCpuCores) > 4
) {
@@ -211,6 +213,10 @@ fun Project.nativeTest(
tag?.let { includeTags(it) }
}
if (!allowParallelExecution) {
systemProperty("junit.jupiter.execution.parallel.enabled", "false")
}
doFirst {
logger.info(
buildString {