From 5397c519458a742310add6df8c7f904da272d556 Mon Sep 17 00:00:00 2001 From: zhenyzha Date: Wed, 3 Jul 2024 22:29:30 +0800 Subject: [PATCH] edk2_basic:Add edk2 basic test Check whether the status of edk2 The boot process is normal. And add iommu test scenario Cycle the above process. Signed-off-by: zhenyzha --- qemu/tests/cfg/edk2_basic.cfg | 34 ++++++++++++++++++++++++++++++ qemu/tests/edk2_basic.py | 39 +++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 qemu/tests/cfg/edk2_basic.cfg create mode 100644 qemu/tests/edk2_basic.py diff --git a/qemu/tests/cfg/edk2_basic.cfg b/qemu/tests/cfg/edk2_basic.cfg new file mode 100644 index 0000000000..884a722c14 --- /dev/null +++ b/qemu/tests/cfg/edk2_basic.cfg @@ -0,0 +1,34 @@ +- edk2_basic: + virt_test_type = qemu + only Linux + only x86_64, aarch64 + x86_64: + only ovmf + type = edk2_basic + start_vm = no + login_timeout = 240 + reboot_count = 5 + check_messgae = "enter to boot the selected OS" + skip_image_processing = yes + line_numbers = 40 + variants: + - @default: + - iommu_test: + virtio_dev_iommu_platform = on + virtio_dev_filter = '^(?:(?:virtio-)|(?:vhost-))(?!(?:balloon)|(?:user)|(?:iommu))' + variants: + - intel_iommu: + only x86_64 + only HostCpuVendor.intel + machine_type_extra_params = "kernel-irqchip=split" + virtio_dev_ats = on + virtio_dev_aer = on + intel_iommu = yes + enable_guest_iommu = yes + - smmuv3: + only aarch64 + machine_type_extra_params += ",iommu=smmuv3" + - viommu: + no Host_RHEL.m9.u0 + required_qemu= [7.0.0,) + virtio_iommu = yes diff --git a/qemu/tests/edk2_basic.py b/qemu/tests/edk2_basic.py new file mode 100644 index 0000000000..9db73fdb80 --- /dev/null +++ b/qemu/tests/edk2_basic.py @@ -0,0 +1,39 @@ +import time + +from virttest import error_context + + +@error_context.context_aware +def run(test, params, env): + """ + Qemu edk2 basic test: + 1) Try to log into a guest + 2) Check serial log information + 3) Check edk2 output information + 4) Add iommu test scenario + 5) Cycle the above process + + :param test: QEMU test object + :param params: Dictionary with the test parameters + :param env: Dictionary with test environment. + """ + timeout = params.get_numeric("login_timeout", 240) + line_numbers = params.get_numeric("line_numbers", 40) + check_messgae = params.get("check_messgae") + vm = env.get_vm(params["main_vm"]) + + for i in range(params.get_numeric("reboot_count", 1)): + vm.create() + error_context.context("Check serial log result", test.log.info) + try: + output = vm.serial_console.read_until_output_matches([check_messgae], + timeout=timeout) + except Exception as msg: + test.log.error(msg) + test.fail("No highlighted entry was detected " + "the boot was abnormal.") + error_context.context("Check edk2 output information", test.log.info) + if len(output[1].splitlines()) > line_numbers: + test.fail("Warning edk2 line count exceeds %d." % line_numbers) + time.sleep(2) + vm.destroy(gracefully=False)