[Native][tests] Reduce test generators verbosity to avoid failing Check Repository Test as TC
This commit is contained in:
+9
-12
@@ -13,19 +13,16 @@ import org.jetbrains.kotlin.konan.blackboxtest.group.ExtTestCaseGroupProvider
|
|||||||
fun main() {
|
fun main() {
|
||||||
System.setProperty("java.awt.headless", "true")
|
System.setProperty("java.awt.headless", "true")
|
||||||
|
|
||||||
runAndLogDuration("Generating external Kotlin/Native blackbox tests") {
|
generateTestGroupSuiteWithJUnit5 {
|
||||||
generateTestGroupSuiteWithJUnit5 {
|
testGroup("native/tests-blackbox/ext-tests-gen", "compiler/testData") {
|
||||||
cleanTestGroup(
|
testClass<AbstractNativeBlackBoxTest>(
|
||||||
testsRoot = "native/tests-blackbox/ext-tests-gen",
|
suiteTestClassName = "NativeExtBlackBoxTestGenerated",
|
||||||
testDataRoot = "compiler/testData"
|
annotations = listOf(
|
||||||
|
annotation(CustomNativeBlackBoxTestCaseGroupProvider::class.java, ExtTestCaseGroupProvider::class.java)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
testClass<AbstractNativeBlackBoxTest>(
|
model("codegen/box")
|
||||||
suiteTestClassName = "NativeExtBlackBoxTestGenerated",
|
model("codegen/boxInline")
|
||||||
annotations = listOf(annotation(CustomNativeBlackBoxTestCaseGroupProvider::class.java, ExtTestCaseGroupProvider::class.java))
|
|
||||||
) {
|
|
||||||
model("codegen/box")
|
|
||||||
model("codegen/boxInline")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-7
@@ -11,13 +11,11 @@ import org.jetbrains.kotlin.konan.blackboxtest.AbstractNativeBlackBoxTest
|
|||||||
fun main() {
|
fun main() {
|
||||||
System.setProperty("java.awt.headless", "true")
|
System.setProperty("java.awt.headless", "true")
|
||||||
|
|
||||||
runAndLogDuration("Generating Kotlin/Native blackbox tests") {
|
generateTestGroupSuiteWithJUnit5 {
|
||||||
generateTestGroupSuiteWithJUnit5 {
|
testGroup("native/tests-blackbox/tests-gen", "native/tests-blackbox/testData") {
|
||||||
cleanTestGroup("native/tests-blackbox/tests-gen", "native/tests-blackbox/testData") {
|
testClass<AbstractNativeBlackBoxTest> {
|
||||||
testClass<AbstractNativeBlackBoxTest> {
|
model("samples")
|
||||||
model("samples")
|
model("samples2")
|
||||||
model("samples2")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2021 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@file:Suppress("unused")
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.generators.tests
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.generators.TestGroup
|
|
||||||
import org.jetbrains.kotlin.generators.TestGroupSuite
|
|
||||||
import org.jetbrains.kotlin.konan.blackboxtest.util.getAbsoluteFile
|
|
||||||
import java.io.File
|
|
||||||
import kotlin.system.measureTimeMillis
|
|
||||||
|
|
||||||
/** Fully clean-up the tests root directory before generating new test classes. */
|
|
||||||
internal fun TestGroupSuite.cleanTestGroup(testsRoot: String, testDataRoot: String, init: TestGroup.() -> Unit) {
|
|
||||||
getAbsoluteFile(localPath = testsRoot).deleteRecursivelyWithLogging()
|
|
||||||
testGroup(testsRoot, testDataRoot, init = init)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun runAndLogDuration(actionDescription: String, action: () -> Unit) {
|
|
||||||
println("$actionDescription...")
|
|
||||||
|
|
||||||
val duration = measureTimeMillis(action)
|
|
||||||
val seconds = duration / 1000
|
|
||||||
val millis = duration % 100
|
|
||||||
|
|
||||||
println(
|
|
||||||
buildString {
|
|
||||||
append(actionDescription)
|
|
||||||
append(" took ")
|
|
||||||
if (seconds > 0) append(seconds).append("s ")
|
|
||||||
append(millis).append("ms")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun File.deleteRecursivelyWithLogging() {
|
|
||||||
if (exists()) {
|
|
||||||
walkBottomUp().forEach { entry ->
|
|
||||||
val message = when {
|
|
||||||
entry.isFile -> "File removed: $entry"
|
|
||||||
entry.isDirectory && entry == this -> {
|
|
||||||
// Don't report directories except for the root directory.
|
|
||||||
"Directory removed (recursively): $entry"
|
|
||||||
}
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
|
|
||||||
entry.delete()
|
|
||||||
message?.let(::println)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user