Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
051f8788
T
tp-qemu
项目概览
openeuler
/
tp-qemu
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tp-qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
051f8788
编写于
12月 11, 2019
作者:
L
Longxiang Lyu
提交者:
GitHub
12月 11, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1961 from kimi1978wy/1479119
Add windows support for Scatter/Gather I/O Test
上级
10a6d5af
acd5c87f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
228 addition
and
0 deletion
+228
-0
qemu/tests/cfg/enable_scatter_windows.cfg
qemu/tests/cfg/enable_scatter_windows.cfg
+26
-0
qemu/tests/enable_scatter_windows.py
qemu/tests/enable_scatter_windows.py
+202
-0
未找到文件。
qemu/tests/cfg/enable_scatter_windows.cfg
0 → 100644
浏览文件 @
051f8788
- enable_scatter_windows:
only Windows
type = enable_scatter_windows
filesize = 50
clean_cmd = del
image_snapshot = yes
cdroms += " virtio"
check_proc_temp = 'tasklist /fi "IMAGENAME eq %s"'
installed_path = "C:\Program Files\Wireshark\tshark.exe"
check_installed_cmd = 'dir "${installed_path}"|findstr /I tshark.exe'
x86_64:
wireshark_name = "Wireshark-win64-1.10.1.exe"
i386, i686:
wireshark_name = "Wireshark-win32-1.10.1.exe"
install_wireshark_cmd = "xcopy WIN_UTILS:\${wireshark_name} c:\ /y && c:\${wireshark_name} /S"
autoit_name = "AutoIt3_%PROCESSOR_ARCHITECTURE%.exe"
install_winpcap_cmd = "WIN_UTILS:\${autoit_name} WIN_UTILS:\install_winpcap.au3"
param_names = "Offload.TxLSO Offload.TxLSO MTU"
param_values = "1 0 1000"
run_wireshark_temp = 'start "" "${installed_path}" -n -w c:\temp.pcapng tcp and dst %s and src %s'
stop_wireshark_cmd = "taskkill /im tshark.exe /f"
parse_log_temp = '"${installed_path}" -2 -r c:\temp.pcapng -R "%s"'
qemu/tests/enable_scatter_windows.py
0 → 100644
浏览文件 @
051f8788
import
logging
import
time
from
virttest
import
utils_test
from
virttest
import
error_context
from
virttest
import
utils_net
from
virttest
import
utils_misc
from
virttest.utils_windows
import
virtio_win
@
error_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Change certain netkvm driver parameter value and
check the setting result.
1) start vm
2) check and install wireshark and winpcap
3) enable netkvm driver TxLSO
4) start file transfer and use wireshark to log traffic,
some packets length should over 1514
5) disable TxLSO and set MTU to 1000
6) start file transfer and log file transfer traffic again,
no packet length should over 1014
param test: the test object
param params: the test params
param env: test environment
"""
def
_is_process_finished
(
session
,
process_name
):
"""
Check whether the target process is finished running
param session: a guest session to send command
param process_name: the target process name
return: True if process does not exists,
False if still exists
"""
check_proc_cmd
=
check_proc_temp
%
process_name
status
,
output
=
session
.
cmd_status_output
(
check_proc_cmd
)
if
status
:
return
False
return
process_name
not
in
output
def
_start_wireshark_session
():
"""
Start a wireshark session and log network traffic to a file
"""
error_context
.
context
(
"Start wireshark session"
,
logging
.
info
)
session_serial
=
vm
.
wait_for_serial_login
(
timeout
=
timeout
)
guest_ip
=
vm
.
get_address
()
try
:
run_wireshark_cmd
=
run_wireshark_temp
%
(
host_ip
,
guest_ip
)
status
,
output
=
session_serial
.
cmd_status_output
(
run_wireshark_cmd
,
timeout
=
timeout
)
if
status
:
test
.
error
(
"Failed to start wireshark session, "
"status=%s, output=%s"
%
(
status
,
output
))
is_started
=
utils_misc
.
wait_for
(
lambda
:
not
_is_process_finished
(
session_serial
,
"tshark.exe"
),
20
,
5
,
1
)
if
not
is_started
:
test
.
error
(
"Timeout when wait for wireshark start"
)
finally
:
session_serial
.
close
()
def
_stop_wireshark_session
():
"""
Stop the running wireshark session
"""
error_context
.
context
(
"Stop wireshark"
,
logging
.
info
)
status
,
output
=
session
.
cmd_status_output
(
stop_wireshark_cmd
,
timeout
=
timeout
)
if
status
:
test
.
error
(
"Failed to stop wireshark: status=%s, output=%s"
%
(
status
,
output
))
def
_parse_log_file
(
packet_filter
):
"""
Parse the log file generated by the previous wireshark session.
param packet_filter: the filter to apply when dump packets
return: the output of the parse result
"""
error_context
.
context
(
"Parse wireshark log file"
,
logging
.
info
)
parse_log_cmd
=
parse_log_temp
%
packet_filter
status
,
output
=
session
.
cmd_status_output
(
parse_log_cmd
,
timeout
=
timeout
)
if
status
:
test
.
error
(
"Failed to parse session log file,"
" status=%s, output=%s"
%
(
status
,
output
))
return
output
def
_get_traffic_log
(
packet_filter
):
"""
Use wireshark to log the file transfer network traffic,
and return the packets dump output.
param packet_filter: the filter to apply when dump packets
return: the output of the parse result
"""
_start_wireshark_session
()
error_context
.
context
(
"Start file transfer"
,
logging
.
info
)
utils_test
.
run_file_transfer
(
test
,
params
,
env
)
time
.
sleep
(
30
)
_stop_wireshark_session
()
return
_parse_log_file
(
packet_filter
)
def
_set_driver_param
(
index
):
"""
set the netkvm driver param's value.
param index: the index of the list of target params
"""
param_name
=
param_names
[
index
]
param_value
=
param_values
[
index
]
utils_net
.
set_netkvm_param_value
(
vm
,
param_name
,
param_value
)
timeout
=
params
.
get
(
"timeout"
,
360
)
driver_name
=
params
.
get
(
"driver_name"
,
"netkvm"
)
wireshark_name
=
params
.
get
(
"wireshark_name"
)
run_wireshark_temp
=
params
.
get
(
"run_wireshark_temp"
)
stop_wireshark_cmd
=
params
.
get
(
"stop_wireshark_cmd"
)
check_proc_temp
=
params
.
get
(
"check_proc_temp"
)
parse_log_temp
=
params
.
get
(
"parse_log_temp"
)
param_names
=
params
.
get
(
"param_names"
).
split
()
param_values
=
params
.
get
(
"param_values"
).
split
()
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
host_ip
=
utils_net
.
get_host_ip_address
(
params
)
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
# make sure to enter desktop
vm
.
send_key
(
'meta_l-d'
)
time
.
sleep
(
30
)
error_context
.
context
(
"Check if the driver is installed and "
"verified"
,
logging
.
info
)
session
=
utils_test
.
qemu
.
windrv_check_running_verifier
(
session
,
vm
,
test
,
driver_name
,
timeout
)
error_context
.
context
(
"Install winpcap"
,
logging
.
info
)
install_winpcap_cmd
=
params
.
get
(
"install_winpcap_cmd"
)
install_winpcap_cmd
=
utils_misc
.
set_winutils_letter
(
session
,
install_winpcap_cmd
)
status
,
output
=
session
.
cmd_status_output
(
install_winpcap_cmd
,
timeout
=
timeout
)
if
status
:
test
.
error
(
"Failed to install pcap, status=%s, output=%s"
%
(
status
,
output
))
logging
.
info
(
"Wait for pcap installation to complete"
)
autoit_name
=
params
.
get
(
"autoit_name"
)
utils_misc
.
wait_for
(
lambda
:
_is_process_finished
(
session
,
autoit_name
),
timeout
,
20
,
3
)
error_context
.
context
(
"Check if wireshark is installed"
,
logging
.
info
)
check_installed_cmd
=
params
.
get
(
"check_installed_cmd"
)
check_result
=
session
.
cmd_output
(
check_installed_cmd
)
if
"tshark"
not
in
check_result
:
error_context
.
context
(
"Install wireshark"
,
logging
.
info
)
install_wireshark_cmd
=
params
.
get
(
"install_wireshark_cmd"
)
install_wireshark_cmd
=
utils_misc
.
set_winutils_letter
(
session
,
install_wireshark_cmd
)
status
,
output
=
session
.
cmd_status_output
(
install_wireshark_cmd
,
timeout
=
timeout
)
if
status
:
test
.
error
(
"Failed to install wireshark, status=%s, output=%s"
%
(
status
,
output
))
logging
.
info
(
"Wait for wireshark installation to complete"
)
utils_misc
.
wait_for
(
lambda
:
_is_process_finished
(
session
,
wireshark_name
),
timeout
,
20
,
3
)
else
:
logging
.
info
(
"Wireshark is already installed"
)
session
.
close
()
virtio_win
.
prepare_netkvmco
(
vm
)
error_context
.
context
(
"Enable scatter gather"
,
logging
.
info
)
_set_driver_param
(
0
)
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
error_context
.
context
(
"Log network traffic with scatter gather enabled"
,
logging
.
info
)
output
=
_get_traffic_log
(
"frame.len>1514"
)
logging
.
info
(
"Check length > 1514 packets"
)
if
"Len"
not
in
output
:
test
.
fail
(
"No packet length >= 1514, output=%s"
%
output
)
session
.
close
()
error_context
.
context
(
"Disable scatter gather"
,
logging
.
info
)
_set_driver_param
(
1
)
_set_driver_param
(
2
)
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
error_context
.
context
(
"Log network traffic with scatter gather disabled"
,
logging
.
info
)
logging
.
info
(
"Check length > 1014 packets"
)
output
=
_get_traffic_log
(
"frame.len>1014"
)
if
"Len"
in
output
:
test
.
fail
(
"Some packet length > 1014, output=%s"
%
output
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录