diff options
author | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2021-09-06 14:36:18 -0500 |
---|---|---|
committer | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2021-09-06 14:36:18 -0500 |
commit | 989412cd49c4d922d2a6fdcebb1c51fbc91bc066 (patch) | |
tree | ddcf528afbfb5f0720884b223674913ea6ce15d1 /adapters/bash | |
parent | 5a5c9d98ea15ac15a86901808ac4b966fec5e012 (diff) | |
parent | 7343fd274c37246ba449550cf29f638351794ba4 (diff) | |
download | deb-planr-989412cd49c4d922d2a6fdcebb1c51fbc91bc066.tar.xz deb-planr-989412cd49c4d922d2a6fdcebb1c51fbc91bc066.zip |
Merge branch 'upstream' into ppa
Update v0.1.2
Diffstat (limited to 'adapters/bash')
-rw-r--r-- | adapters/bash/adapter.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/adapters/bash/adapter.go b/adapters/bash/adapter.go index 65a6c80..8c7713c 100644 --- a/adapters/bash/adapter.go +++ b/adapters/bash/adapter.go @@ -15,7 +15,8 @@ import ( ) type Adapter struct { - dirs planr.DirConfig + dirs planr.DirConfig + buildDir string } func (a *Adapter) Config() planr.AdapterConfig { @@ -36,13 +37,14 @@ func safeWd() string{ return wd } -func (a *Adapter) Init(dirs planr.DirConfig) { - a.dirs = dirs +func (a *Adapter) Init(ctx planr.PipelineContext) { + a.dirs = ctx.Dirs + a.buildDir = ctx.AdapterDir } func (adapter Adapter) Build(tcs []planr.TestCase) { } -func executeScriptedTest(testdir string, tc planr.TestCase) planr.TestResult { +func executeScriptedTest(builddir, testdir string, tc planr.TestCase) planr.TestResult { cfg := tc.AdapterConfig().(*Config) timeout := time.Duration(cfg.Timeout) * time.Millisecond @@ -57,6 +59,8 @@ func executeScriptedTest(testdir string, tc planr.TestCase) planr.TestResult { result.Tc = tc cmd := exec.CommandContext(ctx, "bash", path) + + cmd.Dir = builddir if out, err := cmd.CombinedOutput(); err != nil { result.Status = planr.RUNTIME_FAILURE @@ -87,7 +91,7 @@ func (adapter Adapter) Evaluate(tcs []planr.TestCase) [] planr.TestResult { c := make(chan planr.TestResult, 0) for i := range tcs { go func(i int) { - c <- executeScriptedTest(adapter.dirs.Tests(), tcs[i]) + c <- executeScriptedTest(adapter.buildDir, adapter.dirs.Tests(), tcs[i]) }(i) } |