Fix up all_tests.go parallelism support.
A len(tests) should have been len(testCases), the code never added to the sync.WaitGroup, and feeding tests to the tests channel blocks on the tests completing, so with one worker the results didn't stream. (And if the results channel wasn't large enough, we'd deadlock.) Change-Id: Iee37507b9706b14cffddd9c1b55fc311ee9b666d Reviewed-on: https://boringssl-review.googlesource.com/7292 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
bf82aede67
commit
8b9e7802ac
@ -253,18 +253,19 @@ func main() {
|
|||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
tests := make(chan test, *numWorkers)
|
tests := make(chan test, *numWorkers)
|
||||||
results := make(chan result, len(testCases))
|
results := make(chan result, *numWorkers)
|
||||||
|
|
||||||
for i := 0; i < *numWorkers; i++ {
|
for i := 0; i < *numWorkers; i++ {
|
||||||
|
wg.Add(1)
|
||||||
go worker(tests, results, &wg)
|
go worker(tests, results, &wg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
tests <- test
|
tests <- test
|
||||||
}
|
}
|
||||||
close(tests)
|
close(tests)
|
||||||
|
|
||||||
go func() {
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
close(results)
|
close(results)
|
||||||
}()
|
}()
|
||||||
@ -296,7 +297,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(failed) > 0 {
|
if len(failed) > 0 {
|
||||||
fmt.Printf("\n%d of %d tests failed:\n", len(failed), len(tests))
|
fmt.Printf("\n%d of %d tests failed:\n", len(failed), len(testCases))
|
||||||
for _, test := range failed {
|
for _, test := range failed {
|
||||||
fmt.Printf("\t%s\n", strings.Join([]string(test), " "))
|
fmt.Printf("\t%s\n", strings.Join([]string(test), " "))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user