[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(":kotlin-atomicfu-compiler-plugin:nativeTest")
|
||||||
dependsOn(":native:analysis-api-klib-reader:check")
|
dependsOn(":native:analysis-api-klib-reader:check")
|
||||||
dependsOn(":native:native.tests:test")
|
dependsOn(":native:native.tests:test")
|
||||||
|
dependsOn(":native:native.tests:stress:check")
|
||||||
dependsOn(":native:objcexport-header-generator:check")
|
dependsOn(":native:objcexport-header-generator:check")
|
||||||
dependsOn(":native:swift:swift-export-standalone:test")
|
dependsOn(":native:swift:swift-export-standalone:test")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,20 +4,22 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation(kotlinStdlib())
|
// Reexport these dependencies to every user of nativeTest()
|
||||||
testImplementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
|
testApi(kotlinStdlib())
|
||||||
testImplementation(intellijCore())
|
testApi(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
|
||||||
testImplementation(commonDependency("commons-lang:commons-lang"))
|
testApi(intellijCore())
|
||||||
testImplementation(commonDependency("org.jetbrains.teamcity:serviceMessages"))
|
testApi(commonDependency("commons-lang:commons-lang"))
|
||||||
testImplementation(project(":kotlin-compiler-runner-unshaded"))
|
testApi(commonDependency("org.jetbrains.teamcity:serviceMessages"))
|
||||||
testImplementation(projectTests(":compiler:tests-common"))
|
testApi(project(":kotlin-compiler-runner-unshaded"))
|
||||||
testImplementation(projectTests(":compiler:tests-common-new"))
|
testApi(projectTests(":compiler:tests-common"))
|
||||||
testImplementation(projectTests(":compiler:test-infrastructure"))
|
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(projectTests(":generators:test-generator"))
|
||||||
testImplementation(project(":compiler:ir.serialization.native"))
|
testImplementation(project(":compiler:ir.serialization.native"))
|
||||||
testImplementation(project(":compiler:fir: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(":kotlin-util-klib-abi"))
|
||||||
testImplementation(project(":native:swift:swift-export-standalone"))
|
testImplementation(project(":native:swift:swift-export-standalone"))
|
||||||
testImplementation(projectTests(":kotlin-util-klib-abi"))
|
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.
|
* 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.
|
* 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
|
// Test depends on macOS-specific AppKit
|
||||||
// DISABLE_NATIVE: isAppleTarget=false
|
// DISABLE_NATIVE: isAppleTarget=false
|
||||||
// DISABLE_NATIVE: targetFamily=IOS
|
// 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");
|
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
|
@Nested
|
||||||
@TestMetadata("native/native.tests/testData/standalone/console")
|
@TestMetadata("native/native.tests/testData/standalone/console")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
-6
@@ -43,12 +43,6 @@ public class NativeStandaloneTestGenerated extends AbstractNativeBlackBoxTest {
|
|||||||
runTest("native/native.tests/testData/standalone/kt56048.kt");
|
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
|
@Nested
|
||||||
@TestMetadata("native/native.tests/testData/standalone/console")
|
@TestMetadata("native/native.tests/testData/standalone/console")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+20
@@ -526,6 +526,26 @@ fun main() {
|
|||||||
model("SwiftExport", pattern = "^([^_](.+))$", recursive = false)
|
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`).
|
* 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
|
* @param compilerPluginDependencies The [Configuration]s that provide compiler plugins to be enabled for the Kotlin/Native compiler
|
||||||
* for the duration of test execution.
|
* for the duration of test execution.
|
||||||
|
* @param allowParallelExecution if false, force junit to execute test sequentially
|
||||||
*/
|
*/
|
||||||
fun Project.nativeTest(
|
fun Project.nativeTest(
|
||||||
taskName: String,
|
taskName: String,
|
||||||
@@ -98,6 +99,7 @@ fun Project.nativeTest(
|
|||||||
customCompilerDependencies: List<Configuration> = emptyList(),
|
customCompilerDependencies: List<Configuration> = emptyList(),
|
||||||
customTestDependencies: List<Configuration> = emptyList(),
|
customTestDependencies: List<Configuration> = emptyList(),
|
||||||
compilerPluginDependencies: List<Configuration> = emptyList(),
|
compilerPluginDependencies: List<Configuration> = emptyList(),
|
||||||
|
allowParallelExecution: Boolean = true,
|
||||||
body: Test.() -> Unit = {},
|
body: Test.() -> Unit = {},
|
||||||
) = projectTest(
|
) = projectTest(
|
||||||
taskName,
|
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.
|
// additional stack frames more compared to the old one because of another launcher, etc. and it turns out this is not enough.
|
||||||
jvmArgs("-Xss2m")
|
jvmArgs("-Xss2m")
|
||||||
|
|
||||||
val availableCpuCores: Int = Runtime.getRuntime().availableProcessors()
|
val availableCpuCores: Int = if (allowParallelExecution) Runtime.getRuntime().availableProcessors() else 1
|
||||||
if (!kotlinBuildProperties.isTeamcityBuild
|
if (!kotlinBuildProperties.isTeamcityBuild
|
||||||
&& minOf(kotlinBuildProperties.junit5NumberOfThreadsForParallelExecution ?: 16, availableCpuCores) > 4
|
&& minOf(kotlinBuildProperties.junit5NumberOfThreadsForParallelExecution ?: 16, availableCpuCores) > 4
|
||||||
) {
|
) {
|
||||||
@@ -211,6 +213,10 @@ fun Project.nativeTest(
|
|||||||
tag?.let { includeTags(it) }
|
tag?.let { includeTags(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!allowParallelExecution) {
|
||||||
|
systemProperty("junit.jupiter.execution.parallel.enabled", "false")
|
||||||
|
}
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
logger.info(
|
logger.info(
|
||||||
buildString {
|
buildString {
|
||||||
|
|||||||
+2
-2
@@ -650,7 +650,8 @@ if (buildProperties.inJpsBuildIdeaSync) {
|
|||||||
|
|
||||||
":kotlin-test",
|
":kotlin-test",
|
||||||
":kotlin-test:kotlin-test-js-it",
|
":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-common').projectDir = "$rootDir/libraries/stdlib/common" as File
|
||||||
project(':kotlin-stdlib').projectDir = "$rootDir/libraries/stdlib" 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').projectDir = "$rootDir/libraries/kotlin.test" as File
|
||||||
project(':kotlin-test:kotlin-test-js-it').projectDir = "$rootDir/libraries/kotlin.test/js/it" 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"
|
include ":compiler:android-tests"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user