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')
|
cli_bc project(path: ':backend.native', configuration: 'cli_bc')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def logFileName = "test-result.md"
|
||||||
|
|
||||||
task regenerate_external_tests() {
|
task regenerate_external_tests() {
|
||||||
doLast {
|
doLast {
|
||||||
def externalTestsProject = childProjects["external"]
|
def externalTestsProject = childProjects["external"]
|
||||||
def gradleGenerated = externalTestsProject.file("build.gradle")
|
def gradleGenerated = externalTestsProject.file("build.gradle")
|
||||||
def externalTestsDir = externalTestsProject.file("codegen/blackbox")
|
def externalTestsDir = externalTestsProject.file("codegen/blackbox")
|
||||||
gradleGenerated.write("import org.jetbrains.kotlin.*\n\n")
|
gradleGenerated.write("import org.jetbrains.kotlin.*\n")
|
||||||
gradleGenerated.append(
|
gradleGenerated.append(
|
||||||
"configurations {\n" +
|
"""
|
||||||
" cli_bc\n" +
|
configurations {
|
||||||
"}\n" +
|
cli_bc
|
||||||
"\n" +
|
}
|
||||||
"dependencies {\n" +
|
|
||||||
" cli_bc project(path: ':backend.native', configuration: 'cli_bc')\n" +
|
|
||||||
"}\n\n")
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
cli_bc project(path: ':backend.native', configuration: 'cli_bc')
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
gradleGenerated.append(
|
||||||
|
"""
|
||||||
|
task createLogFile() {
|
||||||
|
doLast {
|
||||||
|
project.file("$logFileName").write("")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
)
|
||||||
externalTestsDir.eachDirRecurse {
|
externalTestsDir.eachDirRecurse {
|
||||||
// Skip build directory and directories without *.kt files.
|
// Skip build directory and directories without *.kt files.
|
||||||
if (it.name == "build" || it.listFiles().count {it.name.endsWith(".kt")} == 0) {
|
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 taskDirectory = externalTestsProject.relativePath(it)
|
||||||
def taskName = taskDirectory.replaceAll("/-", '_')
|
def taskName = taskDirectory.replaceAll("[-/]", '_')
|
||||||
|
|
||||||
gradleGenerated.append(
|
gradleGenerated.append(
|
||||||
"task $taskName (type: RunExternalTestGroup) {\n" +
|
"task $taskName (type: RunExternalTestGroup) {\n" +
|
||||||
" groupDirectory = \"$taskDirectory\"\n" +
|
" dependsOn(createLogFile)\n" +
|
||||||
" logFileName = \"$taskDirectory/test-result.md\"\n" +
|
" groupDirectory = \"$taskDirectory\"\n" +
|
||||||
|
" logFileName = \"$logFileName\"\n" +
|
||||||
"}\n\n")
|
"}\n\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
task run() {
|
task run() {
|
||||||
dependsOn(tasks.withType(KonanTest).matching { it.enabled })
|
dependsOn(tasks.withType(KonanTest).matching { it.enabled })
|
||||||
}
|
}
|
||||||
@@ -55,6 +68,22 @@ task run_external () {
|
|||||||
project.subprojects {
|
project.subprojects {
|
||||||
dependsOn(it.tasks.withType(RunExternalTestGroup).matching { it.enabled })
|
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) {
|
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
|
@Override
|
||||||
void executeTest() {
|
void executeTest() {
|
||||||
def logFile = project.file(logFileName)
|
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() {
|
def ktFiles = project.file(groupDirectory).listFiles(new FileFilter() {
|
||||||
@Override
|
@Override
|
||||||
boolean accept(File pathname) {
|
boolean accept(File pathname) {
|
||||||
@@ -262,8 +263,8 @@ class RunExternalTestGroup extends RunKonanTest {
|
|||||||
skipped++
|
skipped++
|
||||||
}
|
}
|
||||||
println("TEST $status\n")
|
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