Skip to content

Commit 27fea7c

Browse files
authored
Merge pull request #1258 from vyos/T9014-smoketests
T9014: Run smoketests on arm64 platform
2 parents 70deb14 + 4413032 commit 27fea7c

2 files changed

Lines changed: 43 additions & 14 deletions

File tree

Makefile

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@ build_dir := build
44
ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
55
ISO_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
1223
ifneq ($(filter $(TEST_TARGETS),$(firstword $(MAKECMDGOALS))),)
1324
$(eval $(filter-out $(firstword $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
1425
endif
@@ -24,42 +35,42 @@ all:
2435
.PHONY: test
2536
.ONESHELL:
2637
test:
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:
3142
test-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:
3647
test-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:
4152
test-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:
4657
test-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:
5162
testc:
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:
5667
testcvpp:
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:
6172
testraid:
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:
7182
testtpm:
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:
7687
testifname:
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:
91113
test-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:
96118
qemu-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:

scripts/check-qemu-install

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@ args = parser.parse_args()
166166
if os.geteuid() != 0:
167167
exit('You need to have root privileges to run this script.')
168168

169+
if platform.machine() not in ['amd64', 'x86_64', 'arm64', 'aarch64']:
170+
exit(f'Unsupported host architecture "{platform.machine()}" - this script '
171+
'only runs on amd64 or arm64 hosts.')
172+
173+
if platform.machine() in ['arm64', 'aarch64'] and not args.uefi:
174+
exit('--uefi is mandatory when running on arm64 hosts.')
175+
169176
if args.cloud_init:
170177
hostname = CI_CONFIG_ARGS['hostname']
171178
op_mode_prompt = rf'vyos@{hostname}:~\$'

0 commit comments

Comments
 (0)