Parse and add stdlib test results to overall statistics
This commit is contained in:
committed by
Pavel Punegov
parent
bcb10f06f6
commit
38b15e3ece
@@ -151,6 +151,10 @@ task resultsTask() {
|
|||||||
statistics.add(it.statistics)
|
statistics.add(it.statistics)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType(RunStdlibTest).matching {it.state.executed }.each {
|
||||||
|
statistics.add(it.statistics)
|
||||||
|
}
|
||||||
|
|
||||||
def output = ["statistics": statistics, "tests": results]
|
def output = ["statistics": statistics, "tests": results]
|
||||||
def json = JsonOutput.toJson(output)
|
def json = JsonOutput.toJson(output)
|
||||||
def reportFile = new File(testOutputExternal, "results.json")
|
def reportFile = new File(testOutputExternal, "results.json")
|
||||||
@@ -3041,6 +3045,8 @@ task runStdlibTests(type: RunStdlibTest) {
|
|||||||
useFilter = false
|
useFilter = false
|
||||||
arguments = [ "--ktest_negative_regex_filter=test.collections.CollectionTest.abstractCollectionToArray" ]
|
arguments = [ "--ktest_negative_regex_filter=test.collections.CollectionTest.abstractCollectionToArray" ]
|
||||||
runnerLogger = RunKonanTest.Logger.GTEST
|
runnerLogger = RunKonanTest.Logger.GTEST
|
||||||
|
|
||||||
|
finalizedBy resultsTask
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildKonanTests(type: BuildKonanTest) {
|
task buildKonanTests(type: BuildKonanTest) {
|
||||||
|
|||||||
@@ -252,6 +252,8 @@ abstract class KonanTest extends JavaExec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OutputStream out
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
void executeTest() {
|
void executeTest() {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
@@ -274,7 +276,7 @@ abstract class KonanTest extends JavaExec {
|
|||||||
|
|
||||||
def compilerMessagesText = compilerMessages ? project.file("${program}.compilation.log").getText('UTF-8') : ""
|
def compilerMessagesText = compilerMessages ? project.file("${program}.compilation.log").getText('UTF-8') : ""
|
||||||
|
|
||||||
def out = new ByteArrayOutputStream()
|
out = new ByteArrayOutputStream()
|
||||||
//TODO Add test timeout
|
//TODO Add test timeout
|
||||||
ExecResult execResult = project.execute {
|
ExecResult execResult = project.execute {
|
||||||
|
|
||||||
@@ -462,10 +464,41 @@ class RunKonanTest extends ExtKonanTest {
|
|||||||
|
|
||||||
class RunStdlibTest extends RunKonanTest {
|
class RunStdlibTest extends RunKonanTest {
|
||||||
public def inDevelopersRun = false
|
public def inDevelopersRun = false
|
||||||
|
public def statistics = new RunExternalTestGroup.Statistics()
|
||||||
|
|
||||||
RunStdlibTest() {
|
RunStdlibTest() {
|
||||||
super('buildKonanStdlibTests')
|
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