Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 665ee57

Browse files
committed
Regres: Don't attempt to build failing changes forever.
If a test failed to build, an error was logged to stdout, but the error was not posted to the change. This meant the change would be picked up by regres again, and the process would repeat ad-infinitum. Posting of the build error used to work, but was broken by bfaf4e825b. Change-Id: I1e59f0d2e5ee26eb002aa2c596dc5491e48a9c87 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27169 Tested-by: Ben Clayton <[email protected]> Reviewed-by: Nicolas Capens <[email protected]>
1 parent 24cb99d commit 665ee57

File tree

1 file changed

+32
-27
lines changed

1 file changed

+32
-27
lines changed

tests/regres/main.go

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ func (r *regres) run() error {
248248
if err != nil {
249249
log.Println(cause.Wrap(err, "Failed to test changelist '%s'", change.latest))
250250
time.Sleep(time.Minute)
251+
change.pending = false
251252
continue
252253
}
253254

@@ -336,14 +337,8 @@ func (r *regres) testLatest(change *changeInfo) (*CommitTestResults, testlist.Li
336337
return results, testlists, nil // Use cached results
337338
}
338339

339-
if err := test.build(); err != nil {
340-
return nil, nil, cause.Wrap(err, "Failed to build '%s'", change.latest)
341-
}
342-
343-
results, err := test.run(testlists)
344-
if err != nil {
345-
return nil, nil, cause.Wrap(err, "Failed to test '%s'", change.latest)
346-
}
340+
// Build the change and test it.
341+
results := test.buildAndRun(testlists)
347342

348343
// Cache the results for future tests
349344
if err := results.save(cachePath); err != nil {
@@ -369,16 +364,8 @@ func (r *regres) testParent(change *changeInfo, testlists testlist.Lists) (*Comm
369364
return nil, cause.Wrap(err, "Failed to checkout '%s'", change.parent)
370365
}
371366

372-
// Build the parent change.
373-
if err := test.build(); err != nil {
374-
return nil, cause.Wrap(err, "Failed to build '%s'", change.parent)
375-
}
376-
377-
// Run the tests on the parent change.
378-
results, err := test.run(testlists)
379-
if err != nil {
380-
return nil, cause.Wrap(err, "Failed to test '%s'", change.parent)
381-
}
367+
// Build the parent change and test it.
368+
results := test.buildAndRun(testlists)
382369

383370
// Store the results of the parent change to the cache.
384371
if err := results.save(cachePath); err != nil {
@@ -624,6 +611,27 @@ func (t *test) checkout() error {
624611
return nil
625612
}
626613

614+
// buildAndRun calls t.build() followed by t.run(). Errors are logged and
615+
// reported in the returned CommitTestResults.Error field.
616+
func (t *test) buildAndRun(testLists testlist.Lists) *CommitTestResults {
617+
// Build the parent change.
618+
if err := t.build(); err != nil {
619+
msg := fmt.Sprintf("Failed to build '%s'", t.commit)
620+
log.Println(cause.Wrap(err, msg))
621+
return &CommitTestResults{Error: msg}
622+
}
623+
624+
// Run the tests on the parent change.
625+
results, err := t.run(testLists)
626+
if err != nil {
627+
msg := fmt.Sprintf("Failed to test change '%s'", t.commit)
628+
log.Println(cause.Wrap(err, msg))
629+
return &CommitTestResults{Error: msg}
630+
}
631+
632+
return results
633+
}
634+
627635
// build builds the SwiftShader source into t.buildDir.
628636
func (t *test) build() error {
629637
log.Printf("Building '%s'\n", t.commit)
@@ -704,7 +712,6 @@ func (t *test) run(testLists testlist.Lists) (*CommitTestResults, error) {
704712

705713
out := CommitTestResults{
706714
Version: dataVersion,
707-
Built: true,
708715
Tests: map[string]TestResult{},
709716
}
710717

@@ -776,7 +783,7 @@ func (t *test) resultsCachePath(testLists testlist.Lists) string {
776783
// results.
777784
type CommitTestResults struct {
778785
Version int
779-
Built bool
786+
Error string
780787
Tests map[string]TestResult
781788
Duration time.Duration
782789
}
@@ -820,13 +827,11 @@ func (r *CommitTestResults) save(path string) error {
820827
// CommitTestResults. This string is used as the report message posted to the
821828
// gerrit code review.
822829
func compare(old, new *CommitTestResults) string {
823-
switch {
824-
case !old.Built && !new.Built:
825-
return "Build continues to be broken."
826-
case old.Built && !new.Built:
827-
return "Build broken."
828-
case !old.Built && !new.Built:
829-
return "Build now fixed. Cannot compare against broken parent."
830+
if old.Error != "" {
831+
return old.Error
832+
}
833+
if new.Error != "" {
834+
return new.Error
830835
}
831836

832837
oldStatusCounts, newStatusCounts := map[testlist.Status]int{}, map[testlist.Status]int{}

0 commit comments

Comments
 (0)