aboutsummaryrefslogtreecommitdiff
path: root/runner.go
diff options
context:
space:
mode:
Diffstat (limited to 'runner.go')
-rw-r--r--runner.go32
1 files changed, 23 insertions, 9 deletions
diff --git a/runner.go b/runner.go
index f2eb8e9..0a6243c 100644
--- a/runner.go
+++ b/runner.go
@@ -8,7 +8,7 @@ import (
type Runner struct {
adapters []Adapter
- DirConfig
+ dirs DirConfig
}
func (r *Runner) RegisterAdapter(a Adapter) {
@@ -47,7 +47,7 @@ func (r Runner) checkConfig(tcs []TestCase) {
func (r Runner) setupEnv(adapter Adapter) {
nm := adapter.Config().Name
- wd := path.Join(r.BuildDir(), nm)
+ wd := path.Join(r.dirs.Build(), nm)
if !directoryExists(wd) {
if err := os.Mkdir(wd, 0755); err != nil {
@@ -70,18 +70,26 @@ func (r Runner) build(tcs []TestCase) {
adapter.Build(tcTab[nm])
}
- safeCd(r.ConfigDir())
+ safeCd(r.dirs.Config())
+}
+
+func (r Runner) init_adapters() {
+ for _, adapter := range r.adapters {
+ adapter.Init(r.dirs)
+ }
}
func (r Runner) units() []TestCase {
- return collectUnits(r.RubricDir(), r.adapterCfgs())
+ return collectUnits(r.dirs.Rubric(), r.adapterCfgs())
}
func (r Runner) Build() {
- units := r.units()
+ r.init_adapters()
- if !directoryExists(r.BuildDir()) {
- r.MkBuildDir()
+ units := r.units()
+
+ if !directoryExists(r.dirs.Build()) {
+ r.dirs.MkBuild()
}
r.build(units)
@@ -97,10 +105,12 @@ func (r Runner) evaluate(tcs []TestCase) {
adapter.Evaluate(tcTab[nm])
}
- safeCd(r.ConfigDir())
+ safeCd(r.dirs.Config())
}
func (r Runner) Evaluate() []TestCase {
+ r.init_adapters()
+
units := r.units()
r.evaluate(units)
@@ -109,5 +119,9 @@ func (r Runner) Evaluate() []TestCase {
}
func (r Runner) Clean() {
- r.CleanBuildDir()
+ r.dirs.CleanBuild()
+}
+
+func (r * Runner) SetConfigDirFromTree(childPath string) {
+ r.dirs.SetConfigFromTree(childPath)
}