@@ -4,11 +4,22 @@ build_dir := build
44ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
55ISO_PATH := $(build_dir ) /live-image-$(ARCH ) .hybrid.iso
66
7+ # scripts/check-qemu-install requires --uefi on arm64/aarch64 hosts; on
8+ # amd64 it stays optional.
9+ UEFI_FLAG := $(if $(filter arm64 aarch64,$(ARCH ) ) ,--uefi,)
10+
11+ # Common vCPU count for QEMU test targets, capped at the host's available CPUs
12+ TEST_CPUS := $(shell printf '% s\n' "$$(nproc ) " 4 | sort -n | head -n1)
13+
14+ # Common memory size (GB) for QEMU test targets: 8GB if the host has at
15+ # least 10GB of RAM, otherwise 4GB
16+ TEST_MEM := $(shell awk '/MemTotal/{if ($$2/1024/1024 >= 10) print 8; else print 4}' /proc/meminfo)
17+
718# Test targets forward extra CLI arguments (e.g. `make test -- --match foo`)
819# to their scripts via $(MAKECMDGOALS). Those extra words are also goals as
920# far as make is concerned, so without this they'd fall through to the `%:`
1021# 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 testifname test-ci-qcow2 test-image-update qemu-live
22+ TEST_TARGETS := test test-no-interfaces test-no-interfaces-no-vpp test-interfaces test-vpp testc testcvpp testraid testsb testtpm testifname test-ci-qcow2 test-image-update qemu-live test-suite
1223ifneq ($(filter $(TEST_TARGETS ) ,$(firstword $(MAKECMDGOALS ) ) ) ,)
1324$(eval $(filter-out $(firstword $(MAKECMDGOALS ) ) ,$(MAKECMDGOALS ) ) :;@:)
1425endif
2435.PHONY : test
2536.ONESHELL :
2637test :
27- scripts/check-qemu-install --debug --match=" $( MATCH) " --smoketest --uefi --cpu 4 --memory 8 --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
38+ scripts/check-qemu-install --debug --match=" $( MATCH) " --smoketest --uefi --cpu $( TEST_CPUS ) --memory $( TEST_MEM ) --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
2839
2940.PHONY : test-no-interfaces
3041.ONESHELL :
3142test-no-interfaces :
32- scripts/check-qemu-install --debug --smoketest --uefi --no-interfaces --cpu 4 --memory 8 --huge-page-size 2M --huge-page-count 1800 --isolate-cpus 2-3 --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
43+ scripts/check-qemu-install --debug --smoketest --uefi --no-interfaces --cpu $( TEST_CPUS ) --memory $( TEST_MEM ) --huge-page-size 2M --huge-page-count 1800 --isolate-cpus 2-3 --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
3344
3445.PHONY : test-no-interfaces-no-vpp
3546.ONESHELL :
3647test-no-interfaces-no-vpp :
37- scripts/check-qemu-install --debug --smoketest --uefi --no-interfaces --no-vpp --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
48+ scripts/check-qemu-install --debug --smoketest --uefi --no-interfaces --no-vpp --cpu $( TEST_CPUS ) --memory $( TEST_MEM ) -- iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
3849
3950.PHONY : test-interfaces
4051.ONESHELL :
4152test-interfaces :
42- scripts/check-qemu-install --debug --match=" interfaces_" --smoketest --uefi --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
53+ scripts/check-qemu-install --debug --match=" interfaces_" --smoketest --uefi --cpu $( TEST_CPUS ) --memory $( TEST_MEM ) -- iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
4354
4455.PHONY : test-vpp
4556.ONESHELL :
4657test-vpp :
47- scripts/check-qemu-install --debug --match=" vpp" --smoketest --uefi --cpu 4 --memory 8 --huge-page-size 2M --huge-page-count 1800 --isolate-cpus 2-3 --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
58+ scripts/check-qemu-install --debug --match=" vpp" --smoketest --uefi --cpu $( TEST_CPUS ) --memory $( TEST_MEM ) --huge-page-size 2M --huge-page-count 1800 --isolate-cpus 2-3 --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
4859
4960.PHONY : testc
5061.ONESHELL :
5162testc :
52- scripts/check-qemu-install --debug --match=" !vpp" --cpu 2 --memory 7 --configtest --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
63+ scripts/check-qemu-install --debug --match=" !vpp" $( UEFI_FLAG ) --cpu $( TEST_CPUS ) --memory $( TEST_MEM ) --configtest --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
5364
5465.PHONY : testcvpp
5566.ONESHELL :
5667testcvpp :
57- scripts/check-qemu-install --debug --match=" vpp" --cpu 4 --memory 8 --huge-page-size 2M --huge-page-count 1800 --isolate-cpus 2-3 --configtest --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
68+ scripts/check-qemu-install --debug --match=" vpp" $( UEFI_FLAG ) --cpu $( TEST_CPUS ) --memory $( TEST_MEM ) --huge-page-size 2M --huge-page-count 1800 --isolate-cpus 2-3 --configtest --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
5869
5970.PHONY : testraid
6071.ONESHELL :
6172testraid :
62- scripts/check-qemu-install --debug --raid --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
73+ scripts/check-qemu-install --debug $( UEFI_FLAG ) --raid --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
6374
6475.PHONY : testsb
6576.ONESHELL :
@@ -69,12 +80,23 @@ testsb:
6980.PHONY : testtpm
7081.ONESHELL :
7182testtpm :
72- scripts/check-qemu-install --debug --tpmtest --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
83+ scripts/check-qemu-install --debug $( UEFI_FLAG ) --tpmtest --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
7384
7485.PHONY : testifname
7586.ONESHELL :
7687testifname :
77- scripts/check-qemu-install --debug --ifnametest --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
88+ scripts/check-qemu-install --debug $(UEFI_FLAG ) --ifnametest --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
89+
90+ # Runs each test target as its own $(MAKE) invocation (rather than as
91+ # prerequisites) so make aborts immediately on the first failing testcase
92+ # instead of collecting failures across a parallel-eligible dependency list.
93+ .PHONY : test-suite
94+ test-suite :
95+ $(MAKE ) test-interfaces
96+ $(MAKE ) test-no-interfaces-no-vpp
97+ $(MAKE ) testc
98+ $(MAKE ) testraid
99+ $(MAKE ) testifname
78100
79101.PHONY : test-ci-qcow2
80102.ONESHELL :
@@ -84,17 +106,17 @@ test-ci-qcow2:
84106 exit 1
85107 fi
86108 rm -f cloud-init-image-$(ARCH ) .qcow2 ; cp $$(ls -t build/*.qcow2 | head -n 1 ) cloud-init-image-$(ARCH ) .qcow2
87- scripts/check-qemu-install --debug --cloud-init --disk cloud-init-image-$(ARCH ) .qcow2 $(filter-out $@ ,$(MAKECMDGOALS ) )
109+ scripts/check-qemu-install --debug $( UEFI_FLAG ) --cloud-init --disk cloud-init-image-$(ARCH ) .qcow2 $(filter-out $@ ,$(MAKECMDGOALS ) )
88110
89111.PHONY : test-image-update
90112.ONESHELL :
91113test-image-update :
92- scripts/check-qemu-install --debug --test-image-update --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
114+ scripts/check-qemu-install --debug $( UEFI_FLAG ) --test-image-update --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
93115
94116.PHONY : qemu-live
95117.ONESHELL :
96118qemu-live :
97- scripts/check-qemu-install --qemu-cmd --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
119+ scripts/check-qemu-install --qemu-cmd $( UEFI_FLAG ) --iso $(ISO_PATH ) $(filter-out $@ ,$(MAKECMDGOALS ) )
98120
99121.PHONY : oci
100122.ONESHELL :
0 commit comments