fix(build): ensure tests work.
This commit is contained in:
parent
b88b8b8c26
commit
cf7ce9603e
7 changed files with 17 additions and 7 deletions
|
|
@ -9,11 +9,18 @@ import (
|
|||
"os/exec"
|
||||
"testing"
|
||||
|
||||
"github.com/arduino/go-paths-helper"
|
||||
"github.com/roddhjav/apparmor.d/pkg/prebuild/builder"
|
||||
"github.com/roddhjav/apparmor.d/pkg/prebuild/cfg"
|
||||
"github.com/roddhjav/apparmor.d/pkg/prebuild/prepare"
|
||||
)
|
||||
|
||||
func setTestBuildDirectories(name string) {
|
||||
testRoot := paths.New("/tmp/tests")
|
||||
cfg.Root = testRoot.Join(name)
|
||||
cfg.RootApparmord = cfg.Root.Join("apparmor.d")
|
||||
}
|
||||
|
||||
func chdirGitRoot() {
|
||||
cmd := exec.Command("git", "rev-parse", "--show-toplevel")
|
||||
out, err := cmd.Output()
|
||||
|
|
@ -71,6 +78,7 @@ func Test_PreBuild(t *testing.T) {
|
|||
chdirGitRoot()
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
setTestBuildDirectories(tt.name)
|
||||
cfg.Distribution = tt.dist
|
||||
if tt.full {
|
||||
prepare.Register("fsp")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue