Skip to content

Commit 895daca

Browse files
authored
Merge pull request #4087 from heywji/remove_warning
2 parents 0edffcb + e56cb4b commit 895daca

File tree

2 files changed

+54
-72
lines changed

2 files changed

+54
-72
lines changed

qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,6 @@
249249
driver_test_names = ''
250250
type = win_virtio_driver_installer_uninstall
251251
installer_pkg_check_cmd = 'wmic product get name |findstr "Virtio-win-driver-installer"'
252-
variants:
253-
- by_installer:
254-
- by_msi:
255-
required_virtio_win = [1.9.35.0, )
256-
uninstall_method = msi
257-
run_uninstall_cmd = 'WIN_UTILS:\AutoIt3_%PROCESSOR_ARCHITECTURE%.exe C:\${uninstall_msi_script}'
258-
warning_text_path = "C:\uninstall_warning.txt"
259-
check_warning_file = 'type ${warning_text_path}'
260-
warning_message = 'Warning: all customized settings will be removed'
261252
- driver_update:
262253
only all_drivers
263254
type = win_virtio_driver_update_by_installer
Lines changed: 54 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
import time
21
import re
2+
import time
33

44
from virttest import error_context
5-
from virttest import utils_misc
65

7-
from provider.win_driver_installer_test import (install_gagent,
8-
uninstall_gagent,
9-
win_uninstall_all_drivers,
10-
win_installer_test,
11-
check_gagent_version,
12-
driver_check,
13-
run_installer_with_interaction)
6+
from provider.win_driver_installer_test import (
7+
check_gagent_version,
8+
driver_check,
9+
install_gagent,
10+
run_installer_with_interaction,
11+
uninstall_gagent,
12+
win_installer_test,
13+
win_uninstall_all_drivers,
14+
)
1415

1516

1617
@error_context.context_aware
@@ -48,71 +49,61 @@ def run(test, params, env):
4849
vm = env.get_vm(params["main_vm"])
4950
session = vm.wait_for_login()
5051

51-
expected_gagent_version = install_gagent(session, test,
52-
qemu_ga_pkg,
53-
gagent_install_cmd,
54-
gagent_pkg_info_cmd)
52+
expected_gagent_version = install_gagent(
53+
session, test, qemu_ga_pkg, gagent_install_cmd, gagent_pkg_info_cmd
54+
)
5555
uninstall_gagent(session, test, gagent_uninstall_cmd)
5656

5757
win_uninstall_all_drivers(session, test, params)
5858
session = vm.reboot(session)
5959

60-
session = run_installer_with_interaction(vm, session, test, params,
61-
run_install_cmd,
62-
copy_files_params=params)
60+
session = run_installer_with_interaction(
61+
vm, session, test, params, run_install_cmd, copy_files_params=params
62+
)
6363

6464
win_installer_test(session, test, params)
6565
check_gagent_version(session, test, gagent_pkg_info_cmd,
6666
expected_gagent_version)
6767
driver_check(session, test, params)
6868

69-
uninstall_method = params.get('uninstall_method', 'installer')
70-
error_context.context("Run uninstall test via %s" % uninstall_method,
71-
test.log.info)
72-
vm.send_key('meta_l-d')
69+
error_context.context(
70+
"Run virtio-win-guest-tools.exe uninstall test", test.log.info
71+
)
72+
vm.send_key("meta_l-d")
7373
time.sleep(30)
74-
75-
if uninstall_method == "msi":
76-
run_uninstall_cmd = utils_misc.set_winutils_letter(
77-
session, run_uninstall_cmd
78-
)
79-
session.cmd(run_uninstall_cmd)
80-
time.sleep(30)
81-
check_warning_file = params["check_warning_file"]
82-
output = session.cmd_output(check_warning_file)
83-
if params["warning_message"] not in output:
84-
test.fail("Not found expected warning message, the output is %s" % output)
85-
else:
86-
session = run_installer_with_interaction(vm, session,
87-
test, params,
88-
run_uninstall_cmd)
89-
s_check, o_check = session.cmd_status_output(installer_pkg_check_cmd)
90-
if s_check == 0:
91-
test.fail("Could not uninstall Virtio-win-guest-tools package "
92-
"in guest', detail: '%s'" % o_check)
93-
94-
error_context.context("Check if all drivers are uninstalled.",
95-
test.log.info)
96-
uninstalled_device = []
97-
device_name_list = ['VirtIO RNG Device', 'VirtIO Serial Driver',
98-
'VirtIO Balloon Driver', 'QEMU PVPanic Device',
99-
'VirtIO Input Driver',
100-
'Red Hat VirtIO Ethernet Adapter',
101-
'VirtIO FS Device', 'QEMU FwCfg Device']
102-
# viostor and vioscsi drivers can not uninstalled by installer
103-
for device_name in device_name_list:
104-
chk_cmd = params["vio_driver_chk_cmd"] % device_name[0:30]
105-
output = session.cmd_output(chk_cmd).strip()
106-
inf_name = re.findall(r"\.inf", output, re.I)
107-
if inf_name:
108-
uninstalled_device.append(device_name)
109-
if uninstalled_device:
110-
test.fail("%s uninstall failed" % uninstalled_device)
111-
112-
error_context.context("Check qemu-ga service.", test.log.info)
113-
gagent_status_cmd = 'sc query qemu-ga |findstr "RUNNING" '
114-
status = session.cmd_status(gagent_status_cmd)
115-
if status == 0:
116-
test.fail("qemu-ga service still running after uninstall")
74+
session = run_installer_with_interaction(
75+
vm, session, test, params, run_uninstall_cmd
76+
)
77+
s_check, o_check = session.cmd_status_output(installer_pkg_check_cmd)
78+
if s_check == 0:
79+
test.fail(
80+
"Could not uninstall Virtio-win-guest-tools package "
81+
"in guest, detail: '%s'" % o_check)
82+
error_context.context("Check if all drivers are uninstalled.", test.log.info)
83+
uninstalled_device = []
84+
device_name_list = [
85+
"VirtIO RNG Device",
86+
"VirtIO Serial Driver",
87+
"VirtIO Balloon Driver",
88+
"QEMU PVPanic Device",
89+
"VirtIO Input Driver",
90+
"Red Hat VirtIO Ethernet Adapter",
91+
"VirtIO FS Device",
92+
"QEMU FwCfg Device",
93+
]
94+
# viostor and vioscsi drivers can not be uninstalled by the installer
95+
for device_name in device_name_list:
96+
chk_cmd = params["vio_driver_chk_cmd"] % device_name[0:30]
97+
output = session.cmd_output(chk_cmd).strip()
98+
inf_name = re.findall(r"\.inf", output, re.I)
99+
if inf_name:
100+
uninstalled_device.append(device_name)
101+
if uninstalled_device:
102+
test.fail("%s uninstall failed" % uninstalled_device)
103+
error_context.context("Check qemu-ga service.", test.log.info)
104+
gagent_status_cmd = 'sc query qemu-ga |findstr "RUNNING" '
105+
status = session.cmd_status(gagent_status_cmd)
106+
if status == 0:
107+
test.fail("qemu-ga service still running after uninstall")
117108

118109
session.close()

0 commit comments

Comments
 (0)