diff options
author | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-08-22 23:27:53 -0500 |
---|---|---|
committer | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-08-22 23:27:53 -0500 |
commit | 24548e87decbdfea38bbf692cecad6d4eefc3ec0 (patch) | |
tree | 4f5d1432d1e22a1f19ceabbc92dcdd86bed98017 /runner.go | |
parent | 5d33040ab80b5cce7883b2e5965aa17db2e6515a (diff) | |
download | planr-24548e87decbdfea38bbf692cecad6d4eefc3ec0.tar.xz planr-24548e87decbdfea38bbf692cecad6d4eefc3ec0.zip |
Refactoring & Enhanced logging
Diffstat (limited to 'runner.go')
-rw-r--r-- | runner.go | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -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 { |