[Native][tests] Add separate Gradle tasks to run tests for stdlib and kotlin-test libraries

This commit is contained in:
Dmitriy Dolovov
2022-02-09 15:55:32 +03:00
parent 174f4cd220
commit ca45252143
3 changed files with 44 additions and 24 deletions
+2
View File
@@ -151,6 +151,8 @@ fun nativeTest(taskName: String, vararg tags: String) = projectTest(taskName, jU
// Tasks that run different sorts of tests. Most frequent use case: running specific tests at TeamCity.
val infrastructureTest = nativeTest("infrastructureTest", "infrastructure")
val codegenBoxTest = nativeTest("codegenBoxTest", "codegen")
val stdlibTest = nativeTest("stdlibTest", "stdlib")
val kotlinTestLibraryTest = nativeTest("kotlinTestLibraryTest", "kotlin-test")
val klibAbiTest = nativeTest("klibAbiTest", "klib")
// "test" task is created by convention. We can't just remove it. Let's enable it in developer's environment, so it can be used
@@ -0,0 +1,36 @@
/*
* Copyright 2010-2022 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.blackboxtest
import org.jetbrains.kotlin.konan.blackboxtest.support.TestCaseId
import org.jetbrains.kotlin.konan.blackboxtest.support.TestRunnerType
import org.jetbrains.kotlin.konan.blackboxtest.support.group.PredefinedTestCases
import org.jetbrains.kotlin.konan.blackboxtest.support.group.PredefinedTestCase as TC
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.TestFactory
@Tag("kotlin-test")
@PredefinedTestCases(
TC(
name = "default",
runnerType = TestRunnerType.DEFAULT,
freeCompilerArgs = [STDLIB_IS_A_FRIEND],
sourceLocations = ["libraries/kotlin.test/common/src/test/kotlin/**.kt"]
),
TC(
name = "worker",
runnerType = TestRunnerType.WORKER,
freeCompilerArgs = [STDLIB_IS_A_FRIEND],
sourceLocations = ["libraries/kotlin.test/common/src/test/kotlin/**.kt"]
)
)
class KotlinTestLibraryTest : AbstractNativeBlackBoxTest() {
@TestFactory
fun default() = dynamicTestCase(TestCaseId.Named("default"))
@TestFactory
fun worker() = dynamicTestCase(TestCaseId.Named("worker"))
}
@@ -15,10 +15,10 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.group.PredefinedTestCases
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.TestFactory
@Tag("codegen")
@Tag("stdlib")
@PredefinedTestCases(
TC(
name = "nativeStdlib",
name = "default",
runnerType = TestRunnerType.DEFAULT,
freeCompilerArgs = [ENABLE_MPP, STDLIB_IS_A_FRIEND, ENABLE_X_STDLIB_API],
sourceLocations = [
@@ -31,7 +31,7 @@ import org.junit.jupiter.api.TestFactory
ignoredTests = [DISABLED_STDLIB_TEST]
),
TC(
name = "nativeStdlibInWorker",
name = "worker",
runnerType = TestRunnerType.WORKER,
freeCompilerArgs = [ENABLE_MPP, STDLIB_IS_A_FRIEND, ENABLE_X_STDLIB_API],
sourceLocations = [
@@ -42,35 +42,17 @@ import org.junit.jupiter.api.TestFactory
"kotlin-native/backend.native/tests/stdlib_external/jsCollectionFactoriesActuals.kt"
],
ignoredTests = [DISABLED_STDLIB_TEST]
),
TC(
name = "kotlinTest",
runnerType = TestRunnerType.DEFAULT,
freeCompilerArgs = [STDLIB_IS_A_FRIEND],
sourceLocations = ["libraries/kotlin.test/common/src/test/kotlin/**.kt"]
),
TC(
name = "kotlinTestInWorker",
runnerType = TestRunnerType.WORKER,
freeCompilerArgs = [STDLIB_IS_A_FRIEND],
sourceLocations = ["libraries/kotlin.test/common/src/test/kotlin/**.kt"]
)
)
class StdlibTest : AbstractNativeBlackBoxTest() {
@TestFactory
fun kotlinTest() = dynamicTestCase(TestCaseId.Named("kotlinTest"))
fun default() = dynamicTestCase(TestCaseId.Named("default"))
@TestFactory
fun kotlinTestInWorker() = dynamicTestCase(TestCaseId.Named("kotlinTestInWorker"))
@TestFactory
fun nativeStdlib() = dynamicTestCase(TestCaseId.Named("nativeStdlib"))
@TestFactory
fun nativeStdlibInWorker() = dynamicTestCase(TestCaseId.Named("nativeStdlibInWorker"))
fun worker() = dynamicTestCase(TestCaseId.Named("worker"))
}
private const val ENABLE_MPP = "-Xmulti-platform"
private const val STDLIB_IS_A_FRIEND = "-friend-modules=$KOTLIN_NATIVE_DISTRIBUTION/klib/common/stdlib"
internal const val STDLIB_IS_A_FRIEND = "-friend-modules=$KOTLIN_NATIVE_DISTRIBUTION/klib/common/stdlib"
private const val ENABLE_X_STDLIB_API = "-opt-in=kotlin.RequiresOptIn,kotlin.ExperimentalStdlibApi"
private const val DISABLED_STDLIB_TEST = "test.collections.CollectionTest.abstractCollectionToArray"