Sfoglia il codice sorgente

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>
kris/onging/CECPQ3_patch15
David Benjamin 8 anni fa
committed by Adam Langley
parent
commit
8b9e7802ac
1 ha cambiato i file con 8 aggiunte e 7 eliminazioni
  1. +8
    -7
      util/all_tests.go

+ 8
- 7
util/all_tests.go Vedi File

@@ -253,18 +253,19 @@ func main() {

var wg sync.WaitGroup
tests := make(chan test, *numWorkers)
results := make(chan result, len(testCases))
results := make(chan result, *numWorkers)

for i := 0; i < *numWorkers; i++ {
wg.Add(1)
go worker(tests, results, &wg)
}

for _, test := range testCases {
tests <- test
}
close(tests)

go func() {
for _, test := range testCases {
tests <- test
}
close(tests)

wg.Wait()
close(results)
}()
@@ -296,7 +297,7 @@ func main() {
}

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 {
fmt.Printf("\t%s\n", strings.Join([]string(test), " "))
}


Caricamento…
Annulla
Salva