diff --git a/native/tests-blackbox/tests/org/jetbrains/kotlin/generators/tests/GenerateExtNativeBlackboxTests.kt b/native/tests-blackbox/tests/org/jetbrains/kotlin/generators/tests/GenerateExtNativeBlackboxTests.kt index 6b0db2c128e..588c8f646a5 100644 --- a/native/tests-blackbox/tests/org/jetbrains/kotlin/generators/tests/GenerateExtNativeBlackboxTests.kt +++ b/native/tests-blackbox/tests/org/jetbrains/kotlin/generators/tests/GenerateExtNativeBlackboxTests.kt @@ -13,19 +13,16 @@ import org.jetbrains.kotlin.konan.blackboxtest.group.ExtTestCaseGroupProvider fun main() { System.setProperty("java.awt.headless", "true") - runAndLogDuration("Generating external Kotlin/Native blackbox tests") { - generateTestGroupSuiteWithJUnit5 { - cleanTestGroup( - testsRoot = "native/tests-blackbox/ext-tests-gen", - testDataRoot = "compiler/testData" + generateTestGroupSuiteWithJUnit5 { + testGroup("native/tests-blackbox/ext-tests-gen", "compiler/testData") { + testClass( + suiteTestClassName = "NativeExtBlackBoxTestGenerated", + annotations = listOf( + annotation(CustomNativeBlackBoxTestCaseGroupProvider::class.java, ExtTestCaseGroupProvider::class.java) + ) ) { - testClass( - suiteTestClassName = "NativeExtBlackBoxTestGenerated", - annotations = listOf(annotation(CustomNativeBlackBoxTestCaseGroupProvider::class.java, ExtTestCaseGroupProvider::class.java)) - ) { - model("codegen/box") - model("codegen/boxInline") - } + model("codegen/box") + model("codegen/boxInline") } } } diff --git a/native/tests-blackbox/tests/org/jetbrains/kotlin/generators/tests/GenerateNativeBlackboxTests.kt b/native/tests-blackbox/tests/org/jetbrains/kotlin/generators/tests/GenerateNativeBlackboxTests.kt index 8705e8428f6..32a563ee6c3 100644 --- a/native/tests-blackbox/tests/org/jetbrains/kotlin/generators/tests/GenerateNativeBlackboxTests.kt +++ b/native/tests-blackbox/tests/org/jetbrains/kotlin/generators/tests/GenerateNativeBlackboxTests.kt @@ -11,13 +11,11 @@ import org.jetbrains.kotlin.konan.blackboxtest.AbstractNativeBlackBoxTest fun main() { System.setProperty("java.awt.headless", "true") - runAndLogDuration("Generating Kotlin/Native blackbox tests") { - generateTestGroupSuiteWithJUnit5 { - cleanTestGroup("native/tests-blackbox/tests-gen", "native/tests-blackbox/testData") { - testClass { - model("samples") - model("samples2") - } + generateTestGroupSuiteWithJUnit5 { + testGroup("native/tests-blackbox/tests-gen", "native/tests-blackbox/testData") { + testClass { + model("samples") + model("samples2") } } } diff --git a/native/tests-blackbox/tests/org/jetbrains/kotlin/generators/tests/GeneratorUtil.kt b/native/tests-blackbox/tests/org/jetbrains/kotlin/generators/tests/GeneratorUtil.kt deleted file mode 100644 index f070a316b54..00000000000 --- a/native/tests-blackbox/tests/org/jetbrains/kotlin/generators/tests/GeneratorUtil.kt +++ /dev/null @@ -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) - } - } -}