dashboard: always run bench binary with timeout

When the tree is particularly broken,
even the first invocation of bench binary that queries list
of benchmarks can hang.
Fixes golang/go#8844.

LGTM=bradfitz
R=adg, bradfitz
CC=golang-codereviews
https://golang.org/cl/162160043
This commit is contained in:
Dmitriy Vyukov 2014-10-24 21:05:24 +04:00
parent e419b2a606
commit a7be953466
1 changed files with 3 additions and 2 deletions

View File

@ -115,13 +115,14 @@ func (b *Builder) buildBenchmark(workpath string, update bool) (benchBin, log st
// based on the list of available benchmarks, already executed benchmarks // based on the list of available benchmarks, already executed benchmarks
// and -benchcpu list. // and -benchcpu list.
func chooseBenchmark(benchBin string, doneBenchs []string) (bench string, procs, affinity int, last bool) { func chooseBenchmark(benchBin string, doneBenchs []string) (bench string, procs, affinity int, last bool) {
out, err := exec.Command(benchBin).CombinedOutput() var out bytes.Buffer
err := run(exec.Command(benchBin), allOutput(&out))
if err != nil { if err != nil {
log.Printf("Failed to query benchmark list: %v\n%s", err, out) log.Printf("Failed to query benchmark list: %v\n%s", err, out)
last = true last = true
return return
} }
outStr := string(out) outStr := out.String()
nlIdx := strings.Index(outStr, "\n") nlIdx := strings.Index(outStr, "\n")
if nlIdx < 0 { if nlIdx < 0 {
log.Printf("Failed to parse benchmark list (no new line): %s", outStr) log.Printf("Failed to parse benchmark list (no new line): %s", outStr)