[K/N][tests] Move stress tests into a separate project
This commit is contained in:
committed by
Space Team
parent
60d425e2c7
commit
aee87468a6
@@ -814,6 +814,7 @@ tasks {
|
||||
dependsOn(":kotlin-atomicfu-compiler-plugin:nativeTest")
|
||||
dependsOn(":native:analysis-api-klib-reader:check")
|
||||
dependsOn(":native:native.tests:test")
|
||||
dependsOn(":native:native.tests:stress:check")
|
||||
dependsOn(":native:objcexport-header-generator:check")
|
||||
dependsOn(":native:swift:swift-export-standalone:test")
|
||||
}
|
||||
|
||||
@@ -4,20 +4,22 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation(kotlinStdlib())
|
||||
testImplementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
|
||||
testImplementation(intellijCore())
|
||||
testImplementation(commonDependency("commons-lang:commons-lang"))
|
||||
testImplementation(commonDependency("org.jetbrains.teamcity:serviceMessages"))
|
||||
testImplementation(project(":kotlin-compiler-runner-unshaded"))
|
||||
testImplementation(projectTests(":compiler:tests-common"))
|
||||
testImplementation(projectTests(":compiler:tests-common-new"))
|
||||
testImplementation(projectTests(":compiler:test-infrastructure"))
|
||||
// Reexport these dependencies to every user of nativeTest()
|
||||
testApi(kotlinStdlib())
|
||||
testApi(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
|
||||
testApi(intellijCore())
|
||||
testApi(commonDependency("commons-lang:commons-lang"))
|
||||
testApi(commonDependency("org.jetbrains.teamcity:serviceMessages"))
|
||||
testApi(project(":kotlin-compiler-runner-unshaded"))
|
||||
testApi(projectTests(":compiler:tests-common"))
|
||||
testApi(projectTests(":compiler:tests-common-new"))
|
||||
testApi(projectTests(":compiler:test-infrastructure"))
|
||||
testApi(project(":native:kotlin-native-utils"))
|
||||
testApi(project(":native:executors"))
|
||||
|
||||
testImplementation(projectTests(":generators:test-generator"))
|
||||
testImplementation(project(":compiler:ir.serialization.native"))
|
||||
testImplementation(project(":compiler:fir:native"))
|
||||
testImplementation(project(":native:kotlin-native-utils"))
|
||||
testApi(project(":native:executors")) // Reexport this dependency to every user of nativeTest()
|
||||
testImplementation(project(":kotlin-util-klib-abi"))
|
||||
testImplementation(project(":native:swift:swift-export-standalone"))
|
||||
testImplementation(projectTests(":kotlin-util-klib-abi"))
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation(platform(libs.junit.bom))
|
||||
testImplementation(libs.junit.jupiter.api)
|
||||
testRuntimeOnly(libs.junit.jupiter.engine)
|
||||
|
||||
testImplementation(projectTests(":native:native.tests"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { none() }
|
||||
"test" {
|
||||
projectDefault()
|
||||
generatedTestDir()
|
||||
}
|
||||
}
|
||||
|
||||
testsJar {}
|
||||
|
||||
nativeTest(
|
||||
"test",
|
||||
null,
|
||||
requirePlatformLibs = true,
|
||||
allowParallelExecution = false, // Stress tests are resource-intensive tests and they must be run in isolation.
|
||||
)
|
||||
+1
@@ -2,6 +2,7 @@
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
// KIND: STANDALONE_NO_TR
|
||||
// Test depends on macOS-specific AppKit
|
||||
// DISABLE_NATIVE: isAppleTarget=false
|
||||
// DISABLE_NATIVE: targetFamily=IOS
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan.test.blackbox;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.group.UseStandardTestCaseGroupProvider;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.group.FirPipeline;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("native/native.tests/stress/testData")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@UseStandardTestCaseGroupProvider()
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
public class FirNativeStressTestGenerated extends AbstractNativeBlackBoxTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInTestData() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/stress/testData"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63423_dispose_on_main_stress.kt")
|
||||
public void testKt63423_dispose_on_main_stress() {
|
||||
runTest("native/native.tests/stress/testData/kt63423_dispose_on_main_stress.kt");
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan.test.blackbox;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.group.UseStandardTestCaseGroupProvider;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("native/native.tests/stress/testData")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@UseStandardTestCaseGroupProvider()
|
||||
public class NativeStressTestGenerated extends AbstractNativeBlackBoxTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInTestData() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/stress/testData"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63423_dispose_on_main_stress.kt")
|
||||
public void testKt63423_dispose_on_main_stress() {
|
||||
runTest("native/native.tests/stress/testData/kt63423_dispose_on_main_stress.kt");
|
||||
}
|
||||
}
|
||||
-6
@@ -46,12 +46,6 @@ public class FirNativeStandaloneTestGenerated extends AbstractNativeBlackBoxTest
|
||||
runTest("native/native.tests/testData/standalone/kt56048.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63423_dispose_on_main_stress.kt")
|
||||
public void testKt63423_dispose_on_main_stress() {
|
||||
runTest("native/native.tests/testData/standalone/kt63423_dispose_on_main_stress.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("native/native.tests/testData/standalone/console")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
-6
@@ -43,12 +43,6 @@ public class NativeStandaloneTestGenerated extends AbstractNativeBlackBoxTest {
|
||||
runTest("native/native.tests/testData/standalone/kt56048.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63423_dispose_on_main_stress.kt")
|
||||
public void testKt63423_dispose_on_main_stress() {
|
||||
runTest("native/native.tests/testData/standalone/kt63423_dispose_on_main_stress.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("native/native.tests/testData/standalone/console")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+20
@@ -526,6 +526,26 @@ fun main() {
|
||||
model("SwiftExport", pattern = "^([^_](.+))$", recursive = false)
|
||||
}
|
||||
}
|
||||
// Stress tests
|
||||
testGroup("native/native.tests/stress/tests-gen", "native/native.tests/stress/testData") {
|
||||
testClass<AbstractNativeBlackBoxTest>(
|
||||
suiteTestClassName = "NativeStressTestGenerated",
|
||||
annotations = listOf(
|
||||
provider<UseStandardTestCaseGroupProvider>(),
|
||||
)
|
||||
) {
|
||||
model("")
|
||||
}
|
||||
testClass<AbstractNativeBlackBoxTest>(
|
||||
suiteTestClassName = "FirNativeStressTestGenerated",
|
||||
annotations = listOf(
|
||||
provider<UseStandardTestCaseGroupProvider>(),
|
||||
*frontendFir(),
|
||||
)
|
||||
) {
|
||||
model("")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
+2
-2
@@ -650,7 +650,8 @@ if (buildProperties.inJpsBuildIdeaSync) {
|
||||
|
||||
":kotlin-test",
|
||||
":kotlin-test:kotlin-test-js-it",
|
||||
":native:native.tests"
|
||||
":native:native.tests",
|
||||
":native:native.tests:stress"
|
||||
|
||||
project(':kotlin-stdlib-common').projectDir = "$rootDir/libraries/stdlib/common" as File
|
||||
project(':kotlin-stdlib').projectDir = "$rootDir/libraries/stdlib" as File
|
||||
@@ -668,7 +669,6 @@ if (buildProperties.inJpsBuildIdeaSync) {
|
||||
|
||||
project(':kotlin-test').projectDir = "$rootDir/libraries/kotlin.test" as File
|
||||
project(':kotlin-test:kotlin-test-js-it').projectDir = "$rootDir/libraries/kotlin.test/js/it" as File
|
||||
project(':native:native.tests').projectDir = "$rootDir/native/native.tests" as File
|
||||
}
|
||||
include ":compiler:android-tests"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user