Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
3d8d6779
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,发现更多精彩内容 >>
提交
3d8d6779
编写于
5月 21, 2014
作者:
F
Feng Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu: Add trace_cmd_reboot new test case
Signed-off-by:
N
Feng Yang
<
fyang@redhat.com
>
上级
5643db0e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
111 addition
and
0 deletion
+111
-0
qemu/tests/cfg/trace_cmd_reboot.cfg
qemu/tests/cfg/trace_cmd_reboot.cfg
+11
-0
qemu/tests/trace_cmd_boot.py
qemu/tests/trace_cmd_boot.py
+100
-0
未找到文件。
qemu/tests/cfg/trace_cmd_reboot.cfg
0 → 100644
浏览文件 @
3d8d6779
- trace_cmd_reboot: unattended_install.cdrom
only Windows
type = trace_cmd_boot
reboot_method = shell
kill_vm_on_error = yes
login_timeout = 360
reboot_count = 1500
# stress_cmd = stress --vm 2 --vm-bytes 200M
trace_cmd = "trace-cmd record -b 20000 -e kvm -o %s"
# set re_trace to filter error log from trace report.
re_trace = "kvm_inj_exception: #GP"
qemu/tests/trace_cmd_boot.py
0 → 100644
浏览文件 @
3d8d6779
import
re
import
os
import
time
import
signal
import
logging
from
autotest.client
import
utils
from
autotest.client.shared
import
error
from
virttest
import
utils_test
,
utils_misc
@
error
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Qemu reboot test:
1) Boot up a windows guest.
2) Run stress tool on host.
3) After guest starts up, start the ftrace.
4) Reboot VM inside guest.
5.1) If the guest reboot successfully, then stop the trace-cmd and remove
the trace.dat file.
5.2) If guest hang, stop the trace-cmd and generate the readable report
file.
6) if 5.2, Check whether the trace.txt includes the error log.
7) Repeat step 3~6.
:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
def
find_trace_cmd
():
if
utils
.
system
(
"ps -a | grep trace-cmd"
,
ignore_status
=
True
):
return
False
else
:
return
True
if
os
.
system
(
"which trace-cmd"
):
raise
error
.
TestNAError
(
"Please install trace-cmd."
)
timeout
=
float
(
params
.
get
(
"login_timeout"
,
240
))
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
reboot_method
=
params
[
"reboot_method"
]
stress_cmd
=
params
.
get
(
"stress_cmd"
,
"stress --vm 4 --vm-bytes 1000M"
)
trace_o
=
os
.
path
.
join
(
test
.
debugdir
,
"trace.dat"
)
trace_cmd
=
"trace-cmd record -b 20000 -e kvm -o %s"
%
trace_o
trace_cmd
=
params
.
get
(
"trace_cmd"
,
trace_cmd
)
re_trace
=
params
.
get
(
"re_trace"
,
"kvm_inj_exception: #GP"
)
report_file
=
os
.
path
.
join
(
test
.
debugdir
,
"trace.txt"
)
trace_report_cmd
=
"trace-cmd report -i %s > %s "
%
(
trace_o
,
report_file
)
try
:
error
.
context
(
"Run stress tool on host."
,
logging
.
info
)
stress_job
=
utils
.
BgJob
(
stress_cmd
)
# Reboot the VM
for
num
in
xrange
(
int
(
params
.
get
(
"reboot_count"
,
1
))):
error
.
context
(
"Reboot guest '%s'. Repeat %d"
%
(
vm
.
name
,
num
+
1
),
logging
.
info
)
trace_job
=
utils
.
BgJob
(
trace_cmd
)
try
:
session
=
vm
.
reboot
(
session
,
reboot_method
,
0
,
timeout
)
except
Exception
,
err
:
txt
=
"stop the trace-cmd and generate the readable report."
error
.
context
(
txt
,
logging
.
info
)
os
.
kill
(
trace_job
.
sp
.
pid
,
signal
.
SIGINT
)
if
not
utils_misc
.
wait_for
(
lambda
:
not
find_trace_cmd
(),
180
,
60
,
3
):
logging
.
warn
(
"trace-cmd could not finish after 120s."
)
trace_job
=
None
utils
.
system
(
trace_report_cmd
)
report_txt
=
file
(
report_file
).
read
()
txt
=
"Check whether the trace.txt includes the error log."
error
.
context
(
txt
,
logging
.
info
)
if
re
.
findall
(
re_trace
,
report_txt
,
re
.
S
):
msg
=
"Found %s in trace log %s"
%
(
re_trace
,
report_file
)
logging
.
info
(
msg
)
error
.
TestFail
(
msg
)
else
:
txt
=
"stop the trace-cmd and remove the trace.dat file."
error
.
context
(
txt
,
logging
.
info
)
os
.
kill
(
trace_job
.
sp
.
pid
,
signal
.
SIGINT
)
if
not
utils_misc
.
wait_for
(
lambda
:
not
find_trace_cmd
(),
120
,
60
,
3
):
logging
.
warn
(
"trace-cmd could not finish after 120s."
)
trace_job
=
None
utils
.
system
(
"rm -rf %s"
%
trace_o
,
timeout
=
60
)
finally
:
if
session
:
session
.
close
()
if
stress_job
and
stress_job
.
sp
.
poll
()
is
None
:
utils_misc
.
kill_process_tree
(
stress_job
.
sp
.
pid
,
9
)
if
trace_job
:
if
trace_job
.
sp
.
poll
()
is
None
:
os
.
kill
(
trace_job
.
sp
.
pid
,
signal
.
SIGINT
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录