return ran, ok
}
m := newMatcher(deps.MatchString, *match, "-test.run", *skip)
- tctx := newTestContext(*parallel, m)
- tctx.deadline = deadline
var mFuzz *matcher
if *matchFuzz != "" {
mFuzz = newMatcher(deps.MatchString, *matchFuzz, "-test.fuzz", *skip)
}
- fctx := &fuzzContext{deps: deps, mode: seedCorpusOnly}
- root := common{w: os.Stdout} // gather output in one place
- if Verbose() {
- root.chatty = newChattyPrinter(root.w)
- }
- for _, ft := range fuzzTests {
- if shouldFailFast() {
- break
- }
- testName, matched, _ := tctx.match.fullName(nil, ft.Name)
- if !matched {
- continue
- }
- if mFuzz != nil {
- if _, fuzzMatched, _ := mFuzz.fullName(nil, ft.Name); fuzzMatched {
- // If this will be fuzzed, then don't run the seed corpus
- // right now. That will happen later.
- continue
+
+ for _, procs := range cpuList {
+ runtime.GOMAXPROCS(procs)
+ for i := uint(0); i < *count; i++ {
+ if shouldFailFast() {
+ break
+ }
+
+ tctx := newTestContext(*parallel, m)
+ tctx.deadline = deadline
+ fctx := &fuzzContext{deps: deps, mode: seedCorpusOnly}
+ root := common{w: os.Stdout} // gather output in one place
+ if Verbose() {
+ root.chatty = newChattyPrinter(root.w)
+ }
+ for _, ft := range fuzzTests {
+ if shouldFailFast() {
+ break
+ }
+ testName, matched, _ := tctx.match.fullName(nil, ft.Name)
+ if !matched {
+ continue
+ }
+ if mFuzz != nil {
+ if _, fuzzMatched, _ := mFuzz.fullName(nil, ft.Name); fuzzMatched {
+ // If this will be fuzzed, then don't run the seed corpus
+ // right now. That will happen later.
+ continue
+ }
+ }
+ f := &F{
+ common: common{
+ signal: make(chan bool),
+ barrier: make(chan bool),
+ name: testName,
+ parent: &root,
+ level: root.level + 1,
+ chatty: root.chatty,
+ },
+ testContext: tctx,
+ fuzzContext: fctx,
+ }
+ f.w = indenter{&f.common}
+ if f.chatty != nil {
+ f.chatty.Updatef(f.name, "=== RUN %s\n", f.name)
+ }
+ go fRunner(f, ft.Fn)
+ <-f.signal
+ if f.chatty != nil && f.chatty.json {
+ f.chatty.Updatef(f.parent.name, "=== NAME %s\n", f.parent.name)
+ }
+ ok = ok && !f.Failed()
+ ran = ran || f.ran
+ }
+ if !ran {
+ // There were no tests to run on this iteration.
+ // This won't change, so no reason to keep trying.
+ break
}
- }
- f := &F{
- common: common{
- signal: make(chan bool),
- barrier: make(chan bool),
- name: testName,
- parent: &root,
- level: root.level + 1,
- chatty: root.chatty,
- },
- testContext: tctx,
- fuzzContext: fctx,
- }
- f.w = indenter{&f.common}
- if f.chatty != nil {
- f.chatty.Updatef(f.name, "=== RUN %s\n", f.name)
- }
- go fRunner(f, ft.Fn)
- <-f.signal
- if f.chatty != nil && f.chatty.json {
- f.chatty.Updatef(f.parent.name, "=== NAME %s\n", f.parent.name)
}
}
- return root.ran, !root.Failed()
+
+ return ran, ok
}
// runFuzzing runs the fuzz test matching the pattern for -fuzz. Only one such