blob: d0e0613db6f0119add0bfc9137852aa21812ce25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
import java.util.regex.Pattern
def MAX_TEST_FAILURES_DISPLAY = 5
def testFailedPattern = Pattern.compile("FAILING TESTS")
def errorSectionPattern = Pattern.compile("ERROR: Section: (.*) FAILED.*")
def testPattern = Pattern.compile(".*debuggable-(.*)")
def makeErrorPattern = ".*" + Pattern.quote("make: *** [") + "(.*)" + Pattern.quote("]") + ".*"
def failedCommandPattern = "ERROR: Failed command: (.*)"
def currentLineIsFailedTest = false
def testsFailed = false
def errorList = []
def testFailedList = []
manager.build.logFile.eachLine { line ->
if (currentLineIsFailedTest) {
matcher = testPattern.matcher(line)
if (matcher?.matches()) {
testFailedList << matcher.group(1)
} else {
currentLineIsFailedTest = false
}
}
matcher = errorSectionPattern.matcher(line)
if (matcher?.matches()) {
errorList << matcher.group(1)
}
matcher = testFailedPattern.matcher(line)
if (matcher?.matches()) {
currentLineIsFailedTest = true
testsFailed = true
}
}
if (manager.logContains(".*Unable to determine architecture.*")) {
manager.addWarningBadge("Unable to determine architecture bug was triggered.")
}
errorList.each {
manager.addShortText(it, "white", "red", "1px", "grey")
}
if (testFailedList.size() <= MAX_TEST_FAILURES_DISPLAY) {
testFailedList.each {
manager.addShortText(it)
}
} else {
manager.addShortText("More than " + MAX_TEST_FAILURES_DISPLAY + " test failures")
}
if (!testsFailed) {
def matcher = manager.getLogMatcher(makeErrorPattern)
if ( matcher?.matches()) {
manager.addShortText(matcher.group(1), "black", "silver", "1px", "grey")
}
matcher = manager.getLogMatcher(failedCommandPattern)
if (matcher?.matches()) {
manager.addShortText(matcher.group(1), "black", "orange", "1px", "red")
}
}
|