Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
4f7a5ea3
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,发现更多精彩内容 >>
未验证
提交
4f7a5ea3
编写于
10月 18, 2018
作者:
Q
Qianqian Zhu
提交者:
GitHub
10月 18, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1346 from YanhuiMa/heartbeat
watchdog: Heartbeat test for i6300esb
上级
1ce9f54c
f3277bd9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
82 addition
and
0 deletion
+82
-0
qemu/tests/cfg/watchdog.cfg
qemu/tests/cfg/watchdog.cfg
+21
-0
qemu/tests/watchdog.py
qemu/tests/watchdog.py
+61
-0
未找到文件。
qemu/tests/cfg/watchdog.cfg
浏览文件 @
4f7a5ea3
...
...
@@ -70,3 +70,24 @@
test_type = watchdog_test_suit
watchdog_action = pause
watchdog_test_lib = "watchdog/watchdog-test-framework"
- heartbeat_test:
only i6300esb
test_type = heartbeat_test
del_module_cmd = "modprobe -r i6300esb"
reload_module_cmd = "modprobe i6300esb heartbeat=%s"
trigger_cmd = python -c "open('/dev/watchdog', 'w')"
watchdog_action = pause
dmesg_cmd = dmesg -c
variants:
- valid:
heartbeat = random_value
- invalid_1:
heartbeat = -1
- invalid_0:
heartbeat = 0
- invalid_min:
heartbeat = -2147483648
- invalid_max:
heartbeat = 2147483647
- invalid_excp:
heartbeat = 4294967296
qemu/tests/watchdog.py
浏览文件 @
4f7a5ea3
...
...
@@ -2,6 +2,7 @@ import os
import
re
import
time
import
logging
import
random
from
avocado.utils
import
process
from
virttest
import
error_context
...
...
@@ -346,6 +347,66 @@ def run(test, params, env):
session
.
cmd_output
(
"pkill watchdog-test"
)
session
.
cmd_output
(
"rm -rf /home/%s"
%
test_dir
)
def
heartbeat_test
():
"""
Heartbeat test for i6300esb
Test steps:
1.Start VM with "-watchdog-action pause" CLI option
2.Set heartbeat value and reload the i6300esb module
3.Trigger wathchdog action through open /dev/watchdog
4.Ensure watchdog_action takes effect after $heartbeat.
"""
del_module_cmd
=
params
[
"del_module_cmd"
]
reload_module_cmd
=
params
[
"reload_module_cmd"
]
_watchdog_device_check
(
test
,
session
,
watchdog_device_type
)
error_context
.
context
(
"set heartbeat value and reload the i6300esb "
"module"
,
logging
.
info
)
session
.
cmd
(
del_module_cmd
)
heartbeat
=
params
[
"heartbeat"
]
if
heartbeat
==
"random_value"
:
heartbeat
=
random
.
randint
(
1
,
20
)
else
:
heartbeat
=
eval
(
heartbeat
)
dmesg_cmd
=
params
[
"dmesg_cmd"
]
session
.
cmd
(
dmesg_cmd
)
session
.
cmd_output
(
reload_module_cmd
%
heartbeat
)
if
heartbeat
<
-
2147483648
or
heartbeat
>
2147483647
:
o
=
session
.
cmd_output
(
"dmesg | grep -i 'i6300esb.*invalid'"
)
if
o
:
logging
.
info
(
"Heartbeat value %s is out of range, it is "
"expected."
%
heartbeat
)
else
:
test
.
fail
(
"No invalid heartbeat info in dmesg."
)
elif
-
2147483648
<=
heartbeat
<
1
or
2046
<
heartbeat
<=
2147483647
:
o
=
session
.
cmd_output
(
"dmesg | grep -i 'heartbeat=30'"
)
if
not
o
:
test
.
fail
(
"Heartbeat value isn't default 30 sec in dmesg, it "
"should be."
)
heartbeat
=
30
elif
1
<=
heartbeat
<=
2046
:
o
=
session
.
cmd_output
(
"dmesg | grep -i 'heartbeat=%s'"
%
heartbeat
)
if
not
o
:
test
.
fail
(
"Heartbeat value isn't %s sec in dmesg"
%
heartbeat
)
if
heartbeat
<=
2147483647
and
heartbeat
>
-
2147483648
:
_watchdog_device_check
(
test
,
session
,
watchdog_device_type
)
_trigger_watchdog
(
session
,
trigger_cmd
)
error_context
.
context
(
"Watchdog will fire after %s s"
%
heartbeat
,
logging
.
info
)
start_time
=
time
.
time
()
end_time
=
start_time
+
float
(
heartbeat
)
+
2
while
not
vm
.
monitor
.
verify_status
(
"paused"
):
if
time
.
time
()
>
end_time
:
test
.
fail
(
"Monitor status is:%s, watchdog action '%s' didn't take"
"effect"
%
(
vm
.
monitor
.
get_status
(),
watchdog_action
))
time
.
sleep
(
1
)
guest_pause_time
=
time
.
time
()
-
start_time
if
abs
(
guest_pause_time
-
float
(
heartbeat
))
<=
2
:
logging
.
info
(
"Watchdog action '%s' took effect after '%s's."
%
(
watchdog_action
,
guest_pause_time
))
else
:
test
.
fail
(
"Watchdog action '%s' took effect after '%s's, it is earlier"
" than expected."
%
(
watchdog_action
,
guest_pause_time
))
# main procedure
test_type
=
params
.
get
(
"test_type"
)
check_watchdog_support
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录