Skip to content

Commit faa1b8a

Browse files
committed
T8065: Dehardcode qemu settings to allow run tests on arch arm64
1 parent 88897ba commit faa1b8a

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ SHELL := /bin/bash
22

33
build_dir := build
44

5+
arch ?= $(shell dpkg --print-architecture 2>/dev/null || echo amd64)
6+
57
.PHONY: all
68
all:
79
@echo "Make what specifically?"
@@ -13,8 +15,8 @@ all:
1315
.PHONY: checkiso
1416
.ONESHELL:
1517
checkiso:
16-
if [ ! -f build/live-image-amd64.hybrid.iso ]; then
17-
echo "Could not find build/live-image-amd64.hybrid.iso"
18+
if [ ! -f build/live-image-$(arch).hybrid.iso ]; then
19+
echo "Could not find build/live-image-$(arch).hybrid.iso"
1820
exit 1
1921
fi
2022

@@ -31,7 +33,7 @@ test-no-interfaces: checkiso
3133
.PHONY: test-no-interfaces-no-vpp
3234
.ONESHELL:
3335
test-no-interfaces-no-vpp: checkiso
34-
scripts/check-qemu-install --debug --configd --smoketest --uefi --no-interfaces --no-vpp build/live-image-amd64.hybrid.iso
36+
scripts/check-qemu-install --debug --configd --smoketest --uefi --no-interfaces --no-vpp --arch $(arch) build/live-image-$(arch).hybrid.iso
3537

3638
.PHONY: test-interfaces
3739
.ONESHELL:

scripts/check-qemu-install

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ now = datetime.now()
5454
tpm_folder = '/tmp/vyos_tpm_test'
5555
qemu_name = 'VyOS-QEMU'
5656

57+
# Map arch to QEMU binary and machine type
58+
QEMU_BIN = {
59+
"amd64": "qemu-system-x86_64",
60+
"arm64": "qemu-system-aarch64",
61+
}
62+
63+
MACHINE_TYPE = {
64+
"amd64": "pc",
65+
"arm64": "virt",
66+
}
67+
68+
BIOS = {
69+
"amd64": "/usr/share/OVMF/OVMF_CODE.fd",
70+
"arm64": "/usr/share/qemu-efi-aarch64/QEMU_EFI.fd",
71+
}
72+
5773
# getch.py
5874
KEY_F2 = chr(27) + chr(91) + chr(49) + chr(50) + chr(126)
5975
KEY_F10 = chr(27) + chr(91) + chr(50) + chr(49) + chr(126)
@@ -103,6 +119,7 @@ parser.add_argument('--no-vpp', help='Execute testsuite without VPP tests',
103119
action='store_true', default=False)
104120
parser.add_argument('--huge-page-size', help='Huge page size (e.g., 2M, 1G)', type=str)
105121
parser.add_argument('--huge-page-count', help='Number of huge pages to allocate', type=int)
122+
parser.add_argument('--arch', help='Architecture')
106123

107124
args = parser.parse_args()
108125

@@ -148,15 +165,18 @@ if args.sbtest:
148165
def get_qemu_cmd(name, enable_uefi, disk_img, raid=None, iso_img=None, tpm=False, vnc_enabled=False, secure_boot=False):
149166
uefi = ""
150167
uuid = "f48b60b2-e6ad-49ef-9d09-4245d0585e52"
151-
machine = 'pc'
168+
arch = getattr(args, 'arch', 'amd64')
169+
qemu_bin = QEMU_BIN.get(arch, 'qemu-system-x86_64')
170+
machine = MACHINE_TYPE.get(arch, 'pc')
171+
bios_file = BIOS.get(arch, None)
152172
vga = '-vga none'
153173
vnc = ''
154174
if vnc_enabled:
155175
vga = '-vga virtio'
156176
vnc = '-vnc :0'
157177

158178
if enable_uefi:
159-
uefi = '-bios /usr/share/OVMF/OVMF_CODE.fd'
179+
uefi = f'-bios {bios_file}'
160180
name = f'{name}-UEFI'
161181

162182
if secure_boot:
@@ -176,7 +196,7 @@ def get_qemu_cmd(name, enable_uefi, disk_img, raid=None, iso_img=None, tpm=False
176196

177197
# RFC7042 section 2.1.2 MAC addresses used for documentation
178198
macbase = '00:00:5E:00:53'
179-
cmd = f'qemu-system-x86_64 \
199+
cmd = f'{qemu_bin} \
180200
-name "{name}" \
181201
-smp {args.cpu},sockets=1,cores={args.cpu},threads=1 \
182202
-cpu host \

0 commit comments

Comments
 (0)