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:
parent
7d75e8b219
commit
45716cd4c6
|
@ -82,7 +82,7 @@ func main() {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
runs := 0
|
runs, fails := 0, 0
|
||||||
ticker := time.NewTicker(5 * time.Second).C
|
ticker := time.NewTicker(5 * time.Second).C
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
@ -91,6 +91,7 @@ func main() {
|
||||||
if len(out) == 0 {
|
if len(out) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
fails++
|
||||||
f, err := ioutil.TempFile("", "go-stress")
|
f, err := ioutil.TempFile("", "go-stress")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("failed to create temp file: %v\n", err)
|
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)
|
fmt.Printf("\n%s\n%s\n", f.Name(), out)
|
||||||
case <-ticker:
|
case <-ticker:
|
||||||
fmt.Printf("%v runs so far\n", runs)
|
fmt.Printf("%v runs so far, %v failures\n", runs, fails)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue