Skip to content

Commit 7a0ba32

Browse files
committed
Makefile: T9099: stop catch-all rule from eating forwarded test arguments
Test targets forward extra CLI arguments to their scripts via $(filter-out $@,$(MAKECMDGOALS)) (e.g. make test -- --match interfaces_bond) Those extra words are also goals as far as make is concerned, so after the test recipe succeeded, make went on to "build" --match and interfaces_bond too, falling through to the generic `%:` flavor rule and running build-vyos-image --match which errored and masked the fact that the smoketest itself had already passed. Declare the trailing goals as phony no-ops when the primary target is one of the test targets, so they no longer reach the `%:` rule. The existing MATCH=<value> form is unaffected.
1 parent 802f45d commit 7a0ba32

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ build_dir := build
44
ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
55
ISO_PATH := $(build_dir)/live-image-$(ARCH).hybrid.iso
66

7+
# Test targets forward extra CLI arguments (e.g. `make test -- --match foo`)
8+
# to their scripts via $(MAKECMDGOALS). Those extra words are also goals as
9+
# far as make is concerned, so without this they'd fall through to the `%:`
10+
# flavor rule below and run build-vyos-image with garbage arguments.
11+
TEST_TARGETS := test test-no-interfaces test-no-interfaces-no-vpp test-interfaces test-vpp testc testcvpp testraid testsb testtpm test-ci-qcow2 test-image-update qemu-live
12+
ifneq ($(filter $(TEST_TARGETS),$(firstword $(MAKECMDGOALS))),)
13+
$(eval $(filter-out $(firstword $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
14+
endif
15+
716
.PHONY: all
817
all:
918
@echo "Make what specifically?"

0 commit comments

Comments
 (0)