Skip to content

Commit

Permalink
Merge pull request #4087 from heywji/remove_warning
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulYuuu authored Aug 7, 2024
2 parents 0edffcb + e56cb4b commit 895daca
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 72 deletions.
9 changes: 0 additions & 9 deletions qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,6 @@
driver_test_names = ''
type = win_virtio_driver_installer_uninstall
installer_pkg_check_cmd = 'wmic product get name |findstr "Virtio-win-driver-installer"'
variants:
- by_installer:
- by_msi:
required_virtio_win = [1.9.35.0, )
uninstall_method = msi
run_uninstall_cmd = 'WIN_UTILS:\AutoIt3_%PROCESSOR_ARCHITECTURE%.exe C:\${uninstall_msi_script}'
warning_text_path = "C:\uninstall_warning.txt"
check_warning_file = 'type ${warning_text_path}'
warning_message = 'Warning: all customized settings will be removed'
- driver_update:
only all_drivers
type = win_virtio_driver_update_by_installer
Expand Down
117 changes: 54 additions & 63 deletions qemu/tests/win_virtio_driver_installer_uninstall.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import time
import re
import time

from virttest import error_context
from virttest import utils_misc

from provider.win_driver_installer_test import (install_gagent,
uninstall_gagent,
win_uninstall_all_drivers,
win_installer_test,
check_gagent_version,
driver_check,
run_installer_with_interaction)
from provider.win_driver_installer_test import (
check_gagent_version,
driver_check,
install_gagent,
run_installer_with_interaction,
uninstall_gagent,
win_installer_test,
win_uninstall_all_drivers,
)


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

expected_gagent_version = install_gagent(session, test,
qemu_ga_pkg,
gagent_install_cmd,
gagent_pkg_info_cmd)
expected_gagent_version = install_gagent(
session, test, qemu_ga_pkg, gagent_install_cmd, gagent_pkg_info_cmd
)
uninstall_gagent(session, test, gagent_uninstall_cmd)

win_uninstall_all_drivers(session, test, params)
session = vm.reboot(session)

session = run_installer_with_interaction(vm, session, test, params,
run_install_cmd,
copy_files_params=params)
session = run_installer_with_interaction(
vm, session, test, params, run_install_cmd, copy_files_params=params
)

win_installer_test(session, test, params)
check_gagent_version(session, test, gagent_pkg_info_cmd,
expected_gagent_version)
driver_check(session, test, params)

uninstall_method = params.get('uninstall_method', 'installer')
error_context.context("Run uninstall test via %s" % uninstall_method,
test.log.info)
vm.send_key('meta_l-d')
error_context.context(
"Run virtio-win-guest-tools.exe uninstall test", test.log.info
)
vm.send_key("meta_l-d")
time.sleep(30)

if uninstall_method == "msi":
run_uninstall_cmd = utils_misc.set_winutils_letter(
session, run_uninstall_cmd
)
session.cmd(run_uninstall_cmd)
time.sleep(30)
check_warning_file = params["check_warning_file"]
output = session.cmd_output(check_warning_file)
if params["warning_message"] not in output:
test.fail("Not found expected warning message, the output is %s" % output)
else:
session = run_installer_with_interaction(vm, session,
test, params,
run_uninstall_cmd)
s_check, o_check = session.cmd_status_output(installer_pkg_check_cmd)
if s_check == 0:
test.fail("Could not uninstall Virtio-win-guest-tools package "
"in guest', detail: '%s'" % o_check)

error_context.context("Check if all drivers are uninstalled.",
test.log.info)
uninstalled_device = []
device_name_list = ['VirtIO RNG Device', 'VirtIO Serial Driver',
'VirtIO Balloon Driver', 'QEMU PVPanic Device',
'VirtIO Input Driver',
'Red Hat VirtIO Ethernet Adapter',
'VirtIO FS Device', 'QEMU FwCfg Device']
# viostor and vioscsi drivers can not uninstalled by installer
for device_name in device_name_list:
chk_cmd = params["vio_driver_chk_cmd"] % device_name[0:30]
output = session.cmd_output(chk_cmd).strip()
inf_name = re.findall(r"\.inf", output, re.I)
if inf_name:
uninstalled_device.append(device_name)
if uninstalled_device:
test.fail("%s uninstall failed" % uninstalled_device)

error_context.context("Check qemu-ga service.", test.log.info)
gagent_status_cmd = 'sc query qemu-ga |findstr "RUNNING" '
status = session.cmd_status(gagent_status_cmd)
if status == 0:
test.fail("qemu-ga service still running after uninstall")
session = run_installer_with_interaction(
vm, session, test, params, run_uninstall_cmd
)
s_check, o_check = session.cmd_status_output(installer_pkg_check_cmd)
if s_check == 0:
test.fail(
"Could not uninstall Virtio-win-guest-tools package "
"in guest, detail: '%s'" % o_check)
error_context.context("Check if all drivers are uninstalled.", test.log.info)
uninstalled_device = []
device_name_list = [
"VirtIO RNG Device",
"VirtIO Serial Driver",
"VirtIO Balloon Driver",
"QEMU PVPanic Device",
"VirtIO Input Driver",
"Red Hat VirtIO Ethernet Adapter",
"VirtIO FS Device",
"QEMU FwCfg Device",
]
# viostor and vioscsi drivers can not be uninstalled by the installer
for device_name in device_name_list:
chk_cmd = params["vio_driver_chk_cmd"] % device_name[0:30]
output = session.cmd_output(chk_cmd).strip()
inf_name = re.findall(r"\.inf", output, re.I)
if inf_name:
uninstalled_device.append(device_name)
if uninstalled_device:
test.fail("%s uninstall failed" % uninstalled_device)
error_context.context("Check qemu-ga service.", test.log.info)
gagent_status_cmd = 'sc query qemu-ga |findstr "RUNNING" '
status = session.cmd_status(gagent_status_cmd)
if status == 0:
test.fail("qemu-ga service still running after uninstall")

session.close()

0 comments on commit 895daca

Please sign in to comment.