cmd/stress: print number of failed runs

Currently at the end of a long stress run you may not know from the
end of the output whether there were any failures. Add a failure count
to the periodic status message to make this obvious.

Change-Id: I5ad19b9e6f462369fb32be6efbfb6f21568e98e4
Reviewed-on: https://go-review.googlesource.com/10187
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
This commit is contained in:
Austin Clements 2015-05-18 10:59:35 -04:00
parent 7d75e8b219
commit 45716cd4c6
1 changed files with 3 additions and 2 deletions

View File

@ -82,7 +82,7 @@ func main() {
}
}()
}
runs := 0
runs, fails := 0, 0
ticker := time.NewTicker(5 * time.Second).C
for {
select {
@ -91,6 +91,7 @@ func main() {
if len(out) == 0 {
continue
}
fails++
f, err := ioutil.TempFile("", "go-stress")
if err != nil {
fmt.Printf("failed to create temp file: %v\n", err)
@ -103,7 +104,7 @@ func main() {
}
fmt.Printf("\n%s\n%s\n", f.Name(), out)
case <-ticker:
fmt.Printf("%v runs so far\n", runs)
fmt.Printf("%v runs so far, %v failures\n", runs, fails)
}
}
}