Skip to content

Commit cd180ed

Browse files
committed
virtio_win_installer: add pretest for installer
In the situation of only having installer related files, try to create a standard virtio-win iso and testing the basic install/uninstall/update function, qga and drivers version check. Signed-off-by: Xiaoling Gao <xiagao@redhat.com>
1 parent 3b392cb commit cd180ed

File tree

7 files changed

+448
-13
lines changed

7 files changed

+448
-13
lines changed

generic/tests/netperf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ def mtu_set(mtu):
168168
for driver_name in driver_name.split():
169169
inf_path = win_driver_utils.get_driver_inf_path(session, test,
170170
media_type,
171-
driver_name)
171+
driver_name,
172+
params)
172173
if driver_name == "netkvm":
173174
device_name = params.get("device_name")
174175
device_hwid = params.get("device_hwid")

provider/virtio_fs_utils.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,18 @@ def get_viofs_exe_path(test, params, session):
269269
exe_middle_path = ("{name}\\{arch}" if media_type == "iso"
270270
else "{arch}\\{name}").format(name=guest_name,
271271
arch=guest_arch)
272-
exe_file_name = "virtiofs.exe"
273-
exe_find_cmd = 'dir /b /s %s\\%s | findstr "\\%s\\\\"'
274-
exe_find_cmd %= (viowin_ltr, exe_file_name, exe_middle_path)
275-
exe_path = session.cmd(exe_find_cmd).strip()
272+
273+
exe_file_name = params.get("exe_file_name", "virtiofs.exe")
274+
common_exe_find_cmd = 'dir /b /s VIOWIN_LTR\\EXE_FILE_NAME |' \
275+
' findstr "\\EXE_MID_PATH\\\\"'
276+
exe_find_cmd = params.get("exe_find_cmd", common_exe_find_cmd)
277+
278+
exe_find_cmd_new = exe_find_cmd.replace(
279+
'VIOWIN_LTR', viowin_ltr).replace(
280+
'EXE_FILE_NAME', exe_file_name).replace(
281+
'EXE_MID_PATH', exe_middle_path)
282+
283+
exe_path = session.cmd(exe_find_cmd_new).strip()
276284
test.log.info("Found exe file '%s'", exe_path)
277285
return exe_path
278286

provider/win_driver_installer_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ def driver_check(session, test, params):
165165
error_context.context("%s Driver Check" % driver_name, LOG_JOB.info)
166166
inf_path = win_driver_utils.get_driver_inf_path(session, test,
167167
media_type,
168-
driver_name)
168+
driver_name,
169+
params)
169170
expected_ver = session.cmd("type %s | findstr /i /r DriverVer.*=" %
170171
inf_path, timeout=360)
171172
expected_ver = expected_ver.strip().split(",", 1)[-1]

provider/win_driver_utils.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,15 @@ def uninstall_driver(session, test, devcon_path, driver_name,
7979
"%s" % (driver_name, output))
8080

8181

82-
def get_driver_inf_path(session, test, media_type, driver_name):
82+
def get_driver_inf_path(session, test, media_type, driver_name, params):
8383
"""
8484
Get driver inf path from virtio win iso,such as E:\viofs\2k19\amd64.
8585
8686
:param session: The guest session object.
8787
:param test: kvm test object.
8888
:param media_type: media type.
8989
:param driver_name: driver name.
90+
:param params: the dict used for parameters
9091
"""
9192
try:
9293
get_drive_letter = getattr(virtio_win, "drive_letter_%s" % media_type)
@@ -108,16 +109,24 @@ def get_driver_inf_path(session, test, media_type, driver_name):
108109
inf_middle_path = ("{name}\\{arch}" if media_type == "iso"
109110
else "{arch}\\{name}").format(name=guest_name,
110111
arch=guest_arch)
111-
inf_find_cmd = 'dir /b /s %s\\%s.inf | findstr "\\%s\\\\"'
112-
inf_find_cmd %= (viowin_ltr, driver_name, inf_middle_path)
113-
inf_path = session.cmd(inf_find_cmd, timeout=OPERATION_TIMEOUT).strip()
112+
113+
common_inf_find_cmd = 'dir /b /s VIOWIN_LTR\\DRIVER_NAME.inf |'
114+
common_inf_find_cmd += ' findstr "\\INF_MID_PATH\\\\'
115+
inf_find_cmd = params.get("inf_find_cmd", common_inf_find_cmd)
116+
117+
inf_find_cmd_new = inf_find_cmd.replace(
118+
'VIOWIN_LTR', viowin_ltr).replace(
119+
'DRIVER_NAME', driver_name).replace(
120+
'INF_MID_PATH', inf_middle_path)
121+
122+
inf_path = session.cmd(inf_find_cmd_new, timeout=OPERATION_TIMEOUT).strip()
114123
LOG_JOB.info("Found inf file '%s'", inf_path)
115124
return inf_path
116125

117126

118127
@error_context.context_aware
119128
def install_driver_by_virtio_media(session, test, devcon_path, media_type,
120-
driver_name, device_hwid):
129+
driver_name, device_hwid, params):
121130
"""
122131
Install driver by virtio media.
123132
@@ -127,6 +136,7 @@ def install_driver_by_virtio_media(session, test, devcon_path, media_type,
127136
:param media_type: media type.
128137
:param driver_name: driver name.
129138
:param device_hwid: device hardware id.
139+
:param params: the dict used for parameters
130140
"""
131141
devcon_path = utils_misc.set_winutils_letter(session, devcon_path)
132142
status, output = session.cmd_status_output("dir %s" % devcon_path,
@@ -139,7 +149,8 @@ def install_driver_by_virtio_media(session, test, devcon_path, media_type,
139149
output = session.cmd_output("%s find %s" % (devcon_path, hwid))
140150
if re.search("No matching devices found", output, re.I):
141151
continue
142-
inf_path = get_driver_inf_path(session, test, media_type, driver_name)
152+
inf_path = get_driver_inf_path(session, test, media_type,
153+
driver_name, params)
143154
inst_cmd = "%s updateni %s %s" % (devcon_path, inf_path, hwid)
144155
status, output = session.cmd_status_output(inst_cmd, INSTALL_TIMEOUT)
145156
# acceptable status: OK(0), REBOOT(1)
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
- win_virtio_driver_installer_pretest:
2+
type = win_virtio_driver_installer_pretest
3+
only Windows
4+
virtio_win_media_type = iso
5+
cdroms += " virtio"
6+
clone_master = yes
7+
master_images_clone = image1
8+
remove_image_image1 = yes
9+
cd_format_fixed = ide
10+
drive_format_image1 = ide
11+
q35:
12+
cd_format_fixed = ahci
13+
drive_format_image1 = ahci
14+
vio_driver_chk_cmd = 'driverquery /si | find /i "%s"'
15+
chk_timeout = 240
16+
install_script_path = "WIN_UTILS:\install.au3"
17+
repair_script_path = "WIN_UTILS:\repaire.au3"
18+
uninstall_script_path = "WIN_UTILS:\uninstall.au3"
19+
run_install_cmd = 'WIN_UTILS:\AutoIt3_%PROCESSOR_ARCHITECTURE%.exe C:\install.au3'
20+
run_repair_cmd = 'WIN_UTILS:\AutoIt3_%PROCESSOR_ARCHITECTURE%.exe C:\repair.au3'
21+
run_uninstall_cmd = 'WIN_UTILS:\AutoIt3_%PROCESSOR_ARCHITECTURE%.exe C:\uninstall.au3'
22+
installer_pkg_check_cmd = 'wmic product get name |findstr "Virtio-win-driver-installer"'
23+
signed_check_cmd = 'wmic product where name="Virtio-win-driver-installer" | findstr "Red Hat, Inc."'
24+
monitor_type = qmp
25+
monitors = qmp1
26+
mem_stat_check_list = 'stat-free-memory'
27+
check_mem_diff = 300
28+
guest_compare_threshold = 300
29+
guest_mem_ratio = 0.025
30+
devcon_dirname = "win7_"
31+
i386:
32+
devcon_dirname += "x86"
33+
qemu_ga_pkg = qemu-ga-i386.msi
34+
msi_file = virtio-win-gt-x86.msi
35+
x86_64:
36+
devcon_dirname += "amd64"
37+
qemu_ga_pkg = qemu-ga-x86_64.msi
38+
msi_file = virtio-win-gt-x64.msi
39+
devcon_path = "WIN_UTILS:\devcon\${devcon_dirname}\devcon.exe"
40+
del devcon_dirname
41+
gagent_install_cmd = "start /wait %s /quiet"
42+
gagent_pkg_info_cmd = 'wmic product where name="Qemu guest agent"'
43+
gagent_uninstall_cmd = "wmic product where name='Qemu guest agent' call uninstall"
44+
nic_model_nic1 = rtl8139
45+
q35:
46+
nic_model_nic1 = e1000e
47+
# install winfsp tool
48+
i386, i686:
49+
install_winfsp_path = 'C:\Program Files'
50+
x86_64:
51+
install_winfsp_path = 'C:\Program Files (x86)'
52+
nics += " nic2"
53+
nic_model_nic2 = virtio
54+
no_virtio_rng:
55+
virtio_rngs += " rng0"
56+
backend_rng0 = rng-builtin
57+
backend_type = builtin
58+
images += " stg0 stg1"
59+
image_name_stg0 = "images/stg0"
60+
image_name_stg1 = "images/stg1"
61+
image_size_stg0 = 5G
62+
image_size_stg1 = 10G
63+
drive_format_stg0 = virtio
64+
drive_format_stg1 = scsi-hd
65+
remove_image_stg0 = yes
66+
remove_image_stg1 = yes
67+
force_create_image_stg0 = yes
68+
force_create_image_stg1 = yes
69+
serials += " vs"
70+
serial_type_vs = virtserialport
71+
balloon = balloon0
72+
balloon_dev_devid = balloon0
73+
balloon_dev_add_bus = yes
74+
install_balloon_service = "%s:\Balloon\blnsvr.exe -i"
75+
uninstall_balloon_service = "%s:\Balloon\blnsvr.exe -u"
76+
status_balloon_service = "%s:\Balloon\blnsvr.exe status"
77+
run_balloon_service = "%s:\Balloon\blnsvr.exe -r"
78+
stop_balloon_service = "%s:\Balloon\blnsvr.exe -s"
79+
inputs = input1
80+
input_dev_bus_type_input1 = virtio
81+
input_dev_type_input1 = mouse
82+
vmcoreinfo = yes
83+
filesystems = fs
84+
fs_driver = virtio-fs
85+
fs_source_type = mount
86+
fs_source_dir = virtio_fs_test/
87+
force_create_fs_source = yes
88+
remove_fs_source = yes
89+
fs_target = 'myfs'
90+
fs_driver_props = {"queue-size": 1024}
91+
mem_devs = mem1
92+
backend_mem_mem1 = memory-backend-file
93+
mem-path_mem1 = /dev/shm
94+
size_mem1 = ${mem}M
95+
use_mem_mem1 = no
96+
share_mem = yes
97+
guest_numa_nodes = shm0
98+
numa_memdev_shm0 = mem-mem1
99+
numa_nodeid_shm0 = 0
100+
fs_binary_extra_options = " -o cache=auto"
101+
test_drivers = 'viorng viostor vioscsi viofs balloon'
102+
driver_test_name_viorng = 'rng'
103+
driver_test_name_viostor = 'iozone'
104+
driver_test_params_viostor = {'images': 'stg0'}
105+
driver_test_name_vioscsi = 'iozone'
106+
driver_test_params_vioscsi = {'images': 'stg1'}
107+
driver_test_name_viofs = "viofs_basic_io"
108+
driver_test_name_balloon = "balloon"
109+
iozone_cmd_opitons = " -azR -r 64k -n 512M -g 1G -M -I -i 0 -i 1 -b iozone.xls -f %s:\testfile"
110+
read_rng_cmd = "WIN_UTILS:\\random_%PROCESSOR_ARCHITECTURE%.exe"
111+
driver_test_names = 'balloon viofs_basic_io'
112+
exe_file_name = "virtiofs.exe"
113+
exe_find_cmd = 'dir /b /s VIOWIN_LTR\EXE_FILE_NAME'
114+
inf_find_cmd = 'dir /b /s VIOWIN_LTR\DRIVER_NAME.inf'
115+
cdrom_virtio = '/home/virtio-win-pretest.iso'
116+
variants:
117+
- create_iso:
118+
create_iso = yes
119+
driver_folder_name = Virtio-Win
120+
guest_path = "C:\Program Files\${driver_folder_name}\*"
121+
host_installer_path = "/home/installer/"
122+
mkiso_cmd = "mkisofs -o ${cdrom_virtio} -input-charset iso8859-1 -J -R -V "Virtio-Win" ${host_installer_path}"
123+
- install_uninstall:
124+
install_uninstall_test = yes
125+
- update:
126+
update_test = yes
127+
static_ip = 192.168.0.11
128+
static_mask = 255.255.255.0
129+
static_gateway = 192.168.0.5
130+
static_dns = 192.168.0.1
131+
setup_ip_cmd = 'netsh interface ip set address "%s" static ${static_ip} ${static_mask} ${static_gateway}'
132+
setup_dns_cmd = 'netsh interface ip add dns "%s" ${static_dns} validate=no'
133+
- repair:
134+
repair_test = yes
135+
msi_uninstall_cmd = "msiexec.exe /q /passive /x %s"

0 commit comments

Comments
 (0)