mirror of https://github.com/apache/lucene.git
LUCENE-9077: Emit the location of test output on failure.
This commit is contained in:
parent
fee8ba6e42
commit
087b2e1c0d
|
@ -33,6 +33,10 @@ allprojects {
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
ext {
|
||||||
|
testOutputsDir = file("${reports.junitXml.destination}/outputs")
|
||||||
|
}
|
||||||
|
|
||||||
if (verboseMode) {
|
if (verboseMode) {
|
||||||
maxParallelForks = 1
|
maxParallelForks = 1
|
||||||
} else {
|
} else {
|
||||||
|
@ -86,7 +90,6 @@ allprojects {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up custom test output handler.
|
// Set up custom test output handler.
|
||||||
def testOutputsDir = file("${reports.junitXml.destination}/outputs")
|
|
||||||
doFirst {
|
doFirst {
|
||||||
project.delete testOutputsDir
|
project.delete testOutputsDir
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import org.apache.lucene.gradle.ErrorReportingTestListener
|
||||||
|
|
||||||
// Display all failed tests at the end of the build.
|
// Display all failed tests at the end of the build.
|
||||||
|
|
||||||
def failedTests = []
|
def failedTests = []
|
||||||
|
@ -9,6 +11,7 @@ allprojects {
|
||||||
failedTests << [
|
failedTests << [
|
||||||
"name": "${desc.className}.${desc.name}",
|
"name": "${desc.className}.${desc.name}",
|
||||||
"project": "${test.project.path}",
|
"project": "${test.project.path}",
|
||||||
|
"output": file("${task.testOutputsDir}/${ErrorReportingTestListener.getOutputLogName(desc.parent)}"),
|
||||||
"reproduce": "gradlew ${project.path}:test --tests \"${desc.className}\" ${task.project.testOptionsForReproduceLine}"
|
"reproduce": "gradlew ${project.path}:test --tests \"${desc.className}\" ${task.project.testOptionsForReproduceLine}"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -19,6 +22,7 @@ allprojects {
|
||||||
failedTests << [
|
failedTests << [
|
||||||
"name": "${desc.name}",
|
"name": "${desc.name}",
|
||||||
"project": "${test.project.path}",
|
"project": "${test.project.path}",
|
||||||
|
"output": file("${task.testOutputsDir}/${ErrorReportingTestListener.getOutputLogName(desc)}"),
|
||||||
"reproduce": "gradlew ${project.path}:test --tests \"${desc.name}\" ${task.project.testOptionsForReproduceLine}"
|
"reproduce": "gradlew ${project.path}:test --tests \"${desc.name}\" ${task.project.testOptionsForReproduceLine}"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -30,7 +34,9 @@ gradle.buildFinished { result ->
|
||||||
if (failedTests) {
|
if (failedTests) {
|
||||||
def formatted = failedTests
|
def formatted = failedTests
|
||||||
.sort { a, b -> b.project.compareTo(a.project) }
|
.sort { a, b -> b.project.compareTo(a.project) }
|
||||||
.collect { e -> String.format(Locale.ROOT, " - %s (%s)\n Minimum reproduce line: %s\n", e.name, e.project, e.reproduce) }
|
.collect { e -> String.format(Locale.ROOT,
|
||||||
|
" - %s (%s)\n Test output: %s\n Reproduce with: %s\n",
|
||||||
|
e.name, e.project, e.output, e.reproduce) }
|
||||||
.join("\n")
|
.join("\n")
|
||||||
|
|
||||||
logger.error("\nERROR: The following test(s) have failed:\n${formatted}")
|
logger.error("\nERROR: The following test(s) have failed:\n${formatted}")
|
||||||
|
|
Loading…
Reference in New Issue