Commit 90f91928 authored by Russ Cox's avatar Russ Cox

cmd/go: run benchmarks in sequence

Fixes #5662.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13650043
parent 6706931a
...@@ -446,16 +446,15 @@ func runTest(cmd *Command, args []string) { ...@@ -446,16 +446,15 @@ func runTest(cmd *Command, args []string) {
} }
} }
// If we are benchmarking, force everything to // Force benchmarks to run in serial.
// happen in serial. Could instead allow all the
// builds to run before any benchmarks start,
// but try this for now.
if testBench { if testBench {
for i, a := range builds { // The first run must wait for all builds.
if i > 0 { // Later runs must wait for the previous run's print.
// Make build of test i depend on for i, run := range runs {
// completing the run of test i-1. if i == 0 {
a.deps = append(a.deps, runs[i-1]) run.deps = append(run.deps, builds...)
} else {
run.deps = append(run.deps, prints[i-1])
} }
} }
} }
...@@ -516,8 +515,8 @@ func contains(x []string, s string) bool { ...@@ -516,8 +515,8 @@ func contains(x []string, s string) bool {
func (b *builder) test(p *Package) (buildAction, runAction, printAction *action, err error) { func (b *builder) test(p *Package) (buildAction, runAction, printAction *action, err error) {
if len(p.TestGoFiles)+len(p.XTestGoFiles) == 0 { if len(p.TestGoFiles)+len(p.XTestGoFiles) == 0 {
build := &action{p: p} build := &action{p: p}
run := &action{p: p} run := &action{p: p, deps: []*action{build}}
print := &action{f: (*builder).notest, p: p, deps: []*action{build}} print := &action{f: (*builder).notest, p: p, deps: []*action{run}}
return build, run, print, nil return build, run, print, nil
} }
......
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