Regres: Post coverage results even if the test lists have not changed.
Do this by breaking up the monolithic `runDaily()` function, and combining errors from the new `postDailyResults()` and `postCoverageResults()` functions.
Bug: b/152192800
Change-Id: I031b37fa32d6d05ae1c38dff27a180c809aa4fe1
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43649
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/tests/regres/cause/cause.go b/tests/regres/cause/cause.go
index ac06f43..485e28c 100644
--- a/tests/regres/cause/cause.go
+++ b/tests/regres/cause/cause.go
@@ -17,6 +17,7 @@
import (
"fmt"
+ "strings"
)
// Wrap returns a new error wrapping cause with the additional message.
@@ -24,3 +25,15 @@
s := fmt.Sprintf(msg, args...)
return fmt.Errorf("%v. Cause: %w", s, cause)
}
+
+// Merge merges all the errors into a single newline delimited error.
+func Merge(errs ...error) error {
+ if len(errs) == 0 {
+ return nil
+ }
+ strs := make([]string, len(errs))
+ for i, err := range errs {
+ strs[i] = err.Error()
+ }
+ return fmt.Errorf("%v", strings.Join(strs, "\n"))
+}
diff --git a/tests/regres/cmd/regres/main.go b/tests/regres/cmd/regres/main.go
index 219addd..bfead7c 100644
--- a/tests/regres/cmd/regres/main.go
+++ b/tests/regres/cmd/regres/main.go
@@ -632,24 +632,47 @@
dailyHash = git.ParseHash(r.dailyChange)
}
+ test, testLists, results, err := r.runDailyTest(dailyHash, reactorBackend, genCov)
+ if err != nil {
+ return err
+ }
+
+ errs := []error{}
+
+ if err := r.postDailyResults(client, test, testLists, results, reactorBackend, dailyHash); err != nil {
+ errs = append(errs, err)
+ }
+
+ if genCov {
+ if err := r.postCoverageResults(results.Coverage, dailyHash); err != nil {
+ errs = append(errs, err)
+ }
+ }
+
+ return cause.Merge(errs...)
+}
+
+// runDailyTest performs the full deqp run on the HEAD change, returning the
+// results.
+func (r *regres) runDailyTest(dailyHash git.Hash, reactorBackend reactorBackend, genCov bool) (*test, testlist.Lists, *deqp.Results, error) {
// Get the full test results.
test := r.newTest(dailyHash).setReactorBackend(reactorBackend)
defer test.cleanup()
// Always need to checkout the change.
if err := test.checkout(); err != nil {
- return cause.Wrap(err, "Failed to checkout '%s'", dailyHash)
+ return nil, nil, nil, cause.Wrap(err, "Failed to checkout '%s'", dailyHash)
}
d, err := r.getOrBuildDEQP(test)
if err != nil {
- return cause.Wrap(err, "Failed to build deqp for '%s'", dailyHash)
+ return nil, nil, nil, cause.Wrap(err, "Failed to build deqp for '%s'", dailyHash)
}
// Load the test lists.
testLists, err := test.loadTestLists(fullTestListRelPath)
if err != nil {
- return cause.Wrap(err, "Failed to load full test lists for '%s'", dailyHash)
+ return nil, nil, nil, cause.Wrap(err, "Failed to load full test lists for '%s'", dailyHash)
}
if genCov {
@@ -663,15 +686,30 @@
// Build the change.
if err := test.build(); err != nil {
- return cause.Wrap(err, "Failed to build '%s'", dailyHash)
+ return nil, nil, nil, cause.Wrap(err, "Failed to build '%s'", dailyHash)
}
// Run the tests on the change.
results, err := test.run(testLists, d)
if err != nil {
- return cause.Wrap(err, "Failed to test '%s'", dailyHash)
+ return nil, nil, nil, cause.Wrap(err, "Failed to test '%s'", dailyHash)
}
+ return test, testLists, results, nil
+}
+
+// postDailyResults posts the results of the daily full deqp run to gerrit as
+// a new change, or reusing an old, unsubmitted change.
+// This change contains the updated test lists, along with a summary of the
+// test results.
+func (r *regres) postDailyResults(
+ client *gerrit.Client,
+ test *test,
+ testLists testlist.Lists,
+ results *deqp.Results,
+ reactorBackend reactorBackend,
+ dailyHash git.Hash) error {
+
// Write out the test list status files.
filePaths, err := test.writeTestListsByStatus(testLists, results)
if err != nil {
@@ -738,16 +776,10 @@
return err
}
- if genCov {
- if err := r.commitCoverage(results.Coverage, dailyHash); err != nil {
- return err
- }
- }
-
return nil
}
-func (r *regres) commitCoverage(cov *cov.Tree, revision git.Hash) error {
+func (r *regres) postCoverageResults(cov *cov.Tree, revision git.Hash) error {
log.Printf("Committing coverage for %v\n", revision.String())
url := coverageURL