aboutsummaryrefslogtreecommitdiff
path: root/runner.go
diff options
context:
space:
mode:
authorFlu0r1ne <flur01ne@flu0r1ne.net>2021-08-22 23:27:53 -0500
committerFlu0r1ne <flur01ne@flu0r1ne.net>2021-08-22 23:27:53 -0500
commit24548e87decbdfea38bbf692cecad6d4eefc3ec0 (patch)
tree4f5d1432d1e22a1f19ceabbc92dcdd86bed98017 /runner.go
parent5d33040ab80b5cce7883b2e5965aa17db2e6515a (diff)
downloadplanr-24548e87decbdfea38bbf692cecad6d4eefc3ec0.tar.xz
planr-24548e87decbdfea38bbf692cecad6d4eefc3ec0.zip
Refactoring & Enhanced logging
Diffstat (limited to 'runner.go')
-rw-r--r--runner.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/runner.go b/runner.go
index 96bcd19..3bee17a 100644
--- a/runner.go
+++ b/runner.go
@@ -1,6 +1,9 @@
package planr
-import "fmt"
+import (
+ "log"
+ "os"
+)
type Runner struct {
adapters []Adapter
@@ -40,6 +43,14 @@ func (r Runner) checkConfig(tcs []TestCase) {
}
}
+func cdBuild(adapter Adapter) {
+ dir := adapter.Config().Dir()
+
+ if err := os.Chdir(dir); err != nil {
+ log.Fatal(err)
+ }
+}
+
func (r Runner) build(tcs []TestCase) {
r.checkConfig(tcs)
@@ -47,8 +58,8 @@ func (r Runner) build(tcs []TestCase) {
for _, adapter := range r.adapters {
nm := adapter.Config().Name
-
- fmt.Printf("[R] Building adapter \"%s\"\n", nm)
+ cdBuild(adapter)
+
adapter.Build(tcTab[nm])
}
}
@@ -67,11 +78,10 @@ func (r Runner) evaluate(tcs []TestCase) {
for _, adapter := range r.adapters {
nm := adapter.Config().Name
+ cdBuild(adapter)
- fmt.Printf("[R] Evaluating adapter \"%s\"\n", nm)
adapter.Evaluate(tcTab[nm])
}
-
}
func (r Runner) Evaluate(root string) []TestCase {