Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guest test td func 1213 #154

Merged
merged 4 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions guest-test/guest.test_executor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ guest_test_close() {
test_print_trc "guest test complete, close VM now"
systemctl reboot --reboot-argument=now
EOF
ERR_NUM=$?
if [ $ERR_NUM -eq 0 ]; then
test_print_trc "Guest VM closed properly after test"
return 0
else
return 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent missing here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, my bad (miss-leading by the EOF line before), revised all such issues in this source code.

}

###################### Do Works ######################
Expand Down
11 changes: 8 additions & 3 deletions guest-test/guest.test_launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ echo "$SCRIPT_DIR"
GCOV="off"
# timeout control in case of TD VM booting hang
SECONDS=0
TIMEOUT=300
TIMEOUT=900
# EXEC_FLAG=0 shows test_executor being called
EXEC_FLAG=1

Expand Down Expand Up @@ -249,8 +249,13 @@ while read -r line; do
elif [[ $SECONDS -ge $TIMEOUT ]]; then # break while read loop in case of TD VM boot timeout (no $BOOT_PATTERN found)
break
fi
done < <(if [ "$GCOV" == "off" ]; then timeout "$TIMEOUT" ./guest.qemu_runner.sh; \
else test_print_trc "${VM_TYPE}vm_$PORT keep alive for gcov data collection" && ./guest.qemu_runner.sh; fi)
done < <(
if [ "$GCOV" == "off" ]; then
timeout "$TIMEOUT" ./guest.qemu_runner.sh
else
test_print_trc "${VM_TYPE}vm_$PORT keep alive for gcov data collection" && ./guest.qemu_runner.sh
fi
)

## PART 3: err_handlers error management
# unexpected error/bug/warning/call trace handling
Expand Down
38 changes: 19 additions & 19 deletions guest-test/tdx/tdx.test_executor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ guest_attest_test() {
guest_test_entry tdx_attest_check.sh "-t $selftest_item" || \
{ die "Failed on $TESTCASE tdx_attest_check.sh -t $selftest_item"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
guest_test_close || { die "Failed on close guest VM"; return 1; }
fi
}

Expand All @@ -39,7 +39,7 @@ guest_tsm_attest() {
guest_test_entry tdx_attest_check.sh "-t $test_item" || \
{ die "Failed on $TESTCASE tdx_attest_check.sh -t $test_item"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
guest_test_close || { die "Failed on close guest VM"; return 1; }
fi
}

Expand Down Expand Up @@ -70,16 +70,16 @@ case "$TESTCASE" in
guest_test_entry tdx_guest_boot_check.sh "-v $VCPU -s $SOCKETS -m $MEM" || \
die "Failed on TD_BOOT test tdx_guest_boot_check.sh -v $VCPU -s $SOCKETS -m $MEM"
if [[ $GCOV == "off" ]]; then
guest_test_close
guest_test_close || { die "Failed on close guest VM"; return 1; }
fi
;;
GUEST_TESTCASE_EXAMPLE)
guest_test_prepare guest_test.sh
guest_test_source_code test_source_code_dir_example test_binary_example
guest_test_entry guest_test.sh "-t $TESTCASE" || \
die "Failed on $TESTCASE guest_test.sh -t $TESTCASE"
{ die "Failed on $TESTCASE guest_test.sh -t $TESTCASE"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
guest_test_close || { die "Failed on close guest VM"; return 1; }
fi
;;
TD_ATTEST_VERIFY_REPORT)
Expand All @@ -103,7 +103,7 @@ case "$TESTCASE" in
guest_test_entry tdx_speed_test.sh || \
die "Failed on TD_NET_SPEED tdx_speed_test.sh"
if [[ $GCOV == "off" ]]; then
guest_test_close
guest_test_close || { die "Failed on close guest VM"; return 1; }
fi
;;
TD_TSM_ATTEST_QUOTE_PRECHECK)
Expand All @@ -125,103 +125,103 @@ case "$TESTCASE" in
guest_test_entry tdx_mem_test.sh "-t EBIZZY_FUNC" || \
{ die "Failed on $TESTCASE tdx_mem_test.sh -t EBIZZY_FUNC"; return 1; }
if [[ $GCOV == "off" ]]; then
guest_test_close
guest_test_close || { die "Failed on close guest VM"; return 1; }
fi
;;
TD_MEM_ACPT_T_1C_8G_1W)
guest_test_prepare tdx_mem_test.sh
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
fi
;;
TD_MEM_ACPT_T_1C_8G_32W)
guest_test_prepare tdx_mem_test.sh
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
fi
;;
TD_MEM_ACPT_T_1C_32G_1W)
guest_test_prepare tdx_mem_test.sh
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
fi
;;
TD_MEM_ACPT_T_1C_32G_32W)
guest_test_prepare tdx_mem_test.sh
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
fi
;;
TD_MEM_ACPT_T_1C_96G_1W)
guest_test_prepare tdx_mem_test.sh
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
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
guest_test_close || { die "Failed on close guest VM"; return 1; }
fi
;;
:)
Expand Down