Maven: integration test should remove escape sequences from build log

This commit is contained in:
Sergey Mashkov
2015-07-30 13:18:26 +03:00
parent 196cecfe70
commit 8353b4d3e8
2 changed files with 8 additions and 6 deletions
@@ -102,10 +102,6 @@
<goal>install</goal> <goal>install</goal>
<goal>run</goal> <goal>run</goal>
</goals> </goals>
<configuration>
<postBuildHookScript>verify</postBuildHookScript>
</configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
@@ -15,14 +15,20 @@ def removePaths(String path, File basedir) {
} }
def pattern = Pattern.compile(/\[INFO\] --- ([^:]+):.*:\S+ \([^)]+\) @ test-project ---/) def pattern = Pattern.compile(/\[INFO\] --- ([^:]+):.*:\S+ \([^)]+\) @ test-project ---/)
State state = new File(basedir, "build.log").readLines().inject(new State()) { acc, line -> State state = new File(basedir, "build.log").readLines().collect { it.replaceAll("\\u001b[^m]*m", "") }.inject(new State()) { acc, line ->
def m = pattern.matcher(line) def m = pattern.matcher(line)
if (m.find()) { if (m.find()) {
acc.currentPlugin = m.group(1) acc.currentPlugin = m.group(1)
} else if (line.startsWith("[INFO] Downloaded:") || line.startsWith("[INFO] Downloading:") || line.startsWith("Downloaded:") || line.startsWith("Downloading:")) { } else if (line.startsWith("[INFO] Downloaded:") || line.startsWith("[INFO] Downloading:") || line.startsWith("Downloaded:") || line.startsWith("Downloading:")) {
// ignore line // ignore line
} else if (acc.currentPlugin == "kotlin-maven-plugin") { } else if (acc.currentPlugin == "kotlin-maven-plugin") {
def filtered = removePaths(line, basedir).replace("\\", "/").replaceAll(/[0-9]+\s*ms/, "LLL ms").trim().replaceAll(/^\[[A-Z]+\]$/, "").replaceAll(/version [0-9\.]+/, "version @snapshot@") def filtered = removePaths(line, basedir).
replace("\\", "/").
replaceAll(/[0-9]+\s*ms/, "LLL ms").
trim().
replaceAll(/^\[[A-Z]+\]$/, "").
replaceAll(/version [0-9\.]+/, "version @snapshot@")
if (filtered != "") { if (filtered != "") {
acc.lines << filtered acc.lines << filtered
} }