[Native][tests] Run stdlib tests with & without workers
This commit is contained in:
+32
-7
@@ -8,6 +8,7 @@
|
|||||||
package org.jetbrains.kotlin.konan.blackboxtest
|
package org.jetbrains.kotlin.konan.blackboxtest
|
||||||
|
|
||||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestCaseId
|
import org.jetbrains.kotlin.konan.blackboxtest.support.TestCaseId
|
||||||
|
import org.jetbrains.kotlin.konan.blackboxtest.support.TestRunnerType
|
||||||
import org.jetbrains.kotlin.konan.blackboxtest.support.group.PredefinedPaths.KOTLIN_NATIVE_DISTRIBUTION
|
import org.jetbrains.kotlin.konan.blackboxtest.support.group.PredefinedPaths.KOTLIN_NATIVE_DISTRIBUTION
|
||||||
import org.jetbrains.kotlin.konan.blackboxtest.support.group.PredefinedTestCase as TC
|
import org.jetbrains.kotlin.konan.blackboxtest.support.group.PredefinedTestCase as TC
|
||||||
import org.jetbrains.kotlin.konan.blackboxtest.support.group.PredefinedTestCases
|
import org.jetbrains.kotlin.konan.blackboxtest.support.group.PredefinedTestCases
|
||||||
@@ -18,11 +19,20 @@ import org.junit.jupiter.api.TestFactory
|
|||||||
@PredefinedTestCases(
|
@PredefinedTestCases(
|
||||||
TC(
|
TC(
|
||||||
name = "nativeStdlib",
|
name = "nativeStdlib",
|
||||||
freeCompilerArgs = [
|
runnerType = TestRunnerType.DEFAULT,
|
||||||
"-Xmulti-platform",
|
freeCompilerArgs = [ENABLE_MPP, STDLIB_IS_A_FRIEND, ENABLE_X_STDLIB_API],
|
||||||
"-friend-modules=$KOTLIN_NATIVE_STDLIB_PATH",
|
sourceLocations = [
|
||||||
"-opt-in=kotlin.RequiresOptIn,kotlin.ExperimentalStdlibApi"
|
"libraries/stdlib/test/**.kt",
|
||||||
],
|
"libraries/stdlib/common/test/**.kt",
|
||||||
|
"kotlin-native/backend.native/tests/stdlib_external/text/**.kt",
|
||||||
|
"kotlin-native/backend.native/tests/stdlib_external/utils.kt",
|
||||||
|
"kotlin-native/backend.native/tests/stdlib_external/jsCollectionFactoriesActuals.kt"
|
||||||
|
]
|
||||||
|
),
|
||||||
|
TC(
|
||||||
|
name = "nativeStdlibInWorker",
|
||||||
|
runnerType = TestRunnerType.WORKER,
|
||||||
|
freeCompilerArgs = [ENABLE_MPP, STDLIB_IS_A_FRIEND, ENABLE_X_STDLIB_API],
|
||||||
sourceLocations = [
|
sourceLocations = [
|
||||||
"libraries/stdlib/test/**.kt",
|
"libraries/stdlib/test/**.kt",
|
||||||
"libraries/stdlib/common/test/**.kt",
|
"libraries/stdlib/common/test/**.kt",
|
||||||
@@ -33,7 +43,14 @@ import org.junit.jupiter.api.TestFactory
|
|||||||
),
|
),
|
||||||
TC(
|
TC(
|
||||||
name = "kotlinTest",
|
name = "kotlinTest",
|
||||||
freeCompilerArgs = ["-friend-modules=$KOTLIN_NATIVE_STDLIB_PATH"],
|
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"]
|
sourceLocations = ["libraries/kotlin.test/common/src/test/kotlin/**.kt"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -41,8 +58,16 @@ class NativeStdlibBlackBoxTest : AbstractNativeBlackBoxTest() {
|
|||||||
@TestFactory
|
@TestFactory
|
||||||
fun kotlinTest() = dynamicTestCase(TestCaseId.Named("kotlinTest"))
|
fun kotlinTest() = dynamicTestCase(TestCaseId.Named("kotlinTest"))
|
||||||
|
|
||||||
|
@TestFactory
|
||||||
|
fun kotlinTestInWorker() = dynamicTestCase(TestCaseId.Named("kotlinTestInWorker"))
|
||||||
|
|
||||||
@TestFactory
|
@TestFactory
|
||||||
fun nativeStdlib() = dynamicTestCase(TestCaseId.Named("nativeStdlib"))
|
fun nativeStdlib() = dynamicTestCase(TestCaseId.Named("nativeStdlib"))
|
||||||
|
|
||||||
|
@TestFactory
|
||||||
|
fun nativeStdlibInWorker() = dynamicTestCase(TestCaseId.Named("nativeStdlibInWorker"))
|
||||||
}
|
}
|
||||||
|
|
||||||
private const val KOTLIN_NATIVE_STDLIB_PATH = "$KOTLIN_NATIVE_DISTRIBUTION/klib/common/stdlib"
|
private const val ENABLE_MPP = "-Xmulti-platform"
|
||||||
|
private 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"
|
||||||
|
|||||||
+3
-1
@@ -38,7 +38,9 @@ class TestInfra_TestListingTest {
|
|||||||
).map(::TestName),
|
).map(::TestName),
|
||||||
parseGTestListing(
|
parseGTestListing(
|
||||||
"""
|
"""
|
||||||
|Seed: 12345
|
|Seed: 123
|
||||||
|
|Seed: 456
|
||||||
|
|Seed: -789
|
||||||
|Foo.
|
|Foo.
|
||||||
| bar
|
| bar
|
||||||
| baz
|
| baz
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ internal class PredefinedTestCaseGroupProvider(private val settings: Settings, a
|
|||||||
.parseCompilerArgs { "Failed to parse free compiler arguments for test case $testCaseId" },
|
.parseCompilerArgs { "Failed to parse free compiler arguments for test case $testCaseId" },
|
||||||
nominalPackageName = PackageName(testCaseId.uniqueName),
|
nominalPackageName = PackageName(testCaseId.uniqueName),
|
||||||
expectedOutputDataFile = null,
|
expectedOutputDataFile = null,
|
||||||
extras = WithTestRunnerExtras(runnerType = TestRunnerType.DEFAULT) // TODO: pass TR from the predefined configuration here
|
extras = WithTestRunnerExtras(runnerType = predefinedTestCase.runnerType)
|
||||||
)
|
)
|
||||||
testCase.initialize(null)
|
testCase.initialize(null)
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.konan.blackboxtest.support.group
|
package org.jetbrains.kotlin.konan.blackboxtest.support.group
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.konan.blackboxtest.support.TestRunnerType
|
||||||
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.TestSettings
|
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.TestSettings
|
||||||
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@@ -12,7 +13,12 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.settings.TestSettings
|
|||||||
internal annotation class PredefinedTestCases(vararg val testCases: PredefinedTestCase)
|
internal annotation class PredefinedTestCases(vararg val testCases: PredefinedTestCase)
|
||||||
|
|
||||||
@Target()
|
@Target()
|
||||||
internal annotation class PredefinedTestCase(val name: String, val freeCompilerArgs: Array<String>, val sourceLocations: Array<String>)
|
internal annotation class PredefinedTestCase(
|
||||||
|
val name: String,
|
||||||
|
val runnerType: TestRunnerType,
|
||||||
|
val freeCompilerArgs: Array<String>,
|
||||||
|
val sourceLocations: Array<String>
|
||||||
|
)
|
||||||
|
|
||||||
internal object PredefinedPaths {
|
internal object PredefinedPaths {
|
||||||
const val KOTLIN_NATIVE_DISTRIBUTION = "\$KOTLIN_NATIVE_DISTRIBUTION\$"
|
const val KOTLIN_NATIVE_DISTRIBUTION = "\$KOTLIN_NATIVE_DISTRIBUTION\$"
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ internal fun parseGTestListing(listing: String): Collection<TestName> = buildLis
|
|||||||
fun parseError(message: String): Nothing = parseError(message, index, line)
|
fun parseError(message: String): Nothing = parseError(message, index, line)
|
||||||
|
|
||||||
state = when {
|
state = when {
|
||||||
index == 0 && line.startsWith(STDLIB_TESTS_IGNORED_LINE_PREFIX) -> state
|
line.startsWith(STDLIB_TESTS_IGNORED_LINE_PREFIX) && state is State.Begin -> State.Begin
|
||||||
line.isBlank() -> when (state) {
|
line.isBlank() -> when (state) {
|
||||||
is State.NewTest, is State.End -> State.End
|
is State.NewTest, is State.End -> State.End
|
||||||
else -> parseError("Unexpected empty line")
|
else -> parseError("Unexpected empty line")
|
||||||
|
|||||||
Reference in New Issue
Block a user