Regres: Reduce scope of regres CI emails
Limit CI results to the owner when things are good.
Limit CI results to owner + reviewers when things are not so good.
Should reduce email spam.
Change-Id: I1b71f17f306bf04ecb9fb87ffd95aea42a8e84b4
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39308
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
diff --git a/tests/regres/main.go b/tests/regres/main.go
index 7b48059..359550f 100644
--- a/tests/regres/main.go
+++ b/tests/regres/main.go
@@ -263,7 +263,7 @@
log.Printf("Testing change '%s'\n", change.id)
// Test the latest patchset in the change, diff against parent change.
- msg, err := r.test(change)
+ msg, alert, err := r.test(change)
if err != nil {
log.Println(cause.Wrap(err, "Failed to test changelist '%s'", change.latest))
time.Sleep(time.Minute)
@@ -280,9 +280,14 @@
log.Printf("DRY RUN: add review to change '%v':\n%v\n", change.id, msg)
} else {
log.Printf("Posting review to '%s'\n", change.id)
+ notify := "OWNER"
+ if alert {
+ notify = "OWNER_REVIEWERS"
+ }
_, _, err = client.Changes.SetReview(change.id, change.latest.String(), &gerrit.ReviewInput{
Message: msg,
Tag: "autogenerated:regress",
+ Notify: notify,
})
if err != nil {
return cause.Wrap(err, "Failed to post comments on change '%s'", change.id)
@@ -292,35 +297,35 @@
}
}
-func (r *regres) test(change *changeInfo) (string, error) {
+func (r *regres) test(change *changeInfo) (string, bool, error) {
latest := r.newTest(change.latest)
defer latest.cleanup()
if err := latest.checkout(); err != nil {
- return "", cause.Wrap(err, "Failed to checkout '%s'", change.latest)
+ return "", true, cause.Wrap(err, "Failed to checkout '%s'", change.latest)
}
deqpBuild, err := r.getOrBuildDEQP(latest)
if err != nil {
- return "", cause.Wrap(err, "Failed to build dEQP '%v' for change", change.id)
+ return "", true, cause.Wrap(err, "Failed to build dEQP '%v' for change", change.id)
}
log.Printf("Testing latest patchset for change '%s'\n", change.id)
latestResults, testlists, err := r.testLatest(change, latest, deqpBuild)
if err != nil {
- return "", cause.Wrap(err, "Failed to test latest change of '%v'", change.id)
+ return "", true, cause.Wrap(err, "Failed to test latest change of '%v'", change.id)
}
log.Printf("Testing parent of change '%s'\n", change.id)
parentResults, err := r.testParent(change, testlists, deqpBuild)
if err != nil {
- return "", cause.Wrap(err, "Failed to test parent change of '%v'", change.id)
+ return "", true, cause.Wrap(err, "Failed to test parent change of '%v'", change.id)
}
log.Println("Comparing latest patchset's results with parent")
- msg := compare(parentResults, latestResults)
+ msg, alert := compare(parentResults, latestResults)
- return msg, nil
+ return msg, alert, nil
}
type deqpBuild struct {
@@ -972,14 +977,15 @@
}
// compare returns a string describing all differences between two
-// deqprun.Results. This string is used as the report message posted to the
-// gerrit code review.
-func compare(old, new *deqp.Results) string {
+// deqprun.Results, and a boolean indicating that this there are differences
+// that are considered important.
+// This string is used as the report message posted to the gerrit code review.
+func compare(old, new *deqp.Results) (msg string, alert bool) {
if old.Error != "" {
- return old.Error
+ return old.Error, false
}
if new.Error != "" {
- return new.Error
+ return new.Error, true
}
oldStatusCounts, newStatusCounts := map[testlist.Status]int{}, map[testlist.Status]int{}
@@ -996,12 +1002,15 @@
switch {
case !old.Status.Failing() && new.Status.Failing():
broken = append(broken, test)
+ alert = true
case !old.Status.Passing() && new.Status.Passing():
fixed = append(fixed, test)
case old.Status != new.Status:
changed = append(changed, test)
+ alert = true
case old.Status.Failing() && new.Status.Failing():
failing = append(failing, test) // Still broken
+ alert = true
}
totalTests++
if found {
@@ -1155,7 +1164,7 @@
}
}
- return sb.String()
+ return sb.String(), alert
}
// loadTestLists loads the full test lists from the json file.