Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Pierrick Bouvier <[email protected]>
  • Loading branch information
pbo-linaro committed Dec 11, 2024
1 parent 13980b0 commit 00d446a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 78 deletions.
1 change: 1 addition & 0 deletions tests/functional/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_timeouts = {
'aarch64_sbsaref_freebsd' : 720,
'aarch64_tuxrun' : 240,
'aarch64_virt' : 720,
'aarch64_virt_windows' : 720,
'acpi_bits' : 420,
'arm_aspeed_palmetto' : 120,
'arm_aspeed_romulus' : 120,
Expand Down
90 changes: 12 additions & 78 deletions tests/functional/test_aarch64_virt_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,102 +16,36 @@

from qemu_test import BUILD_DIR
from qemu_test import QemuSystemTest, Asset
from qemu_test import exec_command, wait_for_console_pattern
from qemu_test import get_qemu_img, run_cmd
from qemu_test import exec_command


class Aarch64VirtWindowsMachine(QemuSystemTest):

ASSET_WINVOS_ISO = Asset(
('https://aka.ms/DownloadValidationOS_arm64',
''))
# VM image comes from iso download at:
# https://aka.ms/DownloadValidationOS_arm64
ASSET_WINVOS_IMG = Asset(
('https://fileserver.linaro.org/s/iTFEgXfpa9FfrGk/'
'download/ValidationOS.vhdx'),
'ae6d95d6657a2d644ecff42abd713b11c808756416ee610a1fcf86cb34d49675')

def test_win_virt_tcg(self):
self.set_machine('virt')
self.vm.set_console()
self.require_accelerator("tcg")

iso_path = self.ASSET_WINVOS_ISO.fetch()
img_path = self.ASSET_WINVOS_IMG.fetch()

self.vm.add_args("-accel", "tcg")
self.vm.add_args("-cpu", "max,pauth-impdef=on")
self.vm.add_args("-machine",
"virt,acpi=on,"
"virtualization=on,"
"mte=on,"
"gic-version=max,iommu=smmuv3")
self.vm.add_args("-smp", "2", "-m", "1024")
"virt,its=on,"
"virtualization=false,"
"gic-version=3")
self.vm.add_args("-smp", "1", "-m", "1024")
self.vm.add_args('-bios', os.path.join(BUILD_DIR, 'pc-bios',
'edk2-aarch64-code.fd'))
self.vm.add_args("-drive", f"file={iso_path},media=cdrom,format=raw")
self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom')

self.vm.launch()
self.wait_for_console_pattern('Welcome to Alpine Linux 3.17')


ASSET_KERNEL = Asset(
('https://fileserver.linaro.org/s/'
'z6B2ARM7DQT3HWN/download'),
'12a54d4805cda6ab647cb7c7bbdb16fafb3df400e0d6f16445c1a0436100ef8d')

def common_aarch64_virt(self, machine):
"""
Common code to launch basic virt machine with kernel+initrd
and a scratch disk.
"""
logger = logging.getLogger('aarch64_virt')

kernel_path = self.ASSET_KERNEL.fetch()

self.set_machine('virt')
self.vm.set_console()
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
'console=ttyAMA0')
self.require_accelerator("tcg")
self.vm.add_args('-cpu', 'max,pauth-impdef=on',
'-machine', machine,
'-accel', 'tcg',
'-kernel', kernel_path,
'-append', kernel_command_line)

# A RNG offers an easy way to generate a few IRQs
self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
self.vm.add_args('-object',
'rng-random,id=rng0,filename=/dev/urandom')

# Also add a scratch block device
logger.info('creating scratch qcow2 image')
image_path = os.path.join(self.workdir, 'scratch.qcow2')
qemu_img = get_qemu_img(self)
run_cmd([qemu_img, 'create', '-f', 'qcow2', image_path, '8M'])

# Add the device
self.vm.add_args('-blockdev',
f"driver=qcow2,file.driver=file,file.filename={image_path},node-name=scratch")
self.vm.add_args('-device',
'virtio-blk-device,drive=scratch')

self.vm.launch()
self.wait_for_console_pattern('Welcome to Buildroot')
time.sleep(0.1)
exec_command(self, 'root')
time.sleep(0.1)
exec_command(self, 'dd if=/dev/hwrng of=/dev/vda bs=512 count=4')
time.sleep(0.1)
exec_command(self, 'md5sum /dev/vda')
time.sleep(0.1)
exec_command(self, 'cat /proc/interrupts')
time.sleep(0.1)
exec_command(self, 'cat /proc/self/maps')
time.sleep(0.1)

def test_aarch64_virt_gicv3(self):
self.common_aarch64_virt("virt,gic_version=3")

def test_aarch64_virt_gicv2(self):
self.common_aarch64_virt("virt,gic-version=2")


if __name__ == '__main__':
Expand Down

0 comments on commit 00d446a

Please sign in to comment.