diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-08-17 21:26:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-17 21:26:57 +0200 |
| commit | 27fea7cdf30bf5d87291425d6ee080a1debd0939 (patch) | |
| tree | 3f1919b2e4e3865060c9fe74a2a7d14008aa7e79 | |
| parent | 70deb1495cb03e5607cfb2dec3493f5223a1868e (diff) | |
| parent | 44130326e963b8cc94e762e27b966a133446a84a (diff) | |
| download | vyos-build-27fea7cdf30bf5d87291425d6ee080a1debd0939.tar.gz vyos-build-27fea7cdf30bf5d87291425d6ee080a1debd0939.zip | |
Merge pull request #1258 from vyos/T9014-smoketests
T9014: Run smoketests on arm64 platform
| -rw-r--r-- | Makefile | 50 | ||||
| -rwxr-xr-x | scripts/check-qemu-install | 7 |
2 files changed, 43 insertions, 14 deletions
@@ -4,11 +4,22 @@ build_dir := build ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) ISO_PATH := $(build_dir)/live-image-$(ARCH).hybrid.iso +# scripts/check-qemu-install requires --uefi on arm64/aarch64 hosts; on +# amd64 it stays optional. +UEFI_FLAG := $(if $(filter arm64 aarch64,$(ARCH)),--uefi,) + +# Common vCPU count for QEMU test targets, capped at the host's available CPUs +TEST_CPUS := $(shell printf '%s\n' "$$(nproc)" 4 | sort -n | head -n1) + +# Common memory size (GB) for QEMU test targets: 8GB if the host has at +# least 10GB of RAM, otherwise 4GB +TEST_MEM := $(shell awk '/MemTotal/{if ($$2/1024/1024 >= 10) print 8; else print 4}' /proc/meminfo) + # Test targets forward extra CLI arguments (e.g. `make test -- --match foo`) # to their scripts via $(MAKECMDGOALS). Those extra words are also goals as # far as make is concerned, so without this they'd fall through to the `%:` # flavor rule below and run build-vyos-image with garbage arguments. -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_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 ifneq ($(filter $(TEST_TARGETS),$(firstword $(MAKECMDGOALS))),) $(eval $(filter-out $(firstword $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:) endif @@ -24,42 +35,42 @@ all: .PHONY: test .ONESHELL: test: - scripts/check-qemu-install --debug --match="$(MATCH)" --smoketest --uefi --cpu 4 --memory 8 --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) + scripts/check-qemu-install --debug --match="$(MATCH)" --smoketest --uefi --cpu $(TEST_CPUS) --memory $(TEST_MEM) --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) .PHONY: test-no-interfaces .ONESHELL: test-no-interfaces: - 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)) + 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)) .PHONY: test-no-interfaces-no-vpp .ONESHELL: test-no-interfaces-no-vpp: - scripts/check-qemu-install --debug --smoketest --uefi --no-interfaces --no-vpp --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) + scripts/check-qemu-install --debug --smoketest --uefi --no-interfaces --no-vpp --cpu $(TEST_CPUS) --memory $(TEST_MEM) --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) .PHONY: test-interfaces .ONESHELL: test-interfaces: - scripts/check-qemu-install --debug --match="interfaces_" --smoketest --uefi --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) + scripts/check-qemu-install --debug --match="interfaces_" --smoketest --uefi --cpu $(TEST_CPUS) --memory $(TEST_MEM) --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) .PHONY: test-vpp .ONESHELL: test-vpp: - 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)) + 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)) .PHONY: testc .ONESHELL: testc: - scripts/check-qemu-install --debug --match="!vpp" --cpu 2 --memory 7 --configtest --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) + scripts/check-qemu-install --debug --match="!vpp" $(UEFI_FLAG) --cpu $(TEST_CPUS) --memory $(TEST_MEM) --configtest --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) .PHONY: testcvpp .ONESHELL: testcvpp: - 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)) + 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)) .PHONY: testraid .ONESHELL: testraid: - scripts/check-qemu-install --debug --raid --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) + scripts/check-qemu-install --debug $(UEFI_FLAG) --raid --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) .PHONY: testsb .ONESHELL: @@ -69,12 +80,23 @@ testsb: .PHONY: testtpm .ONESHELL: testtpm: - scripts/check-qemu-install --debug --tpmtest --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) + scripts/check-qemu-install --debug $(UEFI_FLAG) --tpmtest --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) .PHONY: testifname .ONESHELL: testifname: - scripts/check-qemu-install --debug --ifnametest --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) + scripts/check-qemu-install --debug $(UEFI_FLAG) --ifnametest --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) + +# Runs each test target as its own $(MAKE) invocation (rather than as +# prerequisites) so make aborts immediately on the first failing testcase +# instead of collecting failures across a parallel-eligible dependency list. +.PHONY: test-suite +test-suite: + $(MAKE) test-interfaces + $(MAKE) test-no-interfaces-no-vpp + $(MAKE) testc + $(MAKE) testraid + $(MAKE) testifname .PHONY: test-ci-qcow2 .ONESHELL: @@ -84,17 +106,17 @@ test-ci-qcow2: exit 1 fi rm -f cloud-init-image-$(ARCH).qcow2 ; cp $$(ls -t build/*.qcow2 | head -n 1) cloud-init-image-$(ARCH).qcow2 - scripts/check-qemu-install --debug --cloud-init --disk cloud-init-image-$(ARCH).qcow2 $(filter-out $@,$(MAKECMDGOALS)) + scripts/check-qemu-install --debug $(UEFI_FLAG) --cloud-init --disk cloud-init-image-$(ARCH).qcow2 $(filter-out $@,$(MAKECMDGOALS)) .PHONY: test-image-update .ONESHELL: test-image-update: - scripts/check-qemu-install --debug --test-image-update --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) + scripts/check-qemu-install --debug $(UEFI_FLAG) --test-image-update --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) .PHONY: qemu-live .ONESHELL: qemu-live: - scripts/check-qemu-install --qemu-cmd --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) + scripts/check-qemu-install --qemu-cmd $(UEFI_FLAG) --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS)) .PHONY: oci .ONESHELL: diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install index b3dd8ce6..85d6c024 100755 --- a/scripts/check-qemu-install +++ b/scripts/check-qemu-install @@ -166,6 +166,13 @@ args = parser.parse_args() if os.geteuid() != 0: exit('You need to have root privileges to run this script.') +if platform.machine() not in ['amd64', 'x86_64', 'arm64', 'aarch64']: + exit(f'Unsupported host architecture "{platform.machine()}" - this script ' + 'only runs on amd64 or arm64 hosts.') + +if platform.machine() in ['arm64', 'aarch64'] and not args.uefi: + exit('--uefi is mandatory when running on arm64 hosts.') + if args.cloud_init: hostname = CI_CONFIG_ARGS['hostname'] op_mode_prompt = rf'vyos@{hostname}:~\$' |
