Skip to content

Commit b11a025

Browse files
committed
win_virtio_driver_install_by_installer: support viomem test
Add supoport to test viomem related from the installer. Signed-off-by: menli <[email protected]>
1 parent e7bdede commit b11a025

4 files changed

+79
-5
lines changed

provider/win_driver_installer_test.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
from avocado.utils import process
88
from virttest import error_context, utils_disk, utils_misc, utils_net
9+
from virttest.utils_misc import normalize_data_size
910

10-
from provider import virtio_fs_utils, win_driver_utils
11+
from provider import virtio_fs_utils, virtio_mem_utils, win_driver_utils
1112
from provider.storage_benchmark import generate_instance
1213
from qemu.tests.virtio_serial_file_transfer import transfer_data
1314

@@ -25,6 +26,7 @@
2526
"netkvm",
2627
"vioinput",
2728
"fwcfg",
29+
"viomem",
2830
]
2931

3032
device_hwid_list = [
@@ -38,6 +40,7 @@
3840
'"PCI\\VEN_1AF4&DEV_1000" "PCI\\VEN_1AF4&DEV_1041"',
3941
'"PCI\\VEN_1AF4&DEV_1052"',
4042
'"ACPI\\VEN_QEMU&DEV_0002"',
43+
'"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"',
4144
]
4245

4346
device_name_list = [
@@ -51,6 +54,7 @@
5154
"Red Hat VirtIO Ethernet Adapter",
5255
"VirtIO Input Driver",
5356
"QEMU FwCfg Device",
57+
"VirtIO Viomem Driver",
5458
]
5559

5660

@@ -100,6 +104,10 @@ def win_uninstall_all_drivers(session, test, params):
100104
:param test: kvm test object
101105
:param params: the dict used for parameters.
102106
"""
107+
if not params.get("boot_with_viomem"):
108+
driver_name_list.remove("viomem")
109+
device_hwid_list.remove(r'"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"')
110+
device_name_list.remove("VirtIO Viomem Driver")
103111
devcon_path = params["devcon_path"]
104112
for driver_name, device_name, device_hwid in zip(
105113
driver_name_list, device_name_list, device_hwid_list
@@ -414,3 +422,27 @@ def fwcfg_test(test, params, vm):
414422
process.system("rm -rf %s" % dump_file, shell=True)
415423
if dump_size == 0:
416424
test.fail("The dump file is empty")
425+
426+
427+
def viomem_test(test, params, vm):
428+
"""
429+
Grow/shrink virtio-mem device.
430+
431+
:param test: kvm test object.
432+
:param params: the dict used for parameters.
433+
:param vm: vm object.
434+
"""
435+
threshold = params.get_numeric("threshold", target_type=float)
436+
for i, vmem_dev in enumerate(
437+
vm.devices.get_by_params({"driver": "virtio-mem-pci"})
438+
):
439+
device_id = vmem_dev.get_qid()
440+
requested_size_vmem = params.get("requested-size_test_vmem%d" % i)
441+
442+
for requested_size in requested_size_vmem.split():
443+
req_size_normalized = int(float(normalize_data_size(requested_size, "B")))
444+
vm.monitor.qom_set(device_id, "requested-size", req_size_normalized)
445+
time.sleep(30)
446+
virtio_mem_utils.check_memory_devices(
447+
device_id, requested_size, threshold, vm, test
448+
)

qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
gagent_install_cmd = "start /wait %s /quiet"
4646
gagent_pkg_info_cmd = 'wmic product where name="Qemu guest agent"'
4747
gagent_uninstall_cmd = "wmic product where name='Qemu guest agent' call uninstall"
48+
threshold = 0.025
4849
nic_model_nic1 = rtl8139
4950
q35:
5051
nic_model_nic1 = e1000e
@@ -97,10 +98,7 @@
9798
mem-path_mem1 = /dev/shm
9899
size_mem1 = 4G
99100
use_mem_mem1 = no
100-
share_mem = yes
101-
guest_numa_nodes = shm0
102-
numa_memdev_shm0 = mem-mem1
103-
numa_nodeid_shm0 = 0
101+
vm_mem_share = yes
104102
fs_binary_extra_options = " -o cache=auto"
105103
test_drivers = 'balloon viostor vioscsi viorng viofs'
106104
driver_test_name_viorng = 'rng'
@@ -112,6 +110,29 @@
112110
driver_test_name_balloon = "balloon"
113111
iozone_cmd_opitons = " -azR -r 64k -n 512M -g 1G -M -I -i 0 -i 1 -b iozone.xls -f %s:\testfile"
114112
read_rng_cmd = "WIN_UTILS:\\random_%PROCESSOR_ARCHITECTURE%.exe"
113+
variants:
114+
- with_viomem:
115+
no Host_RHEL.m6 Host_RHEL.m7 Host_RHEL.m8
116+
no i386
117+
# virtio-mem is not supported on 32-bit systems
118+
boot_with_viomem = yes
119+
driver_test_name_viomem = "viomem"
120+
required_virtio_win = [1.9.40.0, )
121+
maxmem_mem = 80G
122+
mem_devs = 'vmem0'
123+
vm_memdev_model_vmem0 = "virtio-mem"
124+
size_mem_vmem0 = 8G
125+
requested-size_memory_vmem0 = 1G
126+
memdev_memory_vmem0 = "mem-vmem0"
127+
requested-size_test_vmem0 = "4G 8G 0"
128+
test_drivers += ' viomem'
129+
driver_test_name_viomem = "viomem"
130+
- without_viomem:
131+
only i386
132+
# mainly to cover win10.i386 test without viomem
133+
required_virtio_win = [1.9.40.0, )
134+
- viomem_unsupported:
135+
required_virtio_win = (, 1.9.40.0]
115136
- single_driver:
116137
serials += " vs"
117138
serial_type_vs = virtserialport
@@ -227,6 +248,22 @@
227248
input_dev_bus_type_input1 = virtio
228249
input_dev_type_input1 = keyboard
229250
key_table_file = key_to_keycode_win.json
251+
- with_viomem:
252+
no Host_RHEL.m6 Host_RHEL.m7 Host_RHEL.m8
253+
no i386
254+
required_virtio_win = [1.9.40.0, )
255+
maxmem_mem = 80G
256+
mem_fixed = 4096
257+
mem_devs = 'vmem0'
258+
vm_memdev_model_vmem0 = "virtio-mem"
259+
size_mem_vmem0 = 8G
260+
requested-size_memory_vmem0 = 1G
261+
memdev_memory_vmem0 = "mem-vmem0"
262+
requested-size_test_vmem0 = "4G 8G 0"
263+
driver_name = "viomem"
264+
device_name = "VirtIO Viomem Driver"
265+
device_hwid = '"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"'
266+
driver_test_names = 'viomem'
230267
variants:
231268
- installer_version_check:
232269
only all_drivers

qemu/tests/win_virtio_driver_installer_uninstall.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ def run(test, params, env):
9494
"VirtIO FS Device",
9595
"QEMU FwCfg Device",
9696
]
97+
if params.get("boot_with_viomem", "no") == "yes":
98+
device_name_list.append("VirtIO Viomem Driver")
9799
# viostor and vioscsi drivers can not be uninstalled by the installer
98100
for device_name in device_name_list:
99101
chk_cmd = params["vio_driver_chk_cmd"] % device_name[0:30]

qemu/tests/win_virtio_driver_update_by_installer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ def check_network_config(session_serial):
120120
win_driver_installer_test.device_name_list,
121121
win_driver_installer_test.device_hwid_list,
122122
):
123+
if not params.get("boot_with_viomem"):
124+
if driver_name == "viomem":
125+
continue
123126
win_driver_utils.install_driver_by_virtio_media(
124127
session, test, devcon_path, media_type, driver_name, device_hwid
125128
)

0 commit comments

Comments
 (0)