Skip to content

Commit c90065f

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 fb68299 commit c90065f

File tree

7 files changed

+335
-11
lines changed

7 files changed

+335
-11
lines changed

generic/tests/netperf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ def mtu_set(mtu):
144144
for driver_name in driver_name.split():
145145
inf_path = win_driver_utils.get_driver_inf_path(session, test,
146146
media_type,
147-
driver_name)
147+
driver_name,
148+
params)
148149
if driver_name == "netkvm":
149150
device_name = params.get("device_name")
150151
device_hwid = params.get("device_hwid")

provider/virtio_fs_utils.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,15 @@ def get_viofs_exe_path(test, params, session):
268268
exe_middle_path = ("{name}\\{arch}" if media_type == "iso"
269269
else "{arch}\\{name}").format(name=guest_name,
270270
arch=guest_arch)
271-
exe_file_name = "virtiofs.exe"
272-
exe_find_cmd = 'dir /b /s %s\\%s | findstr "\\%s\\\\"'
273-
exe_find_cmd %= (viowin_ltr, exe_file_name, exe_middle_path)
271+
272+
exe_file_name = params.get("exe_file_name", "virtiofs.exe")
273+
common_exe_find_cmd = 'dir /b /s VIOWIN_LTR\\EXE_FILE_NAME |' \
274+
' findstr "\\EXE_MID_PATH\\\\"'
275+
exe_find_cmd = params.get("exe_find_cmd", common_exe_find_cmd)
276+
exe_find_cmd.replace('VIOWIN_LTR', viowin_ltr).\
277+
replace('EXE_FILE_NAME', exe_file_name).\
278+
replace('EXE_MID_PATH', exe_middle_path)
279+
274280
exe_path = session.cmd(exe_find_cmd).strip()
275281
test.log.info("Found exe file '%s'", exe_path)
276282
return exe_path

provider/win_driver_installer_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ def driver_check(session, test, params):
162162
error_context.context("%s Driver Check" % driver_name, LOG_JOB.info)
163163
inf_path = win_driver_utils.get_driver_inf_path(session, test,
164164
media_type,
165-
driver_name)
165+
driver_name,
166+
params)
166167
expected_ver = session.cmd("type %s | findstr /i /r DriverVer.*=" %
167168
inf_path, timeout=360)
168169
expected_ver = expected_ver.strip().split(",", 1)[-1]

provider/win_driver_utils.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,15 @@ def uninstall_driver(session, test, devcon_path, driver_name,
7474
"%s" % (driver_name, output))
7575

7676

77-
def get_driver_inf_path(session, test, media_type, driver_name):
77+
def get_driver_inf_path(session, test, media_type, driver_name, params):
7878
"""
7979
Get driver inf path from virtio win iso,such as E:\viofs\2k19\amd64.
8080
8181
:param session: The guest session object.
8282
:param test: kvm test object.
8383
:param media_type: media type.
8484
:param driver_name: driver name.
85+
:param params: the dict used for parameters
8586
"""
8687
try:
8788
get_drive_letter = getattr(virtio_win, "drive_letter_%s" % media_type)
@@ -103,16 +104,22 @@ def get_driver_inf_path(session, test, media_type, driver_name):
103104
inf_middle_path = ("{name}\\{arch}" if media_type == "iso"
104105
else "{arch}\\{name}").format(name=guest_name,
105106
arch=guest_arch)
106-
inf_find_cmd = 'dir /b /s %s\\%s.inf | findstr "\\%s\\\\"'
107-
inf_find_cmd %= (viowin_ltr, driver_name, inf_middle_path)
107+
108+
common_inf_find_cmd = 'dir /b /s VIOWIN_LTR\\DRIVER_NAME.inf |' \
109+
' findstr "\\INF_MIDDLE_PATH\\\\'
110+
inf_find_cmd = params.get("inf_find_cmd", common_inf_find_cmd)
111+
inf_find_cmd.replace('VIOWIN_LTR', viowin_ltr).\
112+
replace('DRIVER_NAME', driver_name).\
113+
replace('INF_MID_PATH', inf_middle_path)
114+
108115
inf_path = session.cmd(inf_find_cmd, timeout=OPERATION_TIMEOUT).strip()
109116
LOG_JOB.info("Found inf file '%s'", inf_path)
110117
return inf_path
111118

112119

113120
@error_context.context_aware
114121
def install_driver_by_virtio_media(session, test, devcon_path, media_type,
115-
driver_name, device_hwid):
122+
driver_name, device_hwid, params):
116123
"""
117124
Install driver by virtio media.
118125
@@ -122,6 +129,7 @@ def install_driver_by_virtio_media(session, test, devcon_path, media_type,
122129
:param media_type: media type.
123130
:param driver_name: driver name.
124131
:param device_hwid: device hardware id.
132+
:param params: the dict used for parameters
125133
"""
126134
devcon_path = utils_misc.set_winutils_letter(session, devcon_path)
127135
status, output = session.cmd_status_output("dir %s" % devcon_path,
@@ -134,7 +142,8 @@ def install_driver_by_virtio_media(session, test, devcon_path, media_type,
134142
output = session.cmd_output("%s find %s" % (devcon_path, hwid))
135143
if re.search("No matching devices found", output, re.I):
136144
continue
137-
inf_path = get_driver_inf_path(session, test, media_type, driver_name)
145+
inf_path = get_driver_inf_path(session, test, media_type,
146+
driver_name, params)
138147
inst_cmd = "%s updateni %s %s" % (devcon_path, inf_path, hwid)
139148
status, output = session.cmd_status_output(inst_cmd, INSTALL_TIMEOUT)
140149
# acceptable status: OK(0), REBOOT(1)
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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:\repaire.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+
x86_64:
35+
devcon_dirname += "amd64"
36+
qemu_ga_pkg = qemu-ga-x86_64.msi
37+
devcon_path = "WIN_UTILS:\devcon\${devcon_dirname}\devcon.exe"
38+
del devcon_dirname
39+
gagent_install_cmd = "start /wait %s /quiet"
40+
gagent_pkg_info_cmd = 'wmic product where name="Qemu guest agent"'
41+
gagent_uninstall_cmd = "wmic product where name='Qemu guest agent' call uninstall"
42+
nic_model_nic1 = rtl8139
43+
q35:
44+
nic_model_nic1 = e1000e
45+
# install winfsp tool
46+
i386, i686:
47+
install_winfsp_path = 'C:\Program Files'
48+
x86_64:
49+
install_winfsp_path = 'C:\Program Files (x86)'
50+
nics += " nic2"
51+
nic_model_nic2 = virtio
52+
no_virtio_rng:
53+
virtio_rngs += " rng0"
54+
backend_rng0 = rng-builtin
55+
backend_type = builtin
56+
images += " stg0 stg1"
57+
image_name_stg0 = "images/stg0"
58+
image_name_stg1 = "images/stg1"
59+
image_size_stg0 = 5G
60+
image_size_stg1 = 10G
61+
drive_format_stg0 = virtio
62+
drive_format_stg1 = scsi-hd
63+
remove_image_stg0 = yes
64+
remove_image_stg1 = yes
65+
force_create_image_stg0 = yes
66+
force_create_image_stg1 = yes
67+
serials += " vs"
68+
serial_type_vs = virtserialport
69+
balloon = balloon0
70+
balloon_dev_devid = balloon0
71+
balloon_dev_add_bus = yes
72+
install_balloon_service = "%s:\Balloon\blnsvr.exe -i"
73+
uninstall_balloon_service = "%s:\Balloon\blnsvr.exe -u"
74+
status_balloon_service = "%s:\Balloon\blnsvr.exe status"
75+
run_balloon_service = "%s:\Balloon\blnsvr.exe -r"
76+
stop_balloon_service = "%s:\Balloon\blnsvr.exe -s"
77+
inputs = input1
78+
input_dev_bus_type_input1 = virtio
79+
input_dev_type_input1 = mouse
80+
vmcoreinfo = yes
81+
filesystems = fs
82+
fs_driver = virtio-fs
83+
fs_source_type = mount
84+
fs_source_dir = virtio_fs_test/
85+
force_create_fs_source = yes
86+
remove_fs_source = yes
87+
fs_target = 'myfs'
88+
fs_driver_props = {"queue-size": 1024}
89+
mem = 4096
90+
mem_devs = mem1
91+
backend_mem_mem1 = memory-backend-file
92+
mem-path_mem1 = /dev/shm
93+
size_mem1 = 4G
94+
use_mem_mem1 = no
95+
share_mem = yes
96+
guest_numa_nodes = shm0
97+
numa_memdev_shm0 = mem-mem1
98+
numa_nodeid_shm0 = 0
99+
fs_binary_extra_options = " -o cache=auto"
100+
test_drivers = 'viorng viostor vioscsi viofs balloon'
101+
driver_test_name_viorng = 'rng'
102+
driver_test_name_viostor = 'iozone'
103+
driver_test_params_viostor = {'images': 'stg0'}
104+
driver_test_name_vioscsi = 'iozone'
105+
driver_test_params_vioscsi = {'images': 'stg1'}
106+
driver_test_name_viofs = "viofs_basic_io"
107+
driver_test_name_balloon = "balloon"
108+
iozone_cmd_opitons = " -azR -r 64k -n 512M -g 1G -M -I -i 0 -i 1 -b iozone.xls -f %s:\testfile"
109+
read_rng_cmd = "WIN_UTILS:\\random_%PROCESSOR_ARCHITECTURE%.exe"
110+
driver_test_names = 'balloon viofs_basic_io'
111+
exe_file_name = "virtiofs.exe"
112+
exe_find_cmd = 'dir /b /s VIOWIN_LTR\\EXE_FILE_NAME'
113+
inf_find_cmd = 'dir /b /s VIOWIN_LTR\\DRIVER_NAME.inf'
114+
variants:
115+
- create_iso:
116+
create_iso = yes
117+
driver_folder_name = Virtio-Win
118+
guest_path = "C:\Program Files\${driver_folder_name}\*"
119+
host_installer_file = "/home/installer"
120+
host_iso_path = "/home/virtio-win-iso/"
121+
mkiso_cmd = "mkisofs -o /home/virtio-win-pretest.iso -input-charset iso8859-1 -J -R -V "Virtio-Win" ${host_iso_path}"
122+
- install_uninstall:
123+
install_uninstall_test = yes
124+
- update:
125+
update_test = yes

0 commit comments

Comments
 (0)