[Native][tests] Separate Gradle tasks for different types of tests
This commit is contained in:
@@ -59,9 +59,9 @@ enum class TestProperty(shortName: String) {
|
||||
}
|
||||
}
|
||||
|
||||
if (kotlinBuildProperties.isKotlinNativeEnabled) {
|
||||
projectTest(taskName = "test", jUnitMode = JUnitMode.JUnit5) {
|
||||
dependsOn(":kotlin-native:dist" /*, ":kotlin-native:distPlatformLibs"*/)
|
||||
fun Test.setUpBlackBoxTest(tag: String) {
|
||||
if (kotlinBuildProperties.isKotlinNativeEnabled) {
|
||||
dependsOn(":kotlin-native:dist")
|
||||
workingDir = rootDir
|
||||
|
||||
maxHeapSize = "6G" // Extra heap space for Kotlin/Native compiler.
|
||||
@@ -86,10 +86,10 @@ if (kotlinBuildProperties.isKotlinNativeEnabled) {
|
||||
TestProperty.USE_CACHE.setUpFromGradleProperty(this)
|
||||
TestProperty.EXECUTION_TIMEOUT.setUpFromGradleProperty(this)
|
||||
|
||||
useJUnitPlatform()
|
||||
}
|
||||
} else {
|
||||
getOrCreateTask<Test>(taskName = "test") {
|
||||
useJUnitPlatform {
|
||||
includeTags(tag)
|
||||
}
|
||||
} else {
|
||||
doFirst {
|
||||
throw GradleException(
|
||||
"""
|
||||
@@ -102,6 +102,26 @@ if (kotlinBuildProperties.isKotlinNativeEnabled) {
|
||||
}
|
||||
}
|
||||
|
||||
val infrastructureTest by projectTest(taskName = "infrastructureTest", jUnitMode = JUnitMode.JUnit5) {
|
||||
useJUnitPlatform {
|
||||
includeTags("infrastructure")
|
||||
}
|
||||
}
|
||||
|
||||
val dailyTest by projectTest(taskName = "dailyTest", jUnitMode = JUnitMode.JUnit5) {
|
||||
setUpBlackBoxTest("daily")
|
||||
}
|
||||
|
||||
// Just an alias for daily test task.
|
||||
val test: Task by tasks.getting {
|
||||
dependsOn(dailyTest)
|
||||
}
|
||||
|
||||
projectTest(taskName = "fullTest", jUnitMode = JUnitMode.JUnit5) {
|
||||
dependsOn(dailyTest, infrastructureTest)
|
||||
// TODO: migrate and attach K/N blackbox tests from kotlin-native/backend.native/tests
|
||||
}
|
||||
|
||||
val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateNativeBlackboxTestsKt") {
|
||||
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_11))
|
||||
dependsOn(":compiler:generateTestData")
|
||||
|
||||
+6
-2
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.konan.blackboxtest.AbstractNativeBlackBoxTest
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.group.UseExtTestCaseGroupProvider
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.group.UseStandardTestCaseGroupProvider
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.junit.jupiter.api.Tag
|
||||
|
||||
fun main() {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
@@ -20,7 +21,7 @@ fun main() {
|
||||
testGroup("native/native.tests/tests-gen", "compiler/testData") {
|
||||
testClass<AbstractNativeBlackBoxTest>(
|
||||
suiteTestClassName = "NativeExtBlackBoxTestGenerated",
|
||||
annotations = listOf(annotation(UseExtTestCaseGroupProvider::class.java))
|
||||
annotations = listOf(daily(), provider<UseExtTestCaseGroupProvider>())
|
||||
) {
|
||||
model("codegen/box", targetBackend = TargetBackend.NATIVE)
|
||||
model("codegen/boxInline", targetBackend = TargetBackend.NATIVE)
|
||||
@@ -30,7 +31,7 @@ fun main() {
|
||||
// Samples (how to utilize the abilities of new test infrastructure).
|
||||
testGroup("native/native.tests/tests-gen", "native/native.tests/testData") {
|
||||
testClass<AbstractNativeBlackBoxTest>(
|
||||
annotations = listOf(annotation(UseStandardTestCaseGroupProvider::class.java))
|
||||
annotations = listOf(daily(), provider<UseStandardTestCaseGroupProvider>())
|
||||
) {
|
||||
model("samples")
|
||||
model("samples2")
|
||||
@@ -38,3 +39,6 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun <reified T : Annotation> provider() = annotation(T::class.java)
|
||||
private fun daily() = annotation(Tag::class.java, "daily")
|
||||
|
||||
+2
@@ -10,8 +10,10 @@ package org.jetbrains.kotlin.konan.blackboxtest
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestCaseId
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.group.PredefinedTestCase as TC
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.group.PredefinedTestCases
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.TestFactory
|
||||
|
||||
@Tag("daily")
|
||||
@PredefinedTestCases(
|
||||
TC(
|
||||
name = "nativeStdlib",
|
||||
|
||||
+2
@@ -14,10 +14,12 @@ import org.jetbrains.kotlin.konan.target.Family
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
import kotlin.coroutines.Continuation
|
||||
|
||||
@Suppress("ClassName")
|
||||
@Tag("infrastructure")
|
||||
class TestInfra_CompressedNamesTest {
|
||||
@Test
|
||||
fun targetNameCompression() {
|
||||
|
||||
+2
@@ -10,12 +10,14 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.util.sanitizedName
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.fail
|
||||
import java.io.File
|
||||
import kotlin.io.path.createTempDirectory
|
||||
|
||||
@Suppress("ClassName")
|
||||
@Tag("infrastructure")
|
||||
class TestInfra_GlobsExpansionTest {
|
||||
private lateinit var testDir: File
|
||||
|
||||
|
||||
+2
@@ -8,9 +8,11 @@ package org.jetbrains.kotlin.konan.blackboxtest
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.PackageName
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestName
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
@Suppress("ClassName")
|
||||
@Tag("infrastructure")
|
||||
class TestInfra_NamedEntitiesTest {
|
||||
@Test
|
||||
fun parsePackageName() {
|
||||
|
||||
+2
@@ -8,9 +8,11 @@ package org.jetbrains.kotlin.konan.blackboxtest
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestName
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.util.parseGTestListing
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
@Suppress("ClassName")
|
||||
@Tag("infrastructure")
|
||||
class TestInfra_TestListingTest {
|
||||
@Test
|
||||
fun successfullyParsed() = assertEquals(
|
||||
|
||||
Reference in New Issue
Block a user