aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-05 04:40:39 -0500
committerFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-05 04:40:39 -0500
commit2ccad1c9bc42093fb341faed26ea41c1463fcfae (patch)
treed331b7997797b10a2f5b3199e608452ff616b51b
parentd186e730a73b5b3009edbaab7617617d35dc2cff (diff)
downloadplanr-2ccad1c9bc42093fb341faed26ea41c1463fcfae.tar.xz
planr-2ccad1c9bc42093fb341faed26ea41c1463fcfae.zip
Concurrent Eval Loop
-rw-r--r--runner.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/runner.go b/runner.go
index 2d66dc6..9c1e385 100644
--- a/runner.go
+++ b/runner.go
@@ -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())