aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-05 01:29:24 -0500
committerFlu0r1ne <flur01ne@flu0r1ne.net>2021-09-05 01:29:24 -0500
commite120a9f5955551fcf314543c8889e58277aefb20 (patch)
treea027a396cfe727d33a5727ff1ba66b795fc6037f
parent4cc29e50d59daf445f4152d10f9f41cb1828f702 (diff)
downloadplanr-e120a9f5955551fcf314543c8889e58277aefb20.tar.xz
planr-e120a9f5955551fcf314543c8889e58277aefb20.zip
Add concurrency to evaluate
-rw-r--r--adapters/gtest/adapter.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/adapters/gtest/adapter.go b/adapters/gtest/adapter.go
index ec11748..2961f29 100644
--- a/adapters/gtest/adapter.go
+++ b/adapters/gtest/adapter.go
@@ -59,17 +59,24 @@ func (adapter *Adapter) Evaluate(tcs []planr.TestCase) [] planr.TestResult {
exes := createExecutables(tcs)
+ c := make(chan []planr.TestResult, len(exes))
for i := range exes {
- succeed, buildFailures := exes[i].compile(buildDir)
+ go func(exe *executable) {
+ succeed, buildFailures := exe.compile(buildDir)
- if ! succeed {
- results = append(results, buildFailures...)
- continue
- }
+ if ! succeed {
+ c <- buildFailures
+ return
+ }
- runtimeResults := exes[i].execute(buildDir)
+ runtimeResults := exe.execute(buildDir)
- results = append(results, runtimeResults...)
+ c <- runtimeResults
+ }(&exes[i])
+ }
+
+ for range exes {
+ results = append(results, (<-c)...)
}
return results