diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index a83c18e750f..1f1aed97fff 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -150,6 +150,10 @@ task resultsTask() { results.put(it.name, it.results) statistics.add(it.statistics) } + + tasks.withType(RunStdlibTest).matching {it.state.executed }.each { + statistics.add(it.statistics) + } def output = ["statistics": statistics, "tests": results] def json = JsonOutput.toJson(output) @@ -3041,6 +3045,8 @@ task runStdlibTests(type: RunStdlibTest) { useFilter = false arguments = [ "--ktest_negative_regex_filter=test.collections.CollectionTest.abstractCollectionToArray" ] runnerLogger = RunKonanTest.Logger.GTEST + + finalizedBy resultsTask } task buildKonanTests(type: BuildKonanTest) { diff --git a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 1e7c1fe53d9..d30add98a9c 100644 --- a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -252,6 +252,8 @@ abstract class KonanTest extends JavaExec { } } + OutputStream out + @TaskAction void executeTest() { if (!enabled) { @@ -274,7 +276,7 @@ abstract class KonanTest extends JavaExec { def compilerMessagesText = compilerMessages ? project.file("${program}.compilation.log").getText('UTF-8') : "" - def out = new ByteArrayOutputStream() + out = new ByteArrayOutputStream() //TODO Add test timeout ExecResult execResult = project.execute { @@ -462,10 +464,41 @@ class RunKonanTest extends ExtKonanTest { class RunStdlibTest extends RunKonanTest { public def inDevelopersRun = false + public def statistics = new RunExternalTestGroup.Statistics() RunStdlibTest() { super('buildKonanStdlibTests') } + + @Override + void executeTest() { + try { + super.executeTest() + } finally { + def output = out.toString("UTF-8") + + // NOTE: these regexs assert that GTEST output format is used + def matcher = (output =~ ~/\[==========\] Running ([0-9]*) tests from ([0-9]*) test cases \. .*/) + def testsTotal = 0 + if (matcher) { + testsTotal = matcher[0][1] as Integer + } + + matcher = (output =~ ~/\[ PASSED \] ([0-9]*) tests\./) + if (matcher) { + def n = matcher[0][1] as Integer + statistics.pass(n) + } + matcher = (output =~ ~/\[ FAILED \] ([0-9]*) tests.*/) + if (matcher) { + def n = matcher[0][1] as Integer + statistics.fail(n) + } + if (statistics.total == 0) { + statistics.error(testsTotal != 0 ? testsTotal : 1) + } + } + } } /**