mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
virtcontainers: Run mock hook from build tree rather than system bin dir
Running unit tests should generally have minimal dependencies on things outside the build tree. It *definitely* shouldn't modify system wide things outside the build tree. Currently the runtime "make test" target does so, though. Several of the tests in src/runtime/pkg/katautils/hook_test.go require a sample hook binary. They expect this hook in /usr/bin/virtcontainers/bin/test/hook, so the makefile, as root, installs the test binary to that location. Go tests automatically run within the package's directory though, so there's no need to use a system wide path. We can use a relative path to the binary build within the tree just as easily. fixes #3941 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
e65db838ff
commit
0e83c95fac
@ -589,12 +589,10 @@ $(GENERATED_FILES): %: %.in $(MAKEFILE_LIST) VERSION .git-commit
|
||||
|
||||
generate-config: $(CONFIGS)
|
||||
|
||||
test: install-hook go-test
|
||||
test: hook go-test
|
||||
|
||||
install-hook:
|
||||
hook:
|
||||
make -C virtcontainers hook
|
||||
echo "installing mock hook"
|
||||
sudo -E make -C virtcontainers install
|
||||
|
||||
go-test: $(GENERATED_FILES)
|
||||
go clean -testcache
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
var testKeyHook = "test-key"
|
||||
var testContainerIDHook = "test-container-id"
|
||||
var testControllerIDHook = "test-controller-id"
|
||||
var testBinHookPath = "/usr/bin/virtcontainers/bin/test/hook"
|
||||
var testBinHookPath = "../../virtcontainers/hook/mock/hook"
|
||||
var testBundlePath = "/test/bundle"
|
||||
|
||||
func getMockHookBinPath() string {
|
||||
|
Loading…
Reference in New Issue
Block a user