Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtio_page_per_vq: enhance input event file #5882

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libvirt/tests/cfg/virtio/virtio_page_per_vq.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
- mouse:
- tablet:
- passthrough:
device_dict = {**${device_dict}, 'source_evdev': '/dev/input/event1'}
device_dict = {**${device_dict}, 'source_evdev': '%s'}
- video:
only default_start
device_dict = {'model_type': 'virtio', **${driver_dict}, 'model_heads': '1'}
Expand Down
22 changes: 22 additions & 0 deletions libvirt/tests/src/virtio/virtio_page_per_vq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import platform

from avocado.utils import process

from virttest import libvirt_version
from virttest import utils_net
from virttest import virsh
Expand All @@ -17,6 +19,24 @@
from virttest.utils_test import libvirt


def get_input_event_file(test):
"""
Get the input event file on the host

:return: str, the last file path if exists, otherwise skip the test
"""
ret = process.run("ls /dev/input/event*",
shell=True,
verbose=True,
ignore_status=True)
if ret.exit_status != 0:
if ret.stderr_text.count("No such file or directory"):
test.cancel(ret.stderr_text)
else:
test.fail(ret.stderr_text)
return ret.stdout_text.splitlines()[-1]


def run(test, params, env):
"""
Start guest with virtio page_per_vq attribute - various virtio devices
Expand Down Expand Up @@ -55,6 +75,8 @@ def prepare_test(vmxml):
device_dict['source']['attrs']['file'] = disk_image_path
if device_type == "input":
device_xml = eval(device_obj)(input_type)
if input_type == "passthrough":
device_dict['source_evdev'] = get_input_event_file(test)
else:
device_xml = eval(device_obj)()
device_xml.setup_attrs(**device_dict)
Expand Down
Loading