[Gradle, K/N] Simplify testNativeTests test by reducing number of targets

This commit is contained in:
Alexander.Likhachev
2020-09-29 15:03:42 +07:00
parent 882f442848
commit 780b85e3ec
2 changed files with 15 additions and 20 deletions
@@ -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 ->
@@ -20,16 +20,11 @@ repositories {
kotlin {
targets {
fromPreset(presets.macosX64, 'macos64')
fromPreset(presets.linuxX64, 'linux64')
fromPreset(presets.mingwX64, 'mingw64')
fromPreset(presets.<SingleNativeTarget>, '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}")