Parse and add stdlib test results to overall statistics
This commit is contained in:
committed by
Pavel Punegov
parent
bcb10f06f6
commit
38b15e3ece
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user