@@ -31,13 +31,14 @@ import (
3131)
3232
3333var (
34- flagCount = flag .Int ("count" , 0 , "stop after `N` runs (default never stop)" )
35- flagFailure = flag .String ("failure" , "" , "fail only if output matches `regexp`" )
36- flagIgnore = flag .String ("ignore" , "" , "ignore failure if output matches `regexp`" )
37- flagKill = flag .Bool ("kill" , true , "kill timed out processes if true, otherwise just print pid (to attach with gdb)" )
38- flagOutput = flag .String ("o" , defaultPrefix (), "output failure logs to `path` plus a unique suffix" )
39- flagP = flag .Int ("p" , runtime .NumCPU (), "run `N` processes in parallel" )
40- flagTimeout = flag .Duration ("timeout" , 10 * time .Minute , "timeout each process after `duration`" )
34+ flagCount = flag .Int ("count" , 0 , "stop after `N` runs (default never stop)" )
35+ flagFailfast = flag .Bool ("failfast" , false , "exit on first failure and write failure output to stderr" )
36+ flagFailure = flag .String ("failure" , "" , "fail only if output matches `regexp`" )
37+ flagIgnore = flag .String ("ignore" , "" , "ignore failure if output matches `regexp`" )
38+ flagKill = flag .Bool ("kill" , true , "kill timed out processes if true, otherwise just print pid (to attach with gdb)" )
39+ flagOutput = flag .String ("o" , defaultPrefix (), "output failure logs to `path` plus a unique suffix" )
40+ flagP = flag .Int ("p" , runtime .NumCPU (), "run `N` processes in parallel" )
41+ flagTimeout = flag .Duration ("timeout" , 10 * time .Minute , "timeout each process after `duration`" )
4142)
4243
4344func init () {
@@ -158,6 +159,10 @@ func main() {
158159 runs ++
159160 if len (out ) > 0 {
160161 fails ++
162+ if * flagFailfast {
163+ os .Stderr .Write (out )
164+ os .Exit (1 )
165+ }
161166 dir , path := filepath .Split (* flagOutput )
162167 f , err := os .CreateTemp (dir , path )
163168 if err != nil {
0 commit comments