Skip to content

Commit cfacfbc

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 cfacfbc

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

qemu/tests/virtio_fs_support_win_fs.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import re
2+
import time
3+
14
from virttest import error_context, utils_misc, utils_test
25

36
from provider import virtio_fs_utils
@@ -69,13 +72,36 @@ 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, 0, 5
85+
):
86+
test.error("Virtiofs service wasn't start after vm reboot.")
87+
7588
session.cmd("start /w " + autoIt_path + " " + script_path)
7689
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)
90+
91+
check_timeout = 60
92+
end_time = time.time() + check_timeout
93+
while time.time() < end_time:
94+
output = session.cmd_output(
95+
"tasklist -v | findstr %s" % exe_name
96+
).strip()
97+
test.log.info(f"output is {output}")
98+
if output != "":
99+
break
100+
else:
101+
test.error(
102+
f"Volume is not ready for io within {check_timeout}."
103+
)
104+
79105
output_lower = output.lower()
80106
if "7-zip" in output_lower and "setup" in output_lower:
81107
test.log.info(

0 commit comments

Comments
 (0)