backend/tests: Add test result reporting to run_external task.
+ regenerate external tests.
This commit is contained in:
@@ -13,21 +13,34 @@ dependencies {
|
||||
cli_bc project(path: ':backend.native', configuration: 'cli_bc')
|
||||
}
|
||||
|
||||
def logFileName = "test-result.md"
|
||||
|
||||
task regenerate_external_tests() {
|
||||
doLast {
|
||||
def externalTestsProject = childProjects["external"]
|
||||
def gradleGenerated = externalTestsProject.file("build.gradle")
|
||||
def externalTestsDir = externalTestsProject.file("codegen/blackbox")
|
||||
gradleGenerated.write("import org.jetbrains.kotlin.*\n\n")
|
||||
gradleGenerated.write("import org.jetbrains.kotlin.*\n")
|
||||
gradleGenerated.append(
|
||||
"configurations {\n" +
|
||||
" cli_bc\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"dependencies {\n" +
|
||||
" cli_bc project(path: ':backend.native', configuration: 'cli_bc')\n" +
|
||||
"}\n\n")
|
||||
"""
|
||||
configurations {
|
||||
cli_bc
|
||||
}
|
||||
|
||||
dependencies {
|
||||
cli_bc project(path: ':backend.native', configuration: 'cli_bc')
|
||||
}
|
||||
"""
|
||||
)
|
||||
gradleGenerated.append(
|
||||
"""
|
||||
task createLogFile() {
|
||||
doLast {
|
||||
project.file("$logFileName").write("")
|
||||
}
|
||||
}
|
||||
"""
|
||||
)
|
||||
externalTestsDir.eachDirRecurse {
|
||||
// Skip build directory and directories without *.kt files.
|
||||
if (it.name == "build" || it.listFiles().count {it.name.endsWith(".kt")} == 0) {
|
||||
@@ -35,18 +48,18 @@ task regenerate_external_tests() {
|
||||
}
|
||||
|
||||
def taskDirectory = externalTestsProject.relativePath(it)
|
||||
def taskName = taskDirectory.replaceAll("/-", '_')
|
||||
def taskName = taskDirectory.replaceAll("[-/]", '_')
|
||||
|
||||
gradleGenerated.append(
|
||||
"task $taskName (type: RunExternalTestGroup) {\n" +
|
||||
" groupDirectory = \"$taskDirectory\"\n" +
|
||||
" logFileName = \"$taskDirectory/test-result.md\"\n" +
|
||||
" dependsOn(createLogFile)\n" +
|
||||
" groupDirectory = \"$taskDirectory\"\n" +
|
||||
" logFileName = \"$logFileName\"\n" +
|
||||
"}\n\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
task run() {
|
||||
dependsOn(tasks.withType(KonanTest).matching { it.enabled })
|
||||
}
|
||||
@@ -55,6 +68,22 @@ task run_external () {
|
||||
project.subprojects {
|
||||
dependsOn(it.tasks.withType(RunExternalTestGroup).matching { it.enabled })
|
||||
}
|
||||
doLast {
|
||||
def logFile = childProjects["external"].file(logFileName)
|
||||
def logText = logFile.text
|
||||
|
||||
def passed = logText.count("|PASSED|")
|
||||
def failed = logText.count("|FAILED|")
|
||||
def skipped = logText.count("|SKIPPED|")
|
||||
|
||||
def report = "\nDONE.\n\n" +
|
||||
"PASSED: $passed\n" +
|
||||
"FAILED: $failed\n" +
|
||||
"TOTAL (FAILED + PASSED): ${passed + failed}\n" +
|
||||
"SKIPPED : $skipped"
|
||||
logFile.append(report)
|
||||
println(report)
|
||||
}
|
||||
}
|
||||
|
||||
task sum (type:RunKonanTest) {
|
||||
|
||||
+605
-400
File diff suppressed because it is too large
Load Diff
@@ -226,7 +226,8 @@ class RunExternalTestGroup extends RunKonanTest {
|
||||
@Override
|
||||
void executeTest() {
|
||||
def logFile = project.file(logFileName)
|
||||
logFile.write("|Test|Status|Comment|\n|----|------|-------|")
|
||||
logFile.append("\n$groupDirectory\n\n")
|
||||
logFile.append("|Test|Status|Comment|\n|----|------|-------|\n")
|
||||
def ktFiles = project.file(groupDirectory).listFiles(new FileFilter() {
|
||||
@Override
|
||||
boolean accept(File pathname) {
|
||||
@@ -262,8 +263,8 @@ class RunExternalTestGroup extends RunKonanTest {
|
||||
skipped++
|
||||
}
|
||||
println("TEST $status\n")
|
||||
logFile.append("\n|$it.name|$status|$comment|")
|
||||
logFile.append("|$it.name|$status|$comment|\n")
|
||||
}
|
||||
print("TOTAL PASSED: $passed/$current (SKIPPED: $skipped)")
|
||||
println("TOTAL PASSED: $passed/$current (SKIPPED: $skipped)")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user