@@ -248,6 +248,7 @@ func (r *regres) run() error {
248
248
if err != nil {
249
249
log .Println (cause .Wrap (err , "Failed to test changelist '%s'" , change .latest ))
250
250
time .Sleep (time .Minute )
251
+ change .pending = false
251
252
continue
252
253
}
253
254
@@ -336,14 +337,8 @@ func (r *regres) testLatest(change *changeInfo) (*CommitTestResults, testlist.Li
336
337
return results , testlists , nil // Use cached results
337
338
}
338
339
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 )
347
342
348
343
// Cache the results for future tests
349
344
if err := results .save (cachePath ); err != nil {
@@ -369,16 +364,8 @@ func (r *regres) testParent(change *changeInfo, testlists testlist.Lists) (*Comm
369
364
return nil , cause .Wrap (err , "Failed to checkout '%s'" , change .parent )
370
365
}
371
366
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 )
382
369
383
370
// Store the results of the parent change to the cache.
384
371
if err := results .save (cachePath ); err != nil {
@@ -624,6 +611,27 @@ func (t *test) checkout() error {
624
611
return nil
625
612
}
626
613
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
+
627
635
// build builds the SwiftShader source into t.buildDir.
628
636
func (t * test ) build () error {
629
637
log .Printf ("Building '%s'\n " , t .commit )
@@ -704,7 +712,6 @@ func (t *test) run(testLists testlist.Lists) (*CommitTestResults, error) {
704
712
705
713
out := CommitTestResults {
706
714
Version : dataVersion ,
707
- Built : true ,
708
715
Tests : map [string ]TestResult {},
709
716
}
710
717
@@ -776,7 +783,7 @@ func (t *test) resultsCachePath(testLists testlist.Lists) string {
776
783
// results.
777
784
type CommitTestResults struct {
778
785
Version int
779
- Built bool
786
+ Error string
780
787
Tests map [string ]TestResult
781
788
Duration time.Duration
782
789
}
@@ -820,13 +827,11 @@ func (r *CommitTestResults) save(path string) error {
820
827
// CommitTestResults. This string is used as the report message posted to the
821
828
// gerrit code review.
822
829
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
830
835
}
831
836
832
837
oldStatusCounts , newStatusCounts := map [testlist.Status ]int {}, map [testlist.Status ]int {}
0 commit comments