Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
4eee8b52
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,发现更多精彩内容 >>
提交
4eee8b52
编写于
7月 10, 2018
作者:
S
Sitong Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
timerdevice: add case to measure guest's time jump
Signed-off-by:
N
Sitong Liu
<
siliu@redhat.com
>
上级
93a7ec6f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
73 addition
and
1 deletion
+73
-1
qemu/tests/cfg/timerdevice.cfg
qemu/tests/cfg/timerdevice.cfg
+10
-1
qemu/tests/timerdevice_time_jump_check.py
qemu/tests/timerdevice_time_jump_check.py
+63
-0
未找到文件。
qemu/tests/cfg/timerdevice.cfg
浏览文件 @
4eee8b52
...
...
@@ -107,7 +107,7 @@
vcpu_socket = 2
- newer_msrs_support_check:
only Linux
no Host_RHEL.m
5 Host_RHEL.m
6.u0
no Host_RHEL.m6.u0
no RHEL.6.0 RHEL.6.1 RHEL.6.2 RHEL.6.3
type = timerdevice_kvmclock_newer_msrs_support
rtc_base = utc
...
...
@@ -116,3 +116,12 @@
rtc_drift = slew
msrs = "4b564d01 4b564d00"
msrs_catch_re = "kvm-clock: Using msrs (\w+) and (\w+)"
- measure_time_jump:
only Linux
type = timerdevice_time_jump_check
rtc_base = utc
rtc_clock = host
i386, x86_64:
rtc_drift = slew
check_cmd = "for i in `seq 20`; do date +'%y-%m-%d %H:%M:%S';done"
host_cpu_cnt_cmd = "cat /proc/cpuinfo | grep "physical id" | wc -l"
qemu/tests/timerdevice_time_jump_check.py
0 → 100644
浏览文件 @
4eee8b52
import
logging
import
time
from
virttest
import
error_context
from
virttest.compat_52lts
import
decode_to_text
from
avocado.utils
import
process
@
error_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
check time jumps in guest (only for Linux guest):
1) boot guest with '-rtc base=utc,clock=host,driftfix=slew'
2) check current clocksource in guest
3) pin all vcpus to specfic host CPUs
4) verify time jump
:param test: QEMU test object.
:param params: Dictionary with test parameters.
:param env: Dictionary with the test environment.
"""
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
session
=
vm
.
wait_for_login
()
error_context
.
context
(
"Check the clock source currently used on guest"
,
logging
.
info
)
cmd
=
"cat /sys/devices/system/clocksource/"
cmd
+=
"clocksource0/current_clocksource"
logging
.
info
(
"%s is current clocksource."
%
session
.
cmd_output
(
cmd
))
error_context
.
context
(
"Pin every vcpu to physical cpu"
,
logging
.
info
)
host_cpu_cnt_cmd
=
params
[
"host_cpu_cnt_cmd"
]
host_cpu_num
=
decode_to_text
(
process
.
system_output
(
host_cpu_cnt_cmd
,
shell
=
True
)).
strip
()
host_cpu_list
=
(
_
for
_
in
range
(
int
(
host_cpu_num
)))
if
len
(
vm
.
vcpu_threads
)
>
int
(
host_cpu_num
):
host_cpu_list
=
[]
for
_
in
range
(
len
(
vm
.
vcpu_threads
)):
host_cpu_list
.
append
(
_
%
int
(
host_cpu_num
))
cpu_pin_list
=
list
(
zip
(
vm
.
vcpu_threads
,
host_cpu_list
))
for
vcpu
,
pcpu
in
cpu_pin_list
:
process
.
system
(
"taskset -p -c %s %s"
%
(
pcpu
,
vcpu
))
check_cmd
=
params
[
"check_cmd"
]
output
=
str
(
session
.
cmd_output
(
check_cmd
)).
splitlines
()
session
.
close
()
time_pattern
=
"%y-%m-%d %H:%M:%S"
time_list
=
[]
for
str_time
in
output
:
time_struct
=
time
.
strptime
(
str_time
,
time_pattern
)
etime
=
time
.
mktime
(
time_struct
)
time_list
.
append
(
etime
)
for
idx
,
_
in
enumerate
(
time_list
):
if
idx
<
len
(
time_list
)
-
1
:
if
_
==
time_list
[
idx
+
1
]
or
(
_
+
1
)
==
time_list
[
idx
+
1
]:
continue
else
:
test
.
fail
(
"Test fail, time jumps backward or forward on guest"
)
else
:
break
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录