Skip to content

Commit

Permalink
[guest-test] New Test: add 12 TD guest mem accept time TCs
Browse files Browse the repository at this point in the history
- add 12 testcases based on review results of configs to evaluate TD guest
kernel unaccepted memory fully consumed time
- remove previous configs TCs to avoid confliction/confusion
- fix a typo in tdx_mem_test.sh

[Test Components] tdx
[Test Types] func
[Supported Devices] spr,emr,gnr,srf

Signed-off-by: Hongyu Ning <[email protected]>
  • Loading branch information
hongyuni authored and ysun committed Dec 13, 2023
1 parent d233aa9 commit f9477ea
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 38 deletions.
86 changes: 71 additions & 15 deletions guest-test/tdx/tdx.test_executor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,42 +128,98 @@ case "$TESTCASE" in
guest_test_close
fi
;;
TD_MEM_ACCEPT_TIME_4G)
TD_MEM_ACPT_T_1C_8G_1W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACCEPT_TIME_4G" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACCEPT_TIME_4G"; return 1; }
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_1C_8G_1W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_1C_8G_1W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
;;
TD_MEM_ACCEPT_TIME_16G)
TD_MEM_ACPT_T_1C_8G_32W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACCEPT_TIME_16G" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACCEPT_TIME_16G"; return 1; }
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_1C_8G_32W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_1C_8G_32W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
;;
TD_MEM_ACCEPT_TIME_32G)
TD_MEM_ACPT_T_1C_32G_1W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACCEPT_TIME_32G" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACCEPT_TIME_32G"; return 1; }
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_1C_32G_1W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_1C_32G_1W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
;;
TD_MEM_ACCEPT_TIME_64G)
TD_MEM_ACPT_T_1C_32G_32W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACCEPT_TIME_64G" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACCEPT_TIME_64G"; return 1; }
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_1C_32G_32W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_1C_32G_32W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
;;
TD_MEM_ACCEPT_TIME_96G)
TD_MEM_ACPT_T_1C_96G_1W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACCEPT_TIME_96G" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACCEPT_TIME_96G"; return 1; }
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_1C_96G_1W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_1C_96G_1W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
;;
TD_MEM_ACPT_T_1C_96G_32W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_1C_96G_32W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_1C_96G_32W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
;;
TD_MEM_ACPT_T_32C_8G_32W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_32C_8G_32W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_32C_8G_32W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
;;
TD_MEM_ACPT_T_32C_8G_256W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_32C_8G_256W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_32C_8G_256W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
;;
TD_MEM_ACPT_T_32C_32G_32W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_32C_32G_32W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_32C_32G_32W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
;;
TD_MEM_ACPT_T_32C_32G_256W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_32C_32G_256W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_32C_32G_256W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
;;
TD_MEM_ACPT_T_32C_96G_32W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_32C_96G_32W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_32C_96G_32W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
;;
TD_MEM_ACPT_T_32C_96G_256W)
guest_test_prepare tdx_mem_test.sh
guest_test_entry tdx_mem_test.sh "-t MEM_ACPT_T_32C_96G_256W" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t MEM_ACPT_T_32C_96G_256W"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
fi
Expand Down
78 changes: 60 additions & 18 deletions guest-test/tdx/tdx_mem_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ done
###################### Functions ######################
ebizzy_func() {
test_print_trc "Start TDX guest ebizzy test 10s with malloc"
ebizzy -M
./ebizzy -M
ebizzy_malloc=$?
test_print_trc "Start TDX guest ebizzy test 10s with mmap"
ebizzy -m
./ebizzy -m
ebizzy_mmap=$?
if [[ $ebizzy_malloc == 0 && $ebizzy_mmap == 0 ]]; then
test_print_trc "TDX guest ebizzy test PASS"
Expand All @@ -47,6 +47,8 @@ ebizzy_func() {
mem_accepted_time() {
# common expected time consumed in seconds
expected_time=$1
# stress-ng mem stress process number
workers=$2
# prepare for prerequisites
if [ ! "$(which stress-ng)" ]; then
dnf install -y stress-ng > /dev/null
Expand All @@ -57,7 +59,7 @@ expected_time=$1
fi
# calculate memory accepted fully completed time
SECONDS=0
stress-ng --vm 1 --vm-bytes 100% &
stress-ng --vm "$workers" --vm-bytes 100% &
while (true); do
if [[ $(grep "nr_unaccepted" /proc/vmstat | awk '{print $2}') -eq 0 ]]; then
actual_time=$SECONDS;
Expand All @@ -84,25 +86,65 @@ case "$MEM_CASE" in
EBIZZY_FUNC)
ebizzy_func
;;
MEM_ACCEPT_TIME_4G)
# expected 4 secs
mem_accepted_time 4
MEM_ACPT_T_1C_8G_1W)
# expected 24secs in case of
# 1VCPU + 8G MEM + 1 mem stress process
mem_accepted_time 24 1
;;
MEM_ACCEPT_TIME_16G)
# expected 1 min 4 secs
mem_accepted_time 64
MEM_ACPT_T_1C_8G_32W)
# expected 26secs in case of
# 1VCPU + 8G MEM + 32 mem stress processes
mem_accepted_time 26 32
;;
MEM_ACCEPT_TIME_32G)
# expected 2 mins 18 secs
mem_accepted_time 138
MEM_ACPT_T_1C_32G_1W)
# expected 148secs in case of
# 1VCPU + 32G MEM + 1 mem stress process
mem_accepted_time 148 1
;;
MEM_ACCEPT_TIME_64G)
# expected 4 mins 46 secs
mem_accepted_time 286
MEM_ACPT_T_1C_32G_32W)
# expected 232secs in case of
# 1VCPU + 32G MEM + 32 mem stress processes
mem_accepted_time 232 32
;;
MEM_ACCEPT_TIME_96G)
# expected 5 mins 59 secs
mem_accepted_time 359
MEM_ACPT_T_1C_96G_1W)
# expected 472secs in case of
# 1VCPU + 32G MEM + 1 mem stress process
mem_accepted_time 472 1
;;
MEM_ACPT_T_1C_96G_32W)
# expected 773secs in case of
# 1VCPU + 32G MEM + 32 mem stress processes
mem_accepted_time 773 32
;;
MEM_ACPT_T_32C_8G_32W)
# expected 2secs in case of
# 32VCPU + 8G MEM + 32 mem stress processes
mem_accepted_time 2 32
;;
MEM_ACPT_T_32C_8G_256W)
# expected 4secs in case of
# 32VCPU + 8G MEM + 256 mem stress processes
mem_accepted_time 4 256
;;
MEM_ACPT_T_32C_32G_32W)
# expected 29secs in case of
# 32VCPU + 32G MEM + 32 mem stress processes
mem_accepted_time 29 32
;;
MEM_ACPT_T_32C_32G_256W)
# expected 33secs in case of
# 32VCPU + 32G MEM + 256 mem stress processes
mem_accepted_time 33 256
;;
MEM_ACPT_T_32C_96G_32W)
# expected 284secs in case of
# 32VCPU + 96G MEM + 32 mem stress processes
mem_accepted_time 284 32
;;
MEM_ACPT_T_32C_96G_256W)
# expected 92secs in case of
# 32VCPU + 96G MEM + 256 mem stress processes
mem_accepted_time 92 256
;;
:)
test_print_err "Must specify the memory case option by [-t]"
Expand Down
17 changes: 12 additions & 5 deletions guest-test/tdx/tests
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ guest.test_launcher.sh -v 1 -s 1 -m 1 -d on -t tdx -f tdx -x TD_TSM_ATTEST_QUOTE
guest.test_launcher.sh -v 1 -s 1 -m 1 -d on -t tdx -f tdx -x TD_NET_SPEED -c "accept_memory=lazy" -p off
# case implemented by tdx_mem_test.sh
guest.test_launcher.sh -v 1 -s 1 -m 16 -d on -t tdx -f tdx -x TD_MEM_EBIZZY_FUNC -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 4 -s 1 -m 4 -d on -t tdx -f tdx -x TD_MEM_ACCEPT_TIME_4G -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 16 -s 1 -m 4 -d on -t tdx -f tdx -x TD_MEM_ACCEPT_TIME_16G -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 16 -s 1 -m 4 -d on -t tdx -f tdx -x TD_MEM_ACCEPT_TIME_32G -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 16 -s 1 -m 4 -d on -t tdx -f tdx -x TD_MEM_ACCEPT_TIME_64G -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 16 -s 1 -m 4 -d on -t tdx -f tdx -x TD_MEM_ACCEPT_TIME_96G -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 1 -s 1 -m 8 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_1C_8G_1W -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 1 -s 1 -m 8 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_1C_8G_32W -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 1 -s 1 -m 32 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_1C_32G_1W -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 1 -s 1 -m 32 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_1C_32G_32W -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 1 -s 1 -m 96 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_1C_96G_1W -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 1 -s 1 -m 96 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_1C_96G_32W -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 32 -s 1 -m 8 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_32C_8G_32W -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 32 -s 1 -m 8 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_32C_8G_256W -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 32 -s 1 -m 32 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_32C_32G_32W -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 32 -s 1 -m 32 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_32C_32G_256W -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 32 -s 1 -m 96 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_32C_96G_32W -c "accept_memory=lazy" -p off
guest.test_launcher.sh -v 32 -s 1 -m 96 -d on -t tdx -f tdx -x TD_MEM_ACPT_T_32C_96G_256W -c "accept_memory=lazy" -p off

0 comments on commit f9477ea

Please sign in to comment.