Skip to content

Commit

Permalink
NetKVM: Add a case for checking the keyword in the driver logs
Browse files Browse the repository at this point in the history
Configure the driver with TX capacity of 64 (instead of default of 1024)
and check in the driver logs that the driver limit the SG
(scatter-gather) area " Limit m_SGTableCapacity by 64"

Signed-off-by: wji <[email protected]>
  • Loading branch information
heywji committed Sep 5, 2024
1 parent 1de0726 commit 5d0aadd
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
13 changes: 13 additions & 0 deletions qemu/tests/cfg/netkvm_log_check.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- netkvm_log_check:
virt_test_type = qemu
type = netkvm_log_check
only q35
only Windows
only virtio_net
vhost = on
timeout = 360
smp ~= ${vcpu_maxcpus}
queues = ${smp}
SGT_name = "TXcapacity"
SGT_value = 64
SGT_msg = "Limit m_SGTableCapacity by 64"
55 changes: 55 additions & 0 deletions qemu/tests/netkvm_log_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import re
from virttest import error_context
from virttest import utils_net


@error_context.context_aware
def run(test, params, env):
"""
Netkvm log checking using traceview:
1) Start the VM.
2) Configure and verify the advanced parameters of the NIC.
3) Use TraceView.exe to apply filters and capture relevant keywords.
4) Restart the NIC.
5) Monitor the output in TraceView.exe and extract the captured keywords.
:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""

def get_keyword_from_traceview(keyword):
"""
Get the keyword by `TraceView.exe`
Return the keywords which means that we found it.
"""

device_mac = vm.virtnet[0].mac
error_context.context(
f"Check {keyword} from the traceview", test.log.info)
output = utils_net.dump_traceview_log_windows(params, vm)
utils_net.restart_guest_network(session, device_mac, params["os_type"])
mapping_output = re.findall(keyword, output)
if mapping_output == []:
test.fail(f"Can't get {keyword} from traceview")
return mapping_output

timeout = params.get_numeric("login_timeout", 240)
vm_name = params['main_vm']
vm = env.get_vm(vm_name)
vm.verify_alive()
session = vm.wait_for_serial_login(timeout=timeout)
SGT_name = params.get("SGT_name")
SGT_value = params.get_numeric("SGT_value")
utils_net.set_netkvm_param_value(vm, SGT_name, SGT_value)
cur_value = utils_net.get_netkvm_param_value(vm, SGT_name)
if cur_value != SGT_value:
error_context.context(
f"Current value: {cur_value} is not equal to target value: {SGT_name}", test.log.info)
SGT_msg = params.get("SGT_msg")
SGT_log = get_keyword_from_traceview(SGT_msg)
error_context.context(
f"Found {SGT_log} from the traceview", test.log.info)
session.close()

0 comments on commit 5d0aadd

Please sign in to comment.