summaryrefslogtreecommitdiff
path: root/runner.go
diff options
context:
space:
mode:
Diffstat (limited to 'runner.go')
-rw-r--r--runner.go29
1 files changed, 17 insertions, 12 deletions
diff --git a/runner.go b/runner.go
index 15f08ae..b543cc0 100644
--- a/runner.go
+++ b/runner.go
@@ -29,17 +29,19 @@ func (r Runner) checkConfig(tcs []TestCase) {
}
}
-func (r Runner) setupEnv(adapter Adapter) {
- nm := adapter.Config().Name
- wd := path.Join(r.dirs.Build(), nm)
+func adapterBuildDir(dirs DirConfig, adapter Adapter) string {
+ return path.Join(dirs.Build(), adapter.Config().Name)
+}
+
+func (r Runner) createAdapterBuildDir(adapter Adapter) {
+ build := adapterBuildDir(r.dirs, adapter)
- if !directoryExists(wd) {
- if err := os.Mkdir(wd, 0755); err != nil {
- log.Fatalf("Could not create adapter config %s %v\n", wd, err)
+ if !directoryExists(build) {
+ if err := os.Mkdir(build, 0755); err != nil {
+ log.Fatalf("Could not create adapter config %s %v\n", build, err)
}
}
- safeCd(wd)
}
type adapterTestSet struct {
@@ -101,12 +103,10 @@ func (r Runner) Build(tcs []TestCase) {
adapter := pair.adapter
cases := pair.tcs
- r.setupEnv(adapter)
+ r.createAdapterBuildDir(adapter)
adapter.Build(cases)
}
-
- safeCd(r.dirs.Config())
}
func (r Runner) Evaluate(tcs []TestCase) []TestResult {
@@ -119,7 +119,6 @@ func (r Runner) Evaluate(tcs []TestCase) []TestResult {
adapter := pair.adapter
cases := pair.tcs
- r.setupEnv(adapter)
resultSet := adapter.Evaluate(cases)
c <- resultSet
@@ -155,9 +154,15 @@ func (r Runner) SrcDir() string {
func NewRunner(adapters map[string]Adapter, dirs DirConfig) Runner {
r := Runner{adapters, dirs}
+
for _, adapter := range r.adapters {
- adapter.Init(dirs)
+ ctx := PipelineContext {
+ Dirs: dirs,
+ AdapterDir: adapterBuildDir(dirs, adapter),
+ }
+
+ adapter.Init(ctx)
}
return r