aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2015-09-01 22:25:33 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-09-01 22:25:33 +0000
commit067107bda7550b77476f5492e4605ff9cf57af33 (patch)
tree758f02d6f8213571c2e1ba4f9751b4d1a4b3a512
parent408fece1100183672eb340a3f5b97174e916e28a (diff)
parent69f53eb622e0f41d0e91debd71d6694148b52a30 (diff)
downloadtools-067107bda7550b77476f5492e4605ff9cf57af33.tar.gz
cmd/stress: add "-ignore regexp" flag
automerge: 69f53eb * commit '69f53eb622e0f41d0e91debd71d6694148b52a30': cmd/stress: add "-ignore regexp" flag
-rw-r--r--cmd/stress/stress.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd/stress/stress.go b/cmd/stress/stress.go
index 9aebbf6..f02fa2a 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{}