Skip to content

Commit

Permalink
Add 3 TDX cases by booting TD several times
Browse files Browse the repository at this point in the history
td_boot_multimes.one_socket.one_cpu
td_boot_multimes.one_socket.four_cpu
td_boot_multimes.two_socket.four_cpu

Signed-off-by: Xudong Hao <[email protected]>
  • Loading branch information
xhao22 committed Jun 18, 2024
1 parent e2ef68b commit 0a8f758
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
24 changes: 24 additions & 0 deletions KVM/qemu/td_boot_multimes.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
- td_boot_multimes:
virt_test_type = qemu
type = td_boot_multimes
vm_accelerator = kvm
machine_type_extra_params = "kernel-irqchip=split"
vm_secure_guest_type = tdx
start_vm = no
vga = std
auto_cpu_model = "no"
cpu_model = host
iterations = 10
variants:
- one_cpu:
smp = 1
vcpu_maxcpus = 1
- four_cpu:
smp = 4
vcpu_maxcpus = 4
variants:
- one_socket:
vcpu_sockets = 1
- two_socket:
vcpu_sockets = 2
no one_cpu
40 changes: 40 additions & 0 deletions KVM/qemu/tests/td_boot_multimes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/python3

# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2024 Intel Corporation

# Author: Xudong Hao <[email protected]>
#
# History: Jun. 2024 - Xudong Hao - creation
from virttest import env_process
from virttest import error_context


# This decorator makes the test function aware of context strings
@error_context.context_aware
def run(test, params, env):
"""
Boot TD by multiple times:
1) Boot up one TDVM
2) Shutdown TDVM
3) repeat step1 and step2 multiple times
:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment
"""

params["start_vm"] = 'yes'
timeout = params.get_numeric("login_timeout", 240)
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()

0 comments on commit 0a8f758

Please sign in to comment.