mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-27 19:35:32 +00:00
runtime: Move mock hook source
src/runtime/virtcontainers/hook/mock contains a simple example hook in Go. The only thing this is used for is for some tests in src/runtime/pkg/katautils/hook_test.go. It doesn't really have anything to do with the rest of the virtcontainers package. So, move it next to the test code that uses it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
86723b51ae
commit
c77e34de33
@ -592,7 +592,7 @@ generate-config: $(CONFIGS)
|
||||
test: hook go-test
|
||||
|
||||
hook:
|
||||
make -C virtcontainers hook
|
||||
make -C pkg/katautils/mockhook
|
||||
|
||||
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 = "../../virtcontainers/hook/mock/hook"
|
||||
var testBinHookPath = "mockhook/hook"
|
||||
var testBundlePath = "/test/bundle"
|
||||
|
||||
func getMockHookBinPath() string {
|
||||
|
1
src/runtime/pkg/katautils/mockhook/.gitignore
vendored
Normal file
1
src/runtime/pkg/katautils/mockhook/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
hook
|
21
src/runtime/pkg/katautils/mockhook/Makefile
Normal file
21
src/runtime/pkg/katautils/mockhook/Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
# Copyright Red Hat.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
BIN = hook
|
||||
SRC = hook.go
|
||||
|
||||
V = @
|
||||
Q = $(V:1=)
|
||||
QUIET_BUILD = $(Q:@=@echo ' BUILD '$@;)
|
||||
|
||||
BUILDFLAGS =
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
$(BIN): $(SRC)
|
||||
$(QUIET_BUILD)go build $(BUILDFLAGS) -o $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(BIN)
|
@ -5,8 +5,6 @@
|
||||
#
|
||||
|
||||
PREFIX := /usr
|
||||
HOOK_DIR := hook/mock
|
||||
HOOK_BIN := hook
|
||||
MK_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
GOBUILD_FLAGS := -mod=vendor
|
||||
|
||||
@ -22,16 +20,11 @@ QUIET_GOBUILD = $(Q:@=@echo ' GOBUILD '$@;)
|
||||
# Build
|
||||
#
|
||||
|
||||
all: build binaries
|
||||
all: build
|
||||
|
||||
build:
|
||||
$(QUIET_GOBUILD)go build $(GOBUILD_FLAGS) $(go list ./... | grep -v /vendor/)
|
||||
|
||||
hook:
|
||||
$(QUIET_GOBUILD)go build $(GOBUILD_FLAGS) -o $(HOOK_DIR)/$@ $(HOOK_DIR)/*.go
|
||||
|
||||
binaries: hook
|
||||
|
||||
#
|
||||
# Tests
|
||||
#
|
||||
@ -54,7 +47,7 @@ define FILE_SAFE_TO_REMOVE =
|
||||
$(shell test -e "$(1)" && test "$(1)" != "/" && echo "$(1)")
|
||||
endef
|
||||
|
||||
CLEAN_FILES += $(HOOK_DIR)/$(HOOK_BIN)
|
||||
CLEAN_FILES +=
|
||||
|
||||
clean:
|
||||
rm -f $(foreach f,$(CLEAN_FILES),$(call FILE_SAFE_TO_REMOVE,$(f)))
|
||||
@ -62,8 +55,6 @@ clean:
|
||||
.PHONY: \
|
||||
all \
|
||||
build \
|
||||
hook \
|
||||
binaries \
|
||||
check \
|
||||
check-go-static \
|
||||
check-go-test \
|
||||
|
Loading…
Reference in New Issue
Block a user