Commit 2a55a56a by Ben Clayton

Regres: Include an example test for each of top N failures

Bug: b/129056755 Change-Id: I01518b3cb802c45f2b3cc14e6e2c2f81416b4cd4 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27782Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent cf186618
......@@ -190,7 +190,7 @@ func (r *regres) run() error {
}
changes := map[string]*changeInfo{} // Change ID -> changeInfo
lastUpdatedTestLists := toDate(time.Now())
lastUpdatedTestLists := date{} // toDate(time.Now())
lastQueriedChanges := time.Time{}
for {
......@@ -483,18 +483,20 @@ func (r *regres) postMostCommonFailures(client *gerrit.Client, change *gerrit.Ch
if len(lines) == 1 {
line := lines[0]
if line != "" {
sb.WriteString(fmt.Sprintf(" %d occurrences: %v: %v\n", f.count, f.status, line))
sb.WriteString(fmt.Sprintf(" %d occurrences: %v: %v\n", f.count, f.status, line))
} else {
sb.WriteString(fmt.Sprintf(" %d occurrences: %v\n", f.count, f.status))
sb.WriteString(fmt.Sprintf(" %d occurrences: %v\n", f.count, f.status))
}
} else {
sb.WriteString(fmt.Sprintf(" %d occurrences: %v:\n", f.count, f.status))
sb.WriteString(fmt.Sprintf(" %d occurrences: %v:\n", f.count, f.status))
for _, l := range lines {
sb.WriteString(" > ")
sb.WriteString(l)
sb.WriteString("\n")
}
}
sb.WriteString(fmt.Sprintf(" Example test: %v\n", f.exampleTest))
}
msg := sb.String()
......@@ -907,20 +909,27 @@ type testStatusAndError struct {
type commonFailure struct {
count int
testStatusAndError
exampleTest string
}
func (r *CommitTestResults) commonFailures() []commonFailure {
failures := map[testStatusAndError]int{}
for _, test := range r.Tests {
examples := map[testStatusAndError]string{}
for name, test := range r.Tests {
if !test.Status.Failing() {
continue
}
key := testStatusAndError{test.Status, test.Err}
failures[key] = failures[key] + 1
if count, ok := failures[key]; ok {
failures[key] = count + 1
} else {
failures[key] = 1
examples[key] = name
}
}
out := make([]commonFailure, 0, len(failures))
for failure, count := range failures {
out = append(out, commonFailure{count, failure})
out = append(out, commonFailure{count, failure, examples[failure]})
}
sort.Slice(out, func(i, j int) bool { return out[i].count > out[j].count })
return out
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment