From 780b85e3ec64e2c4017173adc8018fec04418260 Mon Sep 17 00:00:00 2001 From: "Alexander.Likhachev" Date: Tue, 29 Sep 2020 15:03:42 +0700 Subject: [PATCH] [Gradle, K/N] Simplify testNativeTests test by reducing number of targets --- .../kotlin/gradle/native/GeneralNativeIT.kt | 14 +++++++------ .../testProject/native-tests/build.gradle | 21 +++++++------------ 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt index 45165003893..d2df27a2dd0 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/GeneralNativeIT.kt @@ -460,13 +460,15 @@ class GeneralNativeIT : BaseGradleIT() { @Test fun testNativeTests() = with(Project("native-tests")) { - val testTasks = listOf("macos64Test", "linux64Test", "mingw64Test", "iosTest") - val hostTestTask = "${nativeHostTargetName}Test" + setupWorkingDir() + configureSingleNativeTarget() + val testTasks = listOf("hostTest", "iosTest") + val hostTestTask = "hostTest" val suffix = if (isWindows) "exe" else "kexe" - val defaultOutputFile = "build/bin/${nativeHostTargetName}/debugTest/test.$suffix" - val anotherOutputFile = "build/bin/${nativeHostTargetName}/anotherDebugTest/another.$suffix" + val defaultOutputFile = "build/bin/host/debugTest/test.$suffix" + val anotherOutputFile = "build/bin/host/anotherDebugTest/another.$suffix" val hostIsMac = HostManager.hostIsMac @@ -579,7 +581,7 @@ class GeneralNativeIT : BaseGradleIT() { } } - build("linkAnotherDebugTest${nativeHostTargetName}") { + build("linkAnotherDebugTestHost") { assertSuccessful() assertFileExists(anotherOutputFile) } @@ -590,7 +592,7 @@ class GeneralNativeIT : BaseGradleIT() { // Check that test binaries can be accessed in a buildscript. build("checkNewGetters") { assertSuccessful() - val suffixes = listOf("exe", "kexe", "wasm") + val suffixes = listOf("kexe") val names = listOf("test", "another") val files = names.flatMap { name -> suffixes.map { suffix -> diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-tests/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-tests/build.gradle index c5ef0b677df..b656db8a55f 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-tests/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/native-tests/build.gradle @@ -20,16 +20,11 @@ repositories { kotlin { targets { - fromPreset(presets.macosX64, 'macos64') - fromPreset(presets.linuxX64, 'linux64') - fromPreset(presets.mingwX64, 'mingw64') + fromPreset(presets., 'host') fromPreset(presets.iosX64, 'ios') - // Test creating and accessing test binaries for cross-targets - fromPreset(presets.wasm32, 'wasm') - - configure([macos64, linux64, mingw64, wasm]) { + configure([host]) { compilations.create("anotherTest") binaries { test("another", [DEBUG]) { @@ -41,14 +36,12 @@ kotlin { sourceSets { anotherTest - macos64AnotherTest.dependsOn(anotherTest) - linux64AnotherTest.dependsOn(anotherTest) - mingw64AnotherTest.dependsOn(anotherTest) + hostAnotherTest.dependsOn(anotherTest) } } // Check that test events are correctly reported in CLI. -configure([macos64Test, linux64Test, mingw64Test, iosTest]){ +configure([hostTest, iosTest]){ testLogging { events "passed", "skipped", "failed" } @@ -58,7 +51,7 @@ configure([macos64Test, linux64Test, mingw64Test, iosTest]){ task checkOldGet { doLast { kotlin.targets { - configure([macos64, linux64, mingw64]) { + configure([host]) { println("Get test: ${binaries.getExecutable("test", DEBUG)}") } } @@ -69,7 +62,7 @@ task checkOldGet { task checkOldFind { doLast { kotlin.targets { - configure([macos64, linux64, mingw64]) { + configure([host]) { println("Find test: ${binaries.findExecutable("test", DEBUG)}") } } @@ -79,7 +72,7 @@ task checkOldFind { task checkNewGetters { doLast { kotlin.targets { - configure([macos64, linux64, mingw64, wasm]) { + configure([host]) { println("Get test: ${binaries.getTest(DEBUG).outputFile.name}") println("Find test: ${binaries.findTest(DEBUG).outputFile.name}") println("Get test: ${binaries.getTest("another", DEBUG).outputFile.name}")