From ddcef10ef789a5e7004562aa9de44b3e4d252780 Mon Sep 17 00:00:00 2001 From: Xudong Hao Date: Mon, 5 Aug 2024 15:45:38 +0800 Subject: [PATCH] Add one TDX test case by 4 VMs 20 times booting Signed-off-by: Xudong Hao --- KVM/qemu/td_boot_multimes.cfg | 6 ++++++ KVM/qemu/tests/td_boot_multimes.py | 26 ++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/KVM/qemu/td_boot_multimes.cfg b/KVM/qemu/td_boot_multimes.cfg index be68dfca..b2ba0868 100644 --- a/KVM/qemu/td_boot_multimes.cfg +++ b/KVM/qemu/td_boot_multimes.cfg @@ -22,3 +22,9 @@ - two_socket: vcpu_sockets = 2 no one_cpu + - 4vm_20times: + vms = "vm1 vm2 vm3 vm4" + image_snapshot = yes + mem = 16384 + iterations = 20 + only four_cpu diff --git a/KVM/qemu/tests/td_boot_multimes.py b/KVM/qemu/tests/td_boot_multimes.py index 3e6d5bae..8b289ea6 100644 --- a/KVM/qemu/tests/td_boot_multimes.py +++ b/KVM/qemu/tests/td_boot_multimes.py @@ -15,7 +15,7 @@ def run(test, params, env): """ Boot TD by multiple times: - 1) Boot up one TDVM + 1) Boot up TDVM 2) Shutdown TDVM 3) repeat step1 and step2 multiple times @@ -24,17 +24,19 @@ def run(test, params, env): :param env: Dictionary with test environment """ - params["start_vm"] = 'yes' timeout = params.get_numeric("login_timeout", 240) + serial_login = params.get("serial_login", "no") == "yes" iterations = params.get_numeric("iterations") for i in range(iterations): - error_context.context("The iteration %s of booting TDVM" % i, test.log.info) - vm_name = params['main_vm'] - try: - env_process.preprocess_vm(test, params, env, vm_name) - except: - raise - vm = env.get_vm(vm_name) - vm.verify_alive() - session = vm.wait_for_login(timeout=timeout) - vm.destroy() + error_context.context("The iteration %s of booting TDVM(s)" % i, test.log.info) + vms = env.get_all_vms() + for vm in vms: + vm.create() + for vm in vms: + vm.verify_alive() + if serial_login: + session = vm.wait_for_serial_login(timeout=timeout) + else: + session = vm.wait_for_login(timeout=timeout) + session.close() + vm.destroy()