Skip to content

Commit 59373f8

Browse files
committed
virtio_fs_support_win_fs: wait some time for 7z.exe up
1. wait virtiofs service start after reboot system 2. wait for 7zip process up Signed-off-by: Xiaoling Gao <[email protected]>
1 parent d84af53 commit 59373f8

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

qemu/tests/cfg/virtio_fs_support_win_fs.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
script_path = ":\simulate_right_click_on_7z_latest.au3"
4444
Win10, Win2016, Win2019, Win2022:
4545
script_path = ":\simulate_right_click_on_7z.au3"
46+
check_task_cmd = tasklist -v | findstr %s
4647
reg_add_cmd = "reg add HKLM\Software\VirtIO-FS /v FileSystemName /d NTFS /t REG_SZ /f"
4748
reg_add_username = 'reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d ${guest_username} /f'
4849
reg_add_pwd = 'reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d ${guest_username_pwd} /f'

qemu/tests/virtio_fs_support_win_fs.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import re
2+
13
from virttest import error_context, utils_misc, utils_test
24

35
from provider import virtio_fs_utils
@@ -31,6 +33,7 @@ def run(test, params, env):
3133
driver = params["driver_name"]
3234
driver_verifier = params.get("driver_verifier", driver)
3335
driver_running = params.get("driver_running", driver_verifier)
36+
check_task_cmd = params["check_task_cmd"]
3437

3538
vm = env.get_vm(params.get("main_vm"))
3639
vm.verify_alive()
@@ -69,13 +72,32 @@ def run(test, params, env):
6972
session.cmd(reg_add_pwd)
7073
error_context.context("Reboot the guest.", test.log.info)
7174
session = vm.reboot(session)
75+
7276
error_context.context(
7377
"Run autoit script to install executable in explorer.", test.log.info
7478
)
79+
# wait several seconds to virtiofs startup
80+
if not utils_misc.wait_for(
81+
lambda: re.search(
82+
r"RUNNING", virtio_fs_utils.query_viofs_service(test, params, session)
83+
),
84+
60,
85+
0,
86+
5,
87+
):
88+
test.error("Virtiofs service wasn't start after vm reboot.")
89+
7590
session.cmd("start /w " + autoIt_path + " " + script_path)
7691
exe_name = winutils_pack_path.encode("unicode_escape").decode()[4:]
77-
output = session.cmd_output("tasklist -v | findstr %s" % exe_name)
78-
test.log.info("The process found: %s", output)
92+
if not utils_misc.wait_for(
93+
lambda: session.cmd_output(check_task_cmd % exe_name).strip(),
94+
60,
95+
0,
96+
2,
97+
):
98+
test.error(f"The {exe_name} isn't started.")
99+
100+
output = session.cmd_output(check_task_cmd % exe_name).strip()
79101
output_lower = output.lower()
80102
if "7-zip" in output_lower and "setup" in output_lower:
81103
test.log.info(

0 commit comments

Comments
 (0)