@@ -446,16 +446,15 @@ func runTest(cmd *Command, args []string) {
446
446
}
447
447
}
448
448
449
- // If we are benchmarking, force everything to
450
- // happen in serial. Could instead allow all the
451
- // builds to run before any benchmarks start,
452
- // but try this for now.
449
+ // Force benchmarks to run in serial.
453
450
if testBench {
454
- for i , a := range builds {
455
- if i > 0 {
456
- // Make build of test i depend on
457
- // completing the run of test i-1.
458
- a .deps = append (a .deps , runs [i - 1 ])
451
+ // The first run must wait for all builds.
452
+ // Later runs must wait for the previous run's print.
453
+ for i , run := range runs {
454
+ if i == 0 {
455
+ run .deps = append (run .deps , builds ... )
456
+ } else {
457
+ run .deps = append (run .deps , prints [i - 1 ])
459
458
}
460
459
}
461
460
}
@@ -516,8 +515,8 @@ func contains(x []string, s string) bool {
516
515
func (b * builder ) test (p * Package ) (buildAction , runAction , printAction * action , err error ) {
517
516
if len (p .TestGoFiles )+ len (p .XTestGoFiles ) == 0 {
518
517
build := & action {p : p }
519
- run := & action {p : p }
520
- print := & action {f : (* builder ).notest , p : p , deps : []* action {build }}
518
+ run := & action {p : p , deps : [] * action { build } }
519
+ print := & action {f : (* builder ).notest , p : p , deps : []* action {run }}
521
520
return build , run , print , nil
522
521
}
523
522
0 commit comments