Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
dc8752d0
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,发现更多精彩内容 >>
提交
dc8752d0
编写于
1月 28, 2014
作者:
L
Lucas Meneghel Rodrigues
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3 from FengYang/qmp
qemu.tests: qmp_command update to fit new qemu
上级
ac711f3b
0a211c31
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
6 deletion
+20
-6
qemu/tests/cfg/qmp_command.cfg
qemu/tests/cfg/qmp_command.cfg
+2
-1
qemu/tests/qmp_command.py
qemu/tests/qmp_command.py
+18
-5
未找到文件。
qemu/tests/cfg/qmp_command.cfg
浏览文件 @
dc8752d0
...
...
@@ -48,7 +48,7 @@
post_cmd = info blockstats
cmd_result_check = contain
cmd_return_value = "device;wr_highest_offset;rd_bytes;wr_operations;rd_operations;wr_bytes;parent;floppy0;sd0"
use_nodefaults = no
defaults = yes
- qmp_memsave:
event_cmd_type = host_cmd
qmp_cmd = "memsave val=0, size=4096, filename=/var/tmp/memsave"
...
...
@@ -84,6 +84,7 @@
- qmp_query-block:
qmp_cmd = "query-block"
post_cmd = info block
exception_list = "tray-open tray_open"
cmd_result_check = m_equal_q
- qmp_query-commands:
qmp_cmd = "query-commands"
...
...
qemu/tests/qmp_command.py
浏览文件 @
dc8752d0
...
...
@@ -17,7 +17,7 @@ def run(test, params, env):
:param params: Dictionary with the test parameters
:param env: Dictionary with test environmen.
"""
def
check_result
(
qmp_o
,
output
=
None
):
def
check_result
(
qmp_o
,
output
=
None
,
exception_list
=
""
):
"""
Check test result with difference way accoriding to
result_check.
...
...
@@ -34,6 +34,7 @@ def run(test, params, env):
:param qmp_o: output from pre_cmd, qmp_cmd or post_cmd.
:param o: output from pre_cmd, qmp_cmd or post_cmd or an execpt
:param exception_list: element no need check.
result set in config file.
"""
if
result_check
==
"equal"
:
...
...
@@ -45,6 +46,8 @@ def run(test, params, env):
elif
result_check
==
"contain"
:
values
=
output
.
split
(
';'
)
for
value
in
values
:
if
value
in
exception_list
:
continue
if
value
.
strip
()
not
in
str
(
qmp_o
):
raise
error
.
TestFail
(
"QMP command output does not contain "
"expect result. Expect result: '%s'
\n
"
...
...
@@ -53,6 +56,8 @@ def run(test, params, env):
elif
result_check
==
"not_contain"
:
values
=
output
.
split
(
';'
)
for
value
in
values
:
if
value
in
exception_list
:
continue
if
value
in
str
(
qmp_o
):
raise
error
.
TestFail
(
"QMP command output contains unexpect"
" result. Unexpect result: '%s'
\n
"
...
...
@@ -80,11 +85,16 @@ def run(test, params, env):
hmp_version
,
hmp_package
=
re
.
findall
(
re_str
,
res
[
i
])[
0
]
if
not
hmp_package
:
hmp_package
=
package
hmp_package
=
hmp_package
.
strip
()
package
=
package
.
strip
()
hmp_version
=
hmp_version
.
strip
()
if
version
!=
hmp_version
or
package
!=
hmp_package
:
raise
error
.
TestFail
(
msg
)
else
:
matches
=
re
.
findall
(
re_str
,
res
[
i
])
for
key
,
val
in
matches
:
if
key
in
exception_list
:
continue
if
'0x'
in
val
:
val
=
long
(
val
,
16
)
if
val
!=
qmp_o
[
i
][
key
]:
...
...
@@ -127,6 +137,8 @@ def run(test, params, env):
for
i
in
range
(
len
(
res
)):
params
=
res
[
i
].
rstrip
().
split
()
for
param
in
params
:
if
param
.
rstrip
()
in
exception_list
:
continue
try
:
str_o
=
str
(
qmp_o
.
values
())
except
AttributeError
:
...
...
@@ -221,6 +233,7 @@ def run(test, params, env):
post_cmd
=
params
.
get
(
"post_cmd"
)
result_check
=
params
.
get
(
"cmd_result_check"
)
cmd_return_value
=
params
.
get
(
"cmd_return_value"
)
exception_list
=
params
.
get
(
"exception_list"
,
""
)
# HOOKs
if
result_check
==
'qmp_cpu'
:
...
...
@@ -264,12 +277,12 @@ def run(test, params, env):
if
result_check
==
'qmp_cpu'
:
qmp_cpu_check
(
output
)
elif
result_check
==
"equal"
or
result_check
==
"contain"
:
check_result
(
output
,
cmd_return_value
)
check_result
(
output
,
cmd_return_value
,
exception_list
)
elif
result_check
==
"m_format_q"
:
check_result
(
output
,
cmd_return_value
)
check_result
(
output
,
cmd_return_value
,
exception_list
)
elif
'post'
in
result_check
:
result_check
=
result_check
.
split
(
'_'
,
1
)[
1
]
check_result
(
post_o
,
cmd_return_value
)
check_result
(
post_o
,
cmd_return_value
,
exception_list
)
else
:
check_result
(
output
,
post_o
)
check_result
(
output
,
post_o
,
exception_list
)
session
.
close
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录