From 45716cd4c6ff17c3ef8a40254ab0708bbe35a4ef Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 18 May 2015 10:59:35 -0400 Subject: [PATCH] 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 Reviewed-by: Dmitry Vyukov --- cmd/stress/stress.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/stress/stress.go b/cmd/stress/stress.go index 5bf6a0d6..9aebbf6d 100644 --- a/cmd/stress/stress.go +++ b/cmd/stress/stress.go @@ -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) } } }