|
1 |
| -import time |
2 | 1 | import re
|
| 2 | +import time |
3 | 3 |
|
4 | 4 | from virttest import error_context
|
5 |
| -from virttest import utils_misc |
6 | 5 |
|
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 | +) |
14 | 15 |
|
15 | 16 |
|
16 | 17 | @error_context.context_aware
|
@@ -48,71 +49,61 @@ def run(test, params, env):
|
48 | 49 | vm = env.get_vm(params["main_vm"])
|
49 | 50 | session = vm.wait_for_login()
|
50 | 51 |
|
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 | + ) |
55 | 55 | uninstall_gagent(session, test, gagent_uninstall_cmd)
|
56 | 56 |
|
57 | 57 | win_uninstall_all_drivers(session, test, params)
|
58 | 58 | session = vm.reboot(session)
|
59 | 59 |
|
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 | + ) |
63 | 63 |
|
64 | 64 | win_installer_test(session, test, params)
|
65 | 65 | check_gagent_version(session, test, gagent_pkg_info_cmd,
|
66 | 66 | expected_gagent_version)
|
67 | 67 | driver_check(session, test, params)
|
68 | 68 |
|
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") |
73 | 73 | 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") |
117 | 108 |
|
118 | 109 | session.close()
|
0 commit comments