@@ -6,6 +6,7 @@ TOOLS_MOD_DIR := ./internal/tools
6
6
TOOLS = $(CURDIR ) /.tools
7
7
8
8
ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' ! -path './LICENSES/* ' -exec dirname {} \; | sort)
9
+ ALL_GO_MODS := $(shell find . -type f -name 'go.mod' ! -path '$(TOOLS_MOD_DIR ) /* ' ! -path './LICENSES/* ' | sort)
9
10
10
11
# Build the list of include directories to compile the bpf program
11
12
BPF_INCLUDE += -I${REPODIR}/internal/include/libbpf
@@ -19,7 +20,7 @@ CGO_ENABLED=0
19
20
.DEFAULT_GOAL := precommit
20
21
21
22
.PHONY : precommit
22
- precommit : license-header-check dependabot-generate go-mod-tidy golangci-lint-fix codespell
23
+ precommit : license-header-check dependabot-generate golangci-lint-fix test codespell
23
24
24
25
# Tools
25
26
$(TOOLS ) :
@@ -49,22 +50,14 @@ $(TOOLS)/offsetgen: PACKAGE=go.opentelemetry.io/auto/$(TOOLS_MOD_DIR)/inspect/cm
49
50
.PHONY : tools
50
51
tools : $(GOLICENSES ) $(MULTIMOD ) $(GOLANGCI_LINT ) $(DBOTCONF ) $(OFFSETGEN )
51
52
52
- ALL_GO_MODS := $(shell find . -type f -name 'go.mod' ! -path '$(TOOLS_MOD_DIR ) /* ' ! -path './LICENSES/* ' | sort)
53
- GO_MODS_TO_TEST := $(ALL_GO_MODS:%=test/% )
54
- GO_MODS_TO_EBPF_TEST := $(ALL_GO_MODS:%=test_ebpf/% )
55
-
56
- .PHONY : test
57
- test : generate $(GO_MODS_TO_TEST )
58
- test/% : GO_MOD=$*
59
- test/% :
60
- cd $(shell dirname $(GO_MOD ) ) && $(GOCMD ) test -v ./...
61
-
62
- # These tests need to be run as privileged user/with sudo
63
- .PHONY : test_ebpf
64
- test_ebpf : generate $(GO_MODS_TO_EBPF_TEST )
65
- test_ebpf/% : GO_MOD=$*
66
- test_ebpf/% :
67
- cd $(shell dirname $(GO_MOD ) ) && $(GOCMD ) test -v -tags=ebpf_test -run ^TestEBPF ./...
53
+ TEST_TARGETS := test-verbose test-ebpf
54
+ .PHONY : $(TEST_TARGETS ) test
55
+ test-ebpf : ARGS = -tags=ebpf_test -run ^TestEBPF # These need to be run with sudo.
56
+ test-verbose : ARGS = -v
57
+ $(TEST_TARGETS ) : test
58
+ test : generate $(ALL_GO_MODS:%=test/% )
59
+ test/% /go.mod :
60
+ @cd $* && $(GOCMD ) test $(ARGS ) ./...
68
61
69
62
.PHONY : generate
70
63
generate : export CFLAGS := $(BPF_INCLUDE )
0 commit comments