Add a -repeat-until-failure flag to runner.
When debugging a flaky test, it's useful to be able to run a given test over and over. Change-Id: I1a7b38792215550b242eb8238214d873d41becb6 Reviewed-on: https://boringssl-review.googlesource.com/12301 Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
parent
53210cb48e
commit
ba28dfc381
@ -62,6 +62,7 @@ var (
|
|||||||
looseErrors = flag.Bool("loose-errors", false, "If true, allow shims to report an untranslated error code.")
|
looseErrors = flag.Bool("loose-errors", false, "If true, allow shims to report an untranslated error code.")
|
||||||
shimConfigFile = flag.String("shim-config", "", "A config file to use to configure the tests for this shim.")
|
shimConfigFile = flag.String("shim-config", "", "A config file to use to configure the tests for this shim.")
|
||||||
includeDisabled = flag.Bool("include-disabled", false, "If true, also runs disabled tests.")
|
includeDisabled = flag.Bool("include-disabled", false, "If true, also runs disabled tests.")
|
||||||
|
repeatUntilFailure = flag.Bool("repeat-until-failure", false, "If true, the first selected test will be run repeatedly until failure.")
|
||||||
)
|
)
|
||||||
|
|
||||||
// ShimConfigurations is used with the “json” package and represents a shim
|
// ShimConfigurations is used with the “json” package and represents a shim
|
||||||
@ -9468,10 +9469,7 @@ func worker(statusChan chan statusMsg, c chan *testCase, shimPath string, wg *sy
|
|||||||
for test := range c {
|
for test := range c {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if *mallocTest < 0 {
|
if *mallocTest >= 0 {
|
||||||
statusChan <- statusMsg{test: test, started: true}
|
|
||||||
err = runTest(test, shimPath, -1)
|
|
||||||
} else {
|
|
||||||
for mallocNumToFail := int64(*mallocTest); ; mallocNumToFail++ {
|
for mallocNumToFail := int64(*mallocTest); ; mallocNumToFail++ {
|
||||||
statusChan <- statusMsg{test: test, started: true}
|
statusChan <- statusMsg{test: test, started: true}
|
||||||
if err = runTest(test, shimPath, mallocNumToFail); err != errMoreMallocs {
|
if err = runTest(test, shimPath, mallocNumToFail); err != errMoreMallocs {
|
||||||
@ -9481,6 +9479,14 @@ func worker(statusChan chan statusMsg, c chan *testCase, shimPath string, wg *sy
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if *repeatUntilFailure {
|
||||||
|
for err == nil {
|
||||||
|
statusChan <- statusMsg{test: test, started: true}
|
||||||
|
err = runTest(test, shimPath, -1)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
statusChan <- statusMsg{test: test, started: true}
|
||||||
|
err = runTest(test, shimPath, -1)
|
||||||
}
|
}
|
||||||
statusChan <- statusMsg{test: test, err: err}
|
statusChan <- statusMsg{test: test, err: err}
|
||||||
}
|
}
|
||||||
@ -9640,6 +9646,11 @@ func main() {
|
|||||||
if matched {
|
if matched {
|
||||||
foundTest = true
|
foundTest = true
|
||||||
testChan <- &testCases[i]
|
testChan <- &testCases[i]
|
||||||
|
|
||||||
|
// Only run one test if repeating until failure.
|
||||||
|
if *repeatUntilFailure {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user