Commit 098cdda2 by Ben Clayton

Regres: Don't nuke the daily test dir before using the test results

`runDailyTest()` calls `test.cleanup()` before returning, removing the entire checkout directory, along with coverage data, and the git repo. This breaks both `postDailyResults()` and `postCoverageResults()`. Instead use a callback to handle the daily results. This way we can keep the `defer` to clean up even in case of error. Change-Id: I9730d7dd8ac9c3a19d82d07a68325afdf38bfd40 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/44748Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 6ce626b4
...@@ -632,47 +632,45 @@ func (r *regres) runDaily(client *gerrit.Client, reactorBackend reactorBackend, ...@@ -632,47 +632,45 @@ func (r *regres) runDaily(client *gerrit.Client, reactorBackend reactorBackend,
dailyHash = git.ParseHash(r.dailyChange) dailyHash = git.ParseHash(r.dailyChange)
} }
test, testLists, results, err := r.runDailyTest(dailyHash, reactorBackend, genCov) return r.runDailyTest(dailyHash, reactorBackend, genCov,
if err != nil { func(test *test, testLists testlist.Lists, results *deqp.Results) error {
return err errs := []error{}
}
errs := []error{} if err := r.postDailyResults(client, test, testLists, results, reactorBackend, dailyHash); err != nil {
errs = append(errs, err)
if err := r.postDailyResults(client, test, testLists, results, reactorBackend, dailyHash); err != nil { }
errs = append(errs, err)
}
if genCov { if genCov {
if err := r.postCoverageResults(results.Coverage, dailyHash); err != nil { if err := r.postCoverageResults(results.Coverage, dailyHash); err != nil {
errs = append(errs, err) errs = append(errs, err)
} }
} }
return cause.Merge(errs...) return cause.Merge(errs...)
})
} }
// runDailyTest performs the full deqp run on the HEAD change, returning the // runDailyTest performs the full deqp run on the HEAD change, calling
// results. // withResults with the test results.
func (r *regres) runDailyTest(dailyHash git.Hash, reactorBackend reactorBackend, genCov bool) (*test, testlist.Lists, *deqp.Results, error) { func (r *regres) runDailyTest(dailyHash git.Hash, reactorBackend reactorBackend, genCov bool, withResults func(*test, testlist.Lists, *deqp.Results) error) error {
// Get the full test results. // Get the full test results.
test := r.newTest(dailyHash).setReactorBackend(reactorBackend) test := r.newTest(dailyHash).setReactorBackend(reactorBackend)
defer test.cleanup() defer test.cleanup()
// Always need to checkout the change. // Always need to checkout the change.
if err := test.checkout(); err != nil { if err := test.checkout(); err != nil {
return nil, nil, nil, cause.Wrap(err, "Failed to checkout '%s'", dailyHash) return cause.Wrap(err, "Failed to checkout '%s'", dailyHash)
} }
d, err := r.getOrBuildDEQP(test) d, err := r.getOrBuildDEQP(test)
if err != nil { if err != nil {
return nil, nil, nil, cause.Wrap(err, "Failed to build deqp for '%s'", dailyHash) return cause.Wrap(err, "Failed to build deqp for '%s'", dailyHash)
} }
// Load the test lists. // Load the test lists.
testLists, err := test.loadTestLists(fullTestListRelPath) testLists, err := test.loadTestLists(fullTestListRelPath)
if err != nil { if err != nil {
return nil, nil, nil, cause.Wrap(err, "Failed to load full test lists for '%s'", dailyHash) return cause.Wrap(err, "Failed to load full test lists for '%s'", dailyHash)
} }
if genCov { if genCov {
...@@ -686,16 +684,16 @@ func (r *regres) runDailyTest(dailyHash git.Hash, reactorBackend reactorBackend, ...@@ -686,16 +684,16 @@ func (r *regres) runDailyTest(dailyHash git.Hash, reactorBackend reactorBackend,
// Build the change. // Build the change.
if err := test.build(); err != nil { if err := test.build(); err != nil {
return nil, nil, nil, cause.Wrap(err, "Failed to build '%s'", dailyHash) return cause.Wrap(err, "Failed to build '%s'", dailyHash)
} }
// Run the tests on the change. // Run the tests on the change.
results, err := test.run(testLists, d) results, err := test.run(testLists, d)
if err != nil { if err != nil {
return nil, nil, nil, cause.Wrap(err, "Failed to test '%s'", dailyHash) return cause.Wrap(err, "Failed to test '%s'", dailyHash)
} }
return test, testLists, results, nil return withResults(test, testLists, results)
} }
// postDailyResults posts the results of the daily full deqp run to gerrit as // postDailyResults posts the results of the daily full deqp run to gerrit as
......
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