Skip to content
Snippets Groups Projects
Commit f41140ef authored by Jonas Karlsson's avatar Jonas Karlsson
Browse files

Print failure reasons

parent 24ae4541
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,23 @@ def extractLancelotURL(str) {
return url ? url.replace("http://lancelot.intra.qt.io", "https://testresults.qt.io/lancebot") : ""
}
def extractFailureReasons(jobLog) {
def output = ""
def failures = []
if (jobLog.lines().any { line -> line.contains("Mismatch.") }) {
failures.add("mismatch")
}
if (jobLog.lines().any { line -> line.contains("No baseline on server, so cannot compare.") }) {
failures.add("no baseline")
}
if (!failures.isEmpty()) {
output += "("
output += failures.join(", ")
output += ")"
}
return output
}
pipeline {
agent {
node {
......@@ -178,24 +195,25 @@ pipeline {
def jobResult = jobBuild.getResult()
def jobLog = jobBuild.rawBuild.getLog(10000).join('\n')
def url = extractLancelotURL(jobLog)
def didTestRun = jobLog.lines().findAll { it.contains("Finished testing of") }.size() > 0
def didTestRun = jobLog.lines().any { line -> line.contains("Finished testing of") }
def failureReasons = extractFailureReasons(jobLog)
def resultMsg = ""
if (jobLog.contains("LanceBotFinishedOK")) {
resultMsg = "✅ Test OK (${jobId}): ${url}"
resultMsg = " ✅ ${jobId}: (OK)\n ${url}"
} else if (!didTestRun) {
resultMsg = " ❌ Test FAIL (${jobId}): Could not run"
resultMsg = " ❌ ${jobId}: (FAIL) Could not run"
} else if (url) {
resultMsg = " ❌ Test FAIL (${jobId}): ${url}"
resultMsg = " ❌ ${jobId}: (FAIL) $failureReasons\n ${url}"
} else if (jobLog == "") {
resultMsg = " ❌ Test FAIL (${jobId}): Could not get log"
resultMsg = " ❌ ${jobId}: (FAIL) Could not get log"
} else if (jobLog.contains("Lancelot test FAILED")) {
resultMsg = " ❌ Test FAIL (${jobId}): Lancelot test failed"
resultMsg = " ❌ ${jobId}: (FAIL) Lancelot test failed"
} else if (jobLog.contains("ninja: build stopped")) {
resultMsg = " ❌ Test FAIL (${jobId}): Build failed"
resultMsg = " ❌ ${jobId}: (FAIL) Build failed"
} else if (!jobLog.contains("LanceBotFinishedOK")) {
resultMsg = " ❌ Test FAIL (${jobId}): Lancelot error"
resultMsg = " ❌ ${jobId}: (FAIL) Lancelot error"
} else {
resultMsg = " ❌ Test FAIL (${jobId}): Unknown error"
resultMsg = " ❌ ${jobId}: (FAIL) Unknown error"
}
allResults += resultMsg + "\n"
publishReport = publishReport || !url.isEmpty();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment