-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NetKVM: Add a case for checking the keyword in the driver logs
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
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
- netkvm_log_check: | ||
virt_test_type = qemu | ||
type = netkvm_log_check | ||
only q35 | ||
only Windows | ||
only virtio_net | ||
os_type = Windows | ||
vhost = on | ||
timeout = 360 | ||
smp ~= ${vcpu_maxcpus} | ||
queues = ${smp} | ||
SGT_msg = "Limit m_SGTableCapacity by 64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
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) Run `netkvmco.exe setparam 0 TXcapacity 64` in advance | ||
3) Do the filters to grab the "Limit m_SGTableCapacity by 64 using | ||
`TraceView.exe`" | ||
4) Run `netkvmco.exe restart 0` or "NIC disabled-enabled" | ||
5) Check the `TraceView.exe` monitor and get "Limit | ||
m_SGTableCapacity by 64" | ||
:param test: QEMU test object | ||
:param params: Dictionary with the test parameters | ||
:param env: Dictionary with test environment. | ||
""" | ||
|
||
def netkvmco_setting_and_checking(param_name, param_value): | ||
""" | ||
First, set the netkvm driver parameter 'param_name' to the value | ||
'param_value', and then verify the results. | ||
param param_name: the netkvm driver parameter to modify | ||
param param_value: the value to set to | ||
""" | ||
|
||
error_context.context("Start set %s to %s" % (param_name, | ||
param_value), test.log.info) | ||
utils_net.set_netkvm_param_value(vm, param_name, param_value) | ||
|
||
test.log.info("Check value after setting %s", param_name) | ||
cur_value = utils_net.get_netkvm_param_value(vm, param_name) | ||
if cur_value != param_value: | ||
err_msg = "Current value: %s is not equal to target value: %s" | ||
err_msg = err_msg % (cur_value, param_value) | ||
test.fail(err_msg) | ||
|
||
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 = float(params.get("login_timeout", 240)) | ||
vm_name = params['main_vm'] | ||
vm = env.get_vm(vm_name) | ||
vm.verify_alive() | ||
error_context.context("wji", test.log.info) | ||
session = vm.wait_for_serial_login(timeout=timeout) | ||
netkvmco_setting_and_checking("TXcapacity", "64") | ||
SGT_msg = params.get("SGT_msg") | ||
SGT_log_output = get_keyword_from_traceview(SGT_msg) | ||
if SGT_log_output != []: | ||
error_context.context( | ||
f"Found {SGT_msg} in the traceview log", test.log.info) | ||
session.close() |