-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[New][guest-test][tdx]: add $TESTCASE TD_BOOT test script and tests
please refer to this implmentation to add more guest vm testcases Signed-off-by: Hongyu Ning <[email protected]>
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# Copyright (c) 2023 Intel Corporation | ||
|
||
# Author: Hongyu Ning <[email protected]> | ||
# | ||
# History: 24, Aug., 2023 - Hongyu Ning - creation | ||
|
||
|
||
# @desc This script do basic TD guest booting check in TDX Guest VM | ||
|
||
###################### Variables ###################### | ||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" | ||
echo "$SCRIPT_DIR" | ||
source common.sh | ||
|
||
while getopts :v:s:m: arg; do | ||
case $arg in | ||
v) | ||
VCPU=$OPTARG | ||
;; | ||
s) | ||
SOCKETS=$OPTARG | ||
;; | ||
m) | ||
MEM=$OPTARG | ||
;; | ||
esac | ||
done | ||
|
||
###################### Do Works ###################### | ||
# check vcpu and socket number | ||
vcpu_td=$(lscpu | grep "CPU(s)" | head -1 | awk '{print $2}') | ||
sockets_td=$(lscpu | grep "Socket(s)" | awk '{print $2}') | ||
test_print_trc "vcpu_td: $vcpu_td" | ||
test_print_trc "sockets_td: $sockets_td" | ||
|
||
if [[ "$vcpu_td" -ne "$VCPU" ]]; then | ||
die "Guest TD VM boot with vcpu: $vcpu_td (expected $VCPU)" | ||
fi | ||
|
||
if [[ "$sockets_td" -ne "$SOCKETS" ]]; then | ||
die "Guest TD VM boot with sockets: $sockets_td (expected $SOCKETS)" | ||
fi | ||
|
||
# check memory size | ||
mem_td=$(grep "MemTotal" /proc/meminfo | awk '$3=="kB" {printf "%.0f\n", $2/(1024*1024)}') | ||
test_print_trc "mem_td: $mem_td" | ||
|
||
# $MEM less than or equal to 4GB need special memory size check | ||
if [[ $MEM -le 4 ]]; then | ||
if [[ $(( $MEM / $mem_td )) -lt 1 ]] || [[ $(( $MEM / $mem_td )) -gt 2 ]]; then | ||
die "Guest TD VM boot with memory: $mem_td GB (expected $MEM GB)" | ||
fi | ||
# $MEM more than 4GB use general memory size check | ||
else | ||
if [[ $(( $MEM / $mem_td )) -ne 1 ]]; then | ||
die "Guest TD VM boot with memory: $mem_td GB (expected $MEM GB)" | ||
fi | ||
fi | ||
|
||
test_print_trc "Guest TD VM boot up successfully with config:" | ||
test_print_trc "vcpu $VCPU, socket $SOCKETS, memory $MEM GB" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# case implemented by tdx_guest_boot_check.sh | ||
guest.test_launcher.sh -v 1 -s 1 -m 1 -d on -t tdx -x TD_BOOT -c "accept_memory=lazy" -p off | ||
guest.test_launcher.sh -v 1 -s 1 -m 16 -d on -t tdx -x TD_BOOT -c "accept_memory=lazy" -p off | ||
guest.test_launcher.sh -v 4 -s 1 -m 4 -d on -t tdx -x TD_BOOT -c "accept_memory=lazy" -p off | ||
guest.test_launcher.sh -v 4 -s 2 -m 4 -d on -t tdx -x TD_BOOT -c "accept_memory=lazy" -p off | ||
guest.test_launcher.sh -v 4 -s 2 -m 96 -d on -t tdx -x TD_BOOT -c "accept_memory=lazy" -p off | ||
guest.test_launcher.sh -v 64 -s 8 -m 96 -d on -t tdx -x TD_BOOT -c "accept_memory=lazy" -p off | ||
guest.test_launcher.sh -v 288 -s 1 -m 1 -d on -t tdx -x TD_BOOT -c "accept_memory=lazy" -p off | ||
guest.test_launcher.sh -v 288 -s 8 -m 96 -d on -t tdx -x TD_BOOT -c "accept_memory=lazy" -p off | ||
guest.test_launcher.sh -v 1 -s 1 -m 1 -d off -t tdx -x TD_BOOT -c "accept_memory=lazy" -p off |