-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (41 loc) · 1.5 KB
/
Copy pathMakefile
File metadata and controls
47 lines (41 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
GO ?= go
GO_BUILDTAGS ?=
# On Windows the test binary must have the .exe extension to be executable.
ifeq ($(OS),Windows_NT)
TEST_BINARY = _output/shimtest.exe
else
TEST_BINARY = _output/shimtest.test
endif
TESTBIN_OUT = testdata/testbin
# Target arch for testbin. Always linux; defaults to amd64.
TESTBIN_GOARCH ?= amd64
.PHONY: build testbin clean help
build: testbin
$(GO) test -c $(if $(GO_BUILDTAGS),-tags "$(strip $(GO_BUILDTAGS))",) -o $(TEST_BINARY) .
testbin:
@mkdir -p testdata
CGO_ENABLED=0 GOOS=linux GOARCH=$(TESTBIN_GOARCH) \
$(GO) build -ldflags='-s -w' -o $(TESTBIN_OUT) ./cmd/testbin
clean:
rm -f $(TEST_BINARY) $(TESTBIN_OUT) _output/testbin-*
help:
@echo "Usage: make build"
@echo ""
@echo "Targets:"
@echo " build Build the test binary (includes testbin)"
@echo " testbin Build the testbin container binary only"
@echo " clean Remove build artifacts"
@echo ""
@echo "Cross-compilation (always linux):"
@echo " make testbin TESTBIN_GOARCH=arm64"
@echo ""
@echo "Running tests:"
@echo " $(TEST_BINARY) -test.v -test.timeout=120s -shimtest.config=<config.json>"
@echo ""
@echo "Running benchmarks:"
@echo " $(TEST_BINARY) -test.run=^$$ -test.bench=. -test.timeout=300s -shimtest.config=<config.json>"
@echo ""
@echo "Examples:"
@echo " make build"
@echo " $(TEST_BINARY) -test.v -test.timeout=120s -shimtest.config=profiles/myconfig.json"
@echo " $(TEST_BINARY) -test.run=^$$ -test.bench=BenchmarkShim -test.count=3 -test.timeout=300s -shimtest.config=profiles/myconfig.json"