diff options
author | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-05 04:40:39 -0500 |
---|---|---|
committer | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-05 04:40:39 -0500 |
commit | 2ccad1c9bc42093fb341faed26ea41c1463fcfae (patch) | |
tree | d331b7997797b10a2f5b3199e608452ff616b51b | |
parent | d186e730a73b5b3009edbaab7617617d35dc2cff (diff) | |
download | deb-planr-2ccad1c9bc42093fb341faed26ea41c1463fcfae.tar.xz deb-planr-2ccad1c9bc42093fb341faed26ea41c1463fcfae.zip |
Concurrent Eval Loop
-rw-r--r-- | runner.go | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -111,15 +111,22 @@ func (r Runner) Build(tcs []TestCase) { func (r Runner) Evaluate(tcs []TestCase) []TestResult { testSets := r.groupByAdapter(tcs) results := make([]TestResult, 0) - + + c := make(chan []TestResult) for _, pair := range testSets { - adapter := pair.adapter - cases := pair.tcs + go func (pair adapterTestSet) { + adapter := pair.adapter + cases := pair.tcs - r.setupEnv(adapter) - resultSet := adapter.Evaluate(cases) + r.setupEnv(adapter) + resultSet := adapter.Evaluate(cases) + + c <- resultSet + }(pair) + } - results = append(results, resultSet...) + for range testSets { + results = append(results, (<-c)...) } safeCd(r.dirs.Config()) |