[Native][Tests] Improve reporting for external codegen tests

Add abort() method that adds tests that failed to compile
to statistics with Error status.
This commit is contained in:
Pavel Punegov
2021-04-29 14:23:34 +03:00
committed by Space
parent 3106ad9e30
commit b4dcf45ffa
2 changed files with 12 additions and 3 deletions
@@ -553,8 +553,8 @@ fun runTest() {
project.logger.quiet("ERROR: Compilation failed for test suite: $name with exception", ex)
project.logger.quiet("The following files were unable to compile:")
ktFiles.each { project.logger.quiet(it.name) }
suite.abort(ex, ktFiles.size())
throw new RuntimeException("Compilation failed", ex)
suite.abort("Compilation failed for test suite: $name", ex, ktFiles.collect { it.name })
return
}
// Run the tests.
@@ -83,7 +83,16 @@ class KonanTestSuiteReportEnvironment(val name: String, val project: Project, va
tests += KonanTestCaseReport(name, TestStatus.SKIPPED)
}
fun abort(throwable: Throwable, count:Int) {
fun abort(comment: String, throwable: Throwable, testNames: List<String>) {
testNames.forEach {
tc?.startTest(it)
tc?.errorTest(it, java.lang.Exception(throwable))
tests += KonanTestCaseReport(it, TestStatus.ERROR, "$comment\n${throwable.toString()}")
}
abort(throwable, testNames.size)
}
fun abort(throwable: Throwable, count: Int) {
statistics.error(count)
project.logger.quiet("suite `$name` aborted with exception", throwable)
}