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

Fix test scripts #318

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
98 changes: 59 additions & 39 deletions sh_script/test/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ def test_function_001(device_type):
migtd_dst = "../../Bin/migtd_001.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result()

Expand All @@ -56,11 +57,12 @@ def test_function_002(device_type):
migtd_dst = "../../Bin/migtd_001.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result()

Expand All @@ -76,11 +78,12 @@ def test_function_negative_003(device_type):
migtd_dst = "../../Bin/migtd_001.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result(negative=True)

Expand All @@ -96,11 +99,12 @@ def test_function_004(device_type):
migtd_dst = "../../Bin/migtd_004.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result()

Expand All @@ -116,11 +120,12 @@ def test_function_005(device_type):
migtd_dst = "../../Bin/migtd_005.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result()

Expand All @@ -136,11 +141,12 @@ def test_function_negative_006(device_type):
migtd_dst = "../../Bin/migtd_006.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result(negative=True)

Expand All @@ -156,11 +162,12 @@ def test_function_negative_007(device_type):
migtd_dst = "../../Bin/migtd_no.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result(negative=True)

Expand All @@ -176,11 +183,12 @@ def test_function_negative_008(device_type):
migtd_dst = "../../Bin/migtd_no.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result(negative=True)

Expand All @@ -196,11 +204,12 @@ def test_function_negative_009(device_type):
migtd_dst = "../../Bin/migtd_009.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", no_device=True, device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result(negative=True, wait_time=10)

Expand All @@ -212,11 +221,12 @@ def test_function_010(device_type):
migtd_dst = "../../Bin/migtd_010.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result()

Expand All @@ -228,11 +238,12 @@ def test_function_011(device_type):
migtd_dst = "../../Bin/migtd_011.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result()

Expand All @@ -248,11 +259,12 @@ def test_function_012(device_type):
migtd_dst = "../../Bin/migtd_dst_012.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result()

Expand All @@ -268,11 +280,12 @@ def test_function_013(device_type):
migtd_dst = "../../Bin/migtd_dst_013.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result()

Expand All @@ -288,11 +301,12 @@ def test_function_negative_014(device_type):
migtd_dst = "../../Bin/migtd_dst_014.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result(negative=True)

Expand All @@ -308,11 +322,12 @@ def test_function_negative_015(device_type):
migtd_dst = "../../Bin/migtd_015.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result(negative=True)

Expand All @@ -328,11 +343,12 @@ def test_function_negative_016(device_type):
migtd_dst = "../../Bin/migtd_016.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result(negative=True)

Expand All @@ -348,11 +364,12 @@ def test_function_negative_017(device_type):
migtd_dst = "../../Bin/migtd_017.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result(negative=True)

Expand All @@ -372,7 +389,8 @@ def test_function_negative_018(device_type):
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.start_user_td(type="src")
ctx.start_user_td(type="dst")
ctx.connect()
if device_type == "vsock":
ctx.connect()
ctx.pre_migration()
ctx.check_migration_result(negative=True)

Expand Down Expand Up @@ -400,9 +418,10 @@ def test_pre_binding(device_type, servtd_hash):
with migtd_context() as ctx:
ctx.start_user_td(type="src", is_pre_binding=True, hash=servtd_hash)
ctx.start_user_td(type="dst", is_pre_binding=True, hash=servtd_hash)
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.connect()
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
if device_type == "vsock":
ctx.connect()

ctx.pre_migration(is_pre_binding=True)
ctx.check_migration_result()
Expand All @@ -417,9 +436,10 @@ def test_cycle(device_type):
migtd_dst = "../../target/release/migtd.bin"

with migtd_context() as ctx:
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
ctx.start_mig_td(bios_img=migtd_dst, type="dst", device=device_type)
ctx.connect()
ctx.start_mig_td(bios_img=migtd_src, type="src", device=device_type)
if device_type == "vsock":
ctx.connect()

for i in range(ctx.stress_test_cycles):
LOG.debug(f"#### Cycle Test: {i} ####")
Expand Down
8 changes: 5 additions & 3 deletions sh_script/test/mig-td.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#
set -e

QEMU_EXEC="/usr/local/bin/qemu-system-x86_64"
QEMU_EXEC="/usr/libexec/qemu-kvm"
GUEST_CID=18
MIGTD="/usr/share/td-migration/migtd.bin"
MIGTD=""
VIRTIO_SERIAL=false
MIGTD_TYPE=""
DEST_IP="127.0.0.1"
Expand All @@ -19,6 +19,8 @@ Usage: $(basename "$0") [OPTION]...
-q <qemu path> QEMU path
-m <migtd file> MigTD file
-t <src|dst> Must set migtd type, src or dst
-s Use virtio serial, default is vsock
-i <dest_ip> IP of destination
-h Show this help
EOM
}
Expand Down Expand Up @@ -93,7 +95,7 @@ QEMU_CMD="${QEMU_EXEC} \
if [[ $NO_DEVICE != true ]]; then
if [[ ${VIRTIO_SERIAL} == true ]]; then
QEMU_CMD+=" -device virtio-serial-pci,id=virtio-serial0 "
if [[ ${MIGTD_TYPE} == "src" ]]; then
if [[ ${MIGTD_TYPE} == "dst" ]]; then
QEMU_CMD+=" -chardev socket,host=0.0.0.0,port=1236,server=on,id=foo "
else
QEMU_CMD+=" -chardev socket,host=${DEST_IP},port=1236,server=off,id=foo "
Expand Down
8 changes: 4 additions & 4 deletions sh_script/test/user-td.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#
set -e

QEMU_EXEC="/usr/local/bin/qemu-system-x86_64"
QEMU_EXEC="/usr/libexec/qemu-kvm"
TD_TYPE=""
KERNEL=""
GUEST_IMG=""
OVMF="/home/env/OVMF.fd"
OVMF="/usr/share/qemu/OVMF.fd"
BOOT_TYPE="direct"
TARGET_PID=""
ROOT_PARTITION="/dev/vda3"
Expand All @@ -31,7 +31,7 @@ Usage: $(basename "$0") [OPTION]...
-k <kernel file> Kernel file
-b [direct|grub] Boot type, default is "direct" which requires kernel binary specified via "-k"
-p incoming port
-q [tdvmcall|vsock] Support for TD quote using tdvmcall or vsock
-a [tdvmcall|vsock] Support for TD quote using tdvmcall or vsock
-r <root partition> root partition for direct boot, default is /dev/vda1
-t <src|dst> Must set userTD type, src or dst
-g [true|false] Use pre-binding or not, default is "false"
Expand All @@ -41,7 +41,7 @@ EOM
}

process_args() {
while getopts "i:k:b:o:p:q:r:t:g:m:h" option; do
while getopts "i:k:b:o:p:q:a:r:t:g:m:h" option; do
case "${option}" in
i) GUEST_IMG=$OPTARG;;
k) KERNEL=$OPTARG;;
Expand Down
Loading