diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/KotlinNativeTest.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/KotlinNativeTest.kt index 36b346f0358..11f372275b6 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/KotlinNativeTest.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/KotlinNativeTest.kt @@ -187,6 +187,9 @@ open class KonanGTest : KonanTest() { Pattern.compile("\\[ FAILED ] ([0-9]*) tests.*").matcher(output) .apply { if (find()) fail(group(1).toInt()) } + + Pattern.compile("\\[ SKIPPED ] ([0-9]*) test.*").matcher(output) + .apply { if (find()) skip(group(1).toInt()) } if (total == 0) { // No test were run. Try to find if we've tried to run something error(Pattern.compile("\\[={10}] Running ([0-9]*) tests from ([0-9]*) test cases\\..*") diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/GTestLogger.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/GTestLogger.kt index 72f13fa3b67..7f3513e9785 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/GTestLogger.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/GTestLogger.kt @@ -27,15 +27,20 @@ internal class GTestLogger : TestLoggerWithStatistics() { println("[----------] Global test environment tear-down") // Just hack to deal with GTest output parsers. println("[==========] $total tests from $totalSuites test cases ran. ($timeMillis ms total)") println("[ PASSED ] $passed tests.") + if (ignored != 0) { + val testsAmount = if (ignored == 1) "1 test" else "$ignored tests" + println("[ SKIPPED ] $testsAmount, listed below:") + ignoredTests.forEach { + println("[ SKIPPED ] ${it.prettyName}") + } + } if (hasFailedTests) { - println("[ FAILED ] $failed tests, listed below:") + val testsForm = if (failed == 1) "test" else "tests" + println("[ FAILED ] $failed $testsForm, listed below:") failedTests.forEach { println("[ FAILED ] ${it.prettyName}") } - println("\n$failed FAILED TESTS") - } - if (ignored != 0) { - println("YOU HAVE $ignored DISABLED TEST(S)") + println("\n$failed FAILED ${testsForm.uppercase()}") } } diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestLogger.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestLogger.kt index 46ea69c791f..ac2a5daf096 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestLogger.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestLogger.kt @@ -30,10 +30,10 @@ internal open class TestLoggerWithStatistics: BaseTestLogger() { override fun startIteration(runner: TestRunner, iteration: Int, suites: Collection) = statistics.reset() override fun finishSuite(suite: TestSuite, timeMillis: Long) = statistics.registerSuite() - override fun ignoreSuite(suite: TestSuite) = statistics.registerIgnore(suite.size) + override fun ignoreSuite(suite: TestSuite) = statistics.registerIgnore(suite) override fun pass(testCase: TestCase, timeMillis: Long) = statistics.registerPass() override fun fail(testCase: TestCase, e: Throwable, timeMillis: Long) = statistics.registerFail(testCase) - override fun ignore(testCase: TestCase) = statistics.registerIgnore() + override fun ignore(testCase: TestCase) = statistics.registerIgnore(testCase) } internal class SilentTestLogger: BaseTestLogger() { diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestStatistics.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestStatistics.kt index c4aad26afe3..c047c13a4cd 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestStatistics.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestStatistics.kt @@ -21,7 +21,9 @@ internal class MutableTestStatistics: TestStatistics { override var total: Int = 0; private set override var passed: Int = 0; private set - override var ignored: Int = 0; private set + + override val ignored: Int + get() = _ignoredTests.size override var totalSuites: Int = 0; private set @@ -35,6 +37,10 @@ internal class MutableTestStatistics: TestStatistics { override val failedTests: Collection get() = _failedTests + private val _ignoredTests = mutableListOf() + val ignoredTests: Collection + get() = _ignoredTests + fun registerSuite(count: Int = 1) { require(count >= 0) totalSuites += count @@ -53,17 +59,22 @@ internal class MutableTestStatistics: TestStatistics { fun registerFail(testCase: TestCase) = registerFail(listOf(testCase)) - fun registerIgnore(count: Int = 1) { - require(count >= 0) - total += count - ignored += count + fun registerIgnore(testCases: Collection) { + total += testCases.size + _ignoredTests.addAll(testCases) + } + + fun registerIgnore(testCase: TestCase) = registerIgnore(listOf(testCase)) + + fun registerIgnore(suite: TestSuite) { + registerIgnore(suite.testCases.values) } fun reset() { total = 0 passed = 0 - ignored = 0 totalSuites = 0 _failedTests.clear() + _ignoredTests.clear() } }