提交 57a045ef 编写于 作者: S Suqin Huang

Add viorng_in_use test scenerios

上级 c894a989
- viorng_in_use:
type = driver_in_use
start_vm = yes
kill_vm_on_error = yes
check_guest_bsod = yes
login_timeout = 240
suppress_exception = no
run_bgstress = rng_bat
session_cmd_timeout = 240
read_rng_cmd = for /l %i in (1, 1, 1000) do "X:\random_%PROCESSOR_ARCHITECTURE%.exe"
rng_data_rex = "0x\w"
driver_name = "viorng"
cdrom_cd1 = isos/windows/winutils.iso
no no_virtio_rng
only Windows
variants:
- before_bg_test:
run_bg_flag = "before_bg_test"
- during_bg_test:
suppress_exception = yes
run_bg_flag = "during_bg_test"
target_process = random\w*.exe
- after_bg_test:
run_bg_flag = "after_bg_test"
variants:
- with_stop_continue:
suppress_exception = no
sub_test = stop_continue
- with_shutdown:
sub_test = shutdown
shutdown_method = shell
- with_reboot:
sub_test = boot
reboot_count = 1
reboot_method = shell
- with_system_reset:
sub_test = boot
reboot_method = system_reset
sleep_before_reset = 20
......@@ -31,11 +31,11 @@ def run(test, params, env):
else return False
"""
session = vm.wait_for_login()
list_cmd = "wmic process where name='%s' list" % target_process
list_cmd = "wmic process get name"
output = session.cmd_output_safe(list_cmd, timeout=60)
check_reg = re.compile(r"%s" % target_process, re.I | re.M)
process = re.findall(target_process, output, re.M | re.I)
session.close()
return bool(check_reg.findall(output))
return bool(process)
def run_bg_stress_test(bg_stress_test):
"""
......@@ -59,7 +59,7 @@ def run(test, params, env):
{"sub_type": bg_stress_test})
stress_thread.start()
if not utils_misc.wait_for(lambda: check_bg_running(target_process),
120, 0, 5):
120, 0, 1):
raise exceptions.TestFail("Backgroud test %s is not "
"alive!" % bg_stress_test)
if params.get("set_bg_stress_flag", "no") == "yes":
......@@ -97,28 +97,23 @@ def run(test, params, env):
error_context.context("Run sub test %s %s" % (sub_type, run_bg_flag),
logging.info)
try:
if run_bg_flag == "before_bg_test":
run_subtest(sub_type)
if vm.is_dead():
vm.create(params=params)
run_subtest(bg_stress_test)
elif run_bg_flag == "during_bg_test":
stress_thread = run_bg_stress_test(bg_stress_test)
stop_time = time.time() + wait_time
while time.time() < stop_time:
if env["bg_status"] == 1:
run_subtest(sub_type)
break
if stress_thread:
stress_thread.join(timeout=timeout,
suppress_exception=suppress_exception)
elif run_bg_flag == "after_bg_test":
run_subtest(bg_stress_test)
if vm.is_dead():
vm.create(params=params)
run_subtest(sub_type)
finally:
session.close()
utils_test.qemu.clear_win_driver_verifier(driver, vm, timeout)
if run_bg_flag == "before_bg_test":
run_subtest(sub_type)
if vm.is_dead():
vm.create(params=params)
run_subtest(bg_stress_test)
elif run_bg_flag == "during_bg_test":
stress_thread = run_bg_stress_test(bg_stress_test)
stop_time = time.time() + wait_time
while time.time() < stop_time:
if env["bg_status"] == 1:
run_subtest(sub_type)
break
if stress_thread:
stress_thread.join(timeout=timeout,
suppress_exception=suppress_exception)
elif run_bg_flag == "after_bg_test":
run_subtest(bg_stress_test)
if vm.is_dead():
vm.create(params=params)
run_subtest(sub_type)
......@@ -5,7 +5,6 @@ import aexpect
from virttest import utils_misc
from virttest import error_context
from virttest import utils_test
from virttest import funcatexit
from avocado.core import exceptions
from avocado.utils import process
......@@ -68,14 +67,8 @@ def run(test, params, env):
raise exceptions.TestFail(msg)
if params["os_type"] == "windows":
try:
utils_test.qemu.setup_win_driver_verifier(driver_name,
vm, timeout)
funcatexit.register(env, params.get("type"),
utils_test.qemu.clear_win_driver_verifier,
driver_name, vm, timeout)
except Exception, e:
raise exceptions.TestFail(e)
utils_test.qemu.setup_win_driver_verifier(driver_name,
vm, timeout)
else:
error_context.context("verify virtio-rng device driver", logging.info)
session = vm.wait_for_login(timeout=timeout)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册