diff --git a/cmd/stress/stress.go b/cmd/stress/stress.go index 9aebbf6d..f02fa2a7 100644 --- a/cmd/stress/stress.go +++ b/cmd/stress/stress.go @@ -29,6 +29,7 @@ var ( flagTimeout = flag.Duration("timeout", 10*time.Minute, "timeout each process after `duration`") flagKill = flag.Bool("kill", true, "kill timed out processes if true, otherwise just print pid (to attach with gdb)") flagFailure = flag.String("failure", "", "fail only if output matches `regexp`") + flagIgnore = flag.String("ignore", "", "ignore failure if output matches `regexp`") ) func main() { @@ -37,7 +38,7 @@ func main() { flag.Usage() os.Exit(1) } - var failureRe *regexp.Regexp + var failureRe, ignoreRe *regexp.Regexp if *flagFailure != "" { var err error if failureRe, err = regexp.Compile(*flagFailure); err != nil { @@ -45,6 +46,13 @@ func main() { os.Exit(1) } } + if *flagIgnore != "" { + var err error + if ignoreRe, err = regexp.Compile(*flagIgnore); err != nil { + fmt.Println("bad ignore regexp:", err) + os.Exit(1) + } + } res := make(chan []byte) for i := 0; i < *flagP; i++ { go func() { @@ -73,7 +81,7 @@ func main() { } out, err := cmd.CombinedOutput() close(done) - if err != nil && (failureRe == nil || failureRe.Match(out)) { + if err != nil && (failureRe == nil || failureRe.Match(out)) && (ignoreRe == nil || !ignoreRe.Match(out)) { out = append(out, fmt.Sprintf("\n\nERROR: %v\n", err)...) } else { out = []byte{}