Skip to content

Commit

Permalink
edk2_basic:Add edk2 basic test
Browse files Browse the repository at this point in the history
Check whether the status of edk2
The boot process is normal.

Signed-off-by: zhenyzha <[email protected]>
  • Loading branch information
zhenyzha committed Aug 8, 2024
1 parent 6989b15 commit 6d126a8
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
32 changes: 32 additions & 0 deletions qemu/tests/cfg/edk2_basic.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
- edk2_basic:
virt_test_type = qemu
only Linux
only x86_64, aarch64
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 q35
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
39 changes: 39 additions & 0 deletions qemu/tests/edk2_basic.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 6d126a8

Please sign in to comment.