gtr, parser/gotest: Add support for build errors

This commit is contained in:
Joël Stemmer
2019-10-06 23:19:58 +01:00
parent b1b88456c1
commit ffc33941fa
3 changed files with 82 additions and 8 deletions

View File

@ -54,6 +54,13 @@ func (p *parser) parseLine(line string) {
p.coverage(matches[1], matches[2])
} else if matches := regexBenchmark.FindStringSubmatch(line); len(matches) == 7 {
p.benchmark(matches[1], matches[2], matches[3], matches[4], matches[5], matches[6])
} else if strings.HasPrefix(line, "# ") {
fields := strings.Fields(strings.TrimPrefix(line, "# "))
if len(fields) == 1 || len(fields) == 2 {
p.buildOutput(fields[0])
} else {
p.output(line)
}
} else {
p.output(line)
}
@ -125,6 +132,13 @@ func (p *parser) benchmark(name, iterations, nsPerOp, mbPerSec, bytesPerOp, allo
})
}
func (p *parser) buildOutput(packageName string) {
p.add(gtr.Event{
Type: "build_output",
Name: packageName,
})
}
func (p *parser) output(line string) {
p.add(gtr.Event{Type: "output", Data: line})
}