Skip to content

Commit

Permalink
win_virtio_driver_install_by_installer: support viomem test
Browse files Browse the repository at this point in the history
Add supoport to test viomem related from
the installer.

Signed-off-by: menli <[email protected]>
  • Loading branch information
menli820 committed Dec 24, 2024
1 parent e7bdede commit 6eab70e
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 5 deletions.
34 changes: 33 additions & 1 deletion provider/win_driver_installer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

from avocado.utils import process
from virttest import error_context, utils_disk, utils_misc, utils_net
from virttest.utils_misc import normalize_data_size

from provider import virtio_fs_utils, win_driver_utils
from provider import virtio_fs_utils, virtio_mem_utils, win_driver_utils
from provider.storage_benchmark import generate_instance
from qemu.tests.virtio_serial_file_transfer import transfer_data

Expand All @@ -25,6 +26,7 @@
"netkvm",
"vioinput",
"fwcfg",
"viomem",
]

device_hwid_list = [
Expand All @@ -38,6 +40,7 @@
'"PCI\\VEN_1AF4&DEV_1000" "PCI\\VEN_1AF4&DEV_1041"',
'"PCI\\VEN_1AF4&DEV_1052"',
'"ACPI\\VEN_QEMU&DEV_0002"',
r'"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"',
]

device_name_list = [
Expand All @@ -51,6 +54,7 @@
"Red Hat VirtIO Ethernet Adapter",
"VirtIO Input Driver",
"QEMU FwCfg Device",
"VirtIO Viomem Driver",
]


Expand Down Expand Up @@ -100,6 +104,10 @@ def win_uninstall_all_drivers(session, test, params):
:param test: kvm test object
:param params: the dict used for parameters.
"""
if not params.get("boot_with_viomem"):
driver_name_list.remove("viomem")
device_hwid_list.remove(r'"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"')
device_name_list.remove("VirtIO Viomem Driver")
devcon_path = params["devcon_path"]
for driver_name, device_name, device_hwid in zip(
driver_name_list, device_name_list, device_hwid_list
Expand Down Expand Up @@ -414,3 +422,27 @@ def fwcfg_test(test, params, vm):
process.system("rm -rf %s" % dump_file, shell=True)
if dump_size == 0:
test.fail("The dump file is empty")


def viomem_test(test, params, vm):
"""
Grow/shrink virtio-mem device.
:param test: kvm test object.
:param params: the dict used for parameters.
:param vm: vm object.
"""
threshold = params.get_numeric("threshold", target_type=float)
for i, vmem_dev in enumerate(
vm.devices.get_by_params({"driver": "virtio-mem-pci"})
):
device_id = vmem_dev.get_qid()
requested_size_vmem = params.get("requested-size_test_vmem%d" % i)

for requested_size in requested_size_vmem.split():
req_size_normalized = int(float(normalize_data_size(requested_size, "B")))
vm.monitor.qom_set(device_id, "requested-size", req_size_normalized)
time.sleep(30)
virtio_mem_utils.check_memory_devices(
device_id, requested_size, threshold, vm, test
)
41 changes: 37 additions & 4 deletions qemu/tests/cfg/win_virtio_driver_install_by_installer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
gagent_install_cmd = "start /wait %s /quiet"
gagent_pkg_info_cmd = 'wmic product where name="Qemu guest agent"'
gagent_uninstall_cmd = "wmic product where name='Qemu guest agent' call uninstall"
threshold = 0.025
nic_model_nic1 = rtl8139
q35:
nic_model_nic1 = e1000e
Expand Down Expand Up @@ -97,10 +98,7 @@
mem-path_mem1 = /dev/shm
size_mem1 = 4G
use_mem_mem1 = no
share_mem = yes
guest_numa_nodes = shm0
numa_memdev_shm0 = mem-mem1
numa_nodeid_shm0 = 0
vm_mem_share = yes
fs_binary_extra_options = " -o cache=auto"
test_drivers = 'balloon viostor vioscsi viorng viofs'
driver_test_name_viorng = 'rng'
Expand All @@ -112,6 +110,25 @@
driver_test_name_balloon = "balloon"
iozone_cmd_opitons = " -azR -r 64k -n 512M -g 1G -M -I -i 0 -i 1 -b iozone.xls -f %s:\testfile"
read_rng_cmd = "WIN_UTILS:\\random_%PROCESSOR_ARCHITECTURE%.exe"
x86_64:
# virtio-mem is not supported on 32-bit systems
# and viomem is supported from virtio-win-1.9.40-0.el9_4.iso
boot_with_viomem = yes
driver_test_name_viomem = "viomem"
maxmem_mem = 80G
mem_devs = 'vmem0'
vm_memdev_model_vmem0 = "virtio-mem"
size_mem_vmem0 = 8G
requested-size_memory_vmem0 = 1G
memdev_memory_vmem0 = "mem-vmem0"
requested-size_test_vmem0 = "4G 8G 0"
test_drivers += ' viomem'
driver_test_name_viomem = "viomem"
i386:
# mainly to cover win10.i386 test without viomem
boot_with_viomem = no
Host_RHEL.m7, Host_RHEL.m8, Host_RHEL.m9.u0, Host_RHEL.m9.u1, Host_RHEL.m9.u2, Host_RHEL.m9.u3, Host_RHEL.m9.u4:
boot_with_viomem = no
- single_driver:
serials += " vs"
serial_type_vs = virtserialport
Expand Down Expand Up @@ -227,6 +244,22 @@
input_dev_bus_type_input1 = virtio
input_dev_type_input1 = keyboard
key_table_file = key_to_keycode_win.json
- with_viomem:
no Host_RHEL.m6 Host_RHEL.m7 Host_RHEL.m8
no i386
required_virtio_win = [1.9.40.0, )
maxmem_mem = 80G
mem_fixed = 4096
mem_devs = 'vmem0'
vm_memdev_model_vmem0 = "virtio-mem"
size_mem_vmem0 = 8G
requested-size_memory_vmem0 = 1G
memdev_memory_vmem0 = "mem-vmem0"
requested-size_test_vmem0 = "4G 8G 0"
driver_name = "viomem"
device_name = "VirtIO Viomem Driver"
device_hwid = '"PCI\VEN_1AF4&DEV_1002" "PCI\VEN_1AF4&DEV_1058"'
driver_test_names = 'viomem'
variants:
- installer_version_check:
only all_drivers
Expand Down
2 changes: 2 additions & 0 deletions qemu/tests/win_virtio_driver_installer_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def run(test, params, env):
"VirtIO FS Device",
"QEMU FwCfg Device",
]
if params.get("boot_with_viomem", "no") == "yes":
device_name_list.append("VirtIO Viomem Driver")
# 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]
Expand Down
3 changes: 3 additions & 0 deletions qemu/tests/win_virtio_driver_update_by_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def check_network_config(session_serial):
win_driver_installer_test.device_name_list,
win_driver_installer_test.device_hwid_list,
):
if not params.get("boot_with_viomem"):
if driver_name == "viomem":
continue
win_driver_utils.install_driver_by_virtio_media(
session, test, devcon_path, media_type, driver_name, device_hwid
)
Expand Down

0 comments on commit 6eab70e

Please sign in to comment.