Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
43bf981b
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,发现更多精彩内容 >>
未验证
提交
43bf981b
编写于
10月 26, 2018
作者:
Q
Qianqian Zhu
提交者:
GitHub
10月 26, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1510 from sitoliu/drop_ntpdate_in_case
Replace ntpdate use in cases
上级
cbff63e8
ea509fe4
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
55 addition
and
77 deletion
+55
-77
qemu/tests/cfg/cpu_add.cfg
qemu/tests/cfg/cpu_add.cfg
+3
-5
qemu/tests/cfg/timedrift_adjust_time.cfg
qemu/tests/cfg/timedrift_adjust_time.cfg
+3
-3
qemu/tests/cfg/timedrift_check_clock_offset.cfg
qemu/tests/cfg/timedrift_check_clock_offset.cfg
+5
-2
qemu/tests/cfg/timedrift_no_net.cfg
qemu/tests/cfg/timedrift_no_net.cfg
+2
-0
qemu/tests/cfg/timerdevice.cfg
qemu/tests/cfg/timerdevice.cfg
+6
-4
qemu/tests/cpu_add.py
qemu/tests/cpu_add.py
+6
-11
qemu/tests/timedrift_adjust_time.py
qemu/tests/timedrift_adjust_time.py
+3
-3
qemu/tests/timedrift_check_when_crash.py
qemu/tests/timedrift_check_when_crash.py
+3
-3
qemu/tests/timedrift_no_net.py
qemu/tests/timedrift_no_net.py
+6
-14
qemu/tests/timedrift_no_net_win.py
qemu/tests/timedrift_no_net_win.py
+4
-14
qemu/tests/timerdevice_boot.py
qemu/tests/timerdevice_boot.py
+2
-1
qemu/tests/timerdevice_clock_drift_with_ntp.py
qemu/tests/timerdevice_clock_drift_with_ntp.py
+12
-12
qemu/tests/timerdevice_clock_drift_with_sleep.py
qemu/tests/timerdevice_clock_drift_with_sleep.py
+0
-5
未找到文件。
qemu/tests/cfg/cpu_add.cfg
浏览文件 @
43bf981b
...
@@ -114,11 +114,9 @@
...
@@ -114,11 +114,9 @@
online = 1
online = 1
offline = 1
offline = 1
vcpu_num_rechek = no
vcpu_num_rechek = no
ntp_server = "clock.redhat.com"
ntp_sync_cmd = "(systemctl stop chronyd || service ntpdate stop)"
pre_command = "ntpdate ${ntp_server}"
ntp_sync_cmd += " && chronyd -q 'server clock.redhat.com iburst'"
ntp_sync_cmd = "ntpdate ${ntp_server}"
ntp_query_cmd = "chronyd -Q 'server clock.redhat.com iburst'"
ntp_query_cmd = "ntpdate -q ${ntp_server}"
ntp_service_stop_cmd = "service chronyd stop || service ntpdate stop"
variants:
variants:
- after_10mins:
- after_10mins:
# seconds switch vcpus between online and offline
# seconds switch vcpus between online and offline
...
...
qemu/tests/cfg/timedrift_adjust_time.cfg
浏览文件 @
43bf981b
...
@@ -8,9 +8,9 @@
...
@@ -8,9 +8,9 @@
kill_vm = yes
kill_vm = yes
requries_root = yes
requries_root = yes
image_snapshot = yes
image_snapshot = yes
pre_command = "s
ervice chronyd stop
|| service ntpdate stop"
pre_command = "s
ystemctl stop chronyd
|| service ntpdate stop"
post_command = "s
ervice chronyd restart
|| service ntpdate restart"
post_command = "s
ystemctl restart chronyd
|| service ntpdate restart"
sync_host_time_cmd =
'ntpdate clock.redhat.com; hwclock -w'
sync_host_time_cmd =
"chronyd -q 'server clock.redhat.com iburst'; hwclock -w"
host_epoch_time_cmd = 'epoch=$(date +%s); datetime=$(date);'
host_epoch_time_cmd = 'epoch=$(date +%s); datetime=$(date);'
host_epoch_time_cmd += 'echo "datetime: $datetime epoch: $epoch"'
host_epoch_time_cmd += 'echo "datetime: $datetime epoch: $epoch"'
time_difference = 0
time_difference = 0
...
...
qemu/tests/cfg/timedrift_check_clock_offset.cfg
浏览文件 @
43bf981b
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
type = timedrift_check_when_crash
type = timedrift_check_when_crash
start_vm = no
start_vm = no
ntp_server = "clock.redhat.com"
ntp_server = "clock.redhat.com"
clock_sync_command = "(systemctl stop chronyd || service ntpdate stop)"
clock_sync_command += " && chronyd -q 'server clock.redhat.com iburst'"
sleep_time = 1800
sleep_time = 1800
variants:
variants:
- bsod:
- bsod:
...
@@ -32,5 +34,6 @@
...
@@ -32,5 +34,6 @@
# else guest will reboot immedicately that is unexpected in this test;
# else guest will reboot immedicately that is unexpected in this test;
only Linux
only Linux
nmi_cmd = "guest: echo '1' > /proc/sys/kernel/sysrq && echo '0' > /proc/sys/kernel/panic && service kdump stop; echo 'c' > /proc/sysrq-trigger"
nmi_cmd = "guest: echo '1' > /proc/sys/kernel/sysrq && echo '0' > /proc/sys/kernel/panic && service kdump stop; echo 'c' > /proc/sysrq-trigger"
ntp_cmd = "ntpdate ${ntp_server}"
ntp_cmd = "(systemctl stop chronyd || service ntpdate stop)"
ntp_query_cmd = "ntpdate -q ${ntp_server}"
ntp_cmd += " && chronyd -q 'server clock.redhat.com iburst'"
ntp_query_cmd = "chronyd -Q 'server clock.redhat.com iburst'"
qemu/tests/cfg/timedrift_no_net.cfg
浏览文件 @
43bf981b
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
nettype = none
nettype = none
login_timeout = 240
login_timeout = 240
guest_clock_source = "kvm-clock"
guest_clock_source = "kvm-clock"
clock_sync_command = "(systemctl stop chronyd || service ntpdate stop)"
clock_sync_command += " && chronyd -q 'server clock.redhat.com iburst'"
Linux:
Linux:
type = timedrift_no_net
type = timedrift_no_net
...
...
qemu/tests/cfg/timerdevice.cfg
浏览文件 @
43bf981b
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
host_cpu_cnt_cmd = "cat /proc/cpuinfo | grep "physical id" | wc -l"
host_cpu_cnt_cmd = "cat /proc/cpuinfo | grep "physical id" | wc -l"
variants:
variants:
- tscwrite:
- tscwrite:
only Fedora.19 RHEL.7
no RHEL.6
type = timerdevice_tscwrite
type = timerdevice_tscwrite
msr_tools_install_cmd = "yum install -y msr-tools"
msr_tools_install_cmd = "yum install -y msr-tools"
msr_tools_cmd = "a=$(rdmsr -d 0x00000010); echo -e ibase=16\\n $a | tail -n 1 | while read n; do wrmsr 0x00000010 $(($n+100000000000)); echo $n; done"
msr_tools_cmd = "a=$(rdmsr -d 0x00000010); echo -e ibase=16\\n $a | tail -n 1 | while read n; do wrmsr 0x00000010 $(($n+100000000000)); echo $n; done"
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
ntp_sync_cmd = "(systemctl stop chronyd || service ntpdate stop)"
ntp_sync_cmd = "(systemctl stop chronyd || service ntpdate stop)"
ntp_sync_cmd += " && chronyd -q 'server clock.redhat.com iburst'"
ntp_sync_cmd += " && chronyd -q 'server clock.redhat.com iburst'"
- clock_drift_with_ntp:
- clock_drift_with_ntp:
only Fedora.19 RHEL.7
no RHEL.6
type = timerdevice_clock_drift_with_ntp
type = timerdevice_clock_drift_with_ntp
test_run_timeout = 7200
test_run_timeout = 7200
- change_guest_clksource:
- change_guest_clksource:
...
@@ -34,6 +34,8 @@
...
@@ -34,6 +34,8 @@
i386, x86_64:
i386, x86_64:
rtc_drift = slew
rtc_drift = slew
timerdevice_drift_threshold = 3
timerdevice_drift_threshold = 3
clock_sync_command = "(systemctl stop chronyd || service ntpdate stop)"
clock_sync_command += " && chronyd -q 'server clock.redhat.com iburst'"
variants:
variants:
- clock_host:
- clock_host:
rtc_clock = host
rtc_clock = host
...
@@ -51,7 +53,7 @@
...
@@ -51,7 +53,7 @@
only Windows
only Windows
timerdevice_clksource = ""
timerdevice_clksource = ""
- clksource_kvm-clock:
- clksource_kvm-clock:
only
Fedora.19
RHEL
only RHEL
timerdevice_clksource = "kvm-clock"
timerdevice_clksource = "kvm-clock"
- clksource_tsc:
- clksource_tsc:
# Fedora guest can't bootup without '-kvmclock' option.
# Fedora guest can't bootup without '-kvmclock' option.
...
@@ -78,7 +80,7 @@
...
@@ -78,7 +80,7 @@
- reboot_after_sleep:
- reboot_after_sleep:
timerdevice_sleep_time = 3600
timerdevice_sleep_time = 3600
- tscsync:
- tscsync:
only Fedora.19 RHEL.7
no RHEL.6
variants:
variants:
- change_host_clksource:
- change_host_clksource:
type = timerdevice_tscsync_change_host_clksource
type = timerdevice_tscsync_change_host_clksource
...
...
qemu/tests/cpu_add.py
浏览文件 @
43bf981b
...
@@ -17,14 +17,13 @@ def run(test, params, env):
...
@@ -17,14 +17,13 @@ def run(test, params, env):
2) After logged into the vm, check CPUs number
2) After logged into the vm, check CPUs number
3) Stop the guest if config 'stop_before_hotplug'
3) Stop the guest if config 'stop_before_hotplug'
4) sync guest clock via ntp server if config ntp_sync_cmd
4) sync guest clock via ntp server if config ntp_sync_cmd
5) stop ntp service in guest if config ntp_service_stop_cmd
5) Do cpu hotplug
6) Do cpu hotplug
6) Resume the guest if config 'stop_before_hotplug'
7) Resume the guest if config 'stop_before_hotplug'
7) Recheck guest get hot-pluged CPUs
8) Recheck guest get hot-pluged CPUs
8) Do cpu online/offline in guest and check clock
9) Do cpu online/offline in guest and check clock
offset via ntp server if config online/offline_cpus
offset via ntp server if config online/offline_cpus
10
) Run sub test after CPU Hotplug if run_sub_test is 'yes'
9
) Run sub test after CPU Hotplug if run_sub_test is 'yes'
1
1
) Recheck guest cpus after sub test if vcpu_num_rechek is 'yes'
1
0
) Recheck guest cpus after sub test if vcpu_num_rechek is 'yes'
:param test: QEMU test object.
:param test: QEMU test object.
:param params: Dictionary with test parameters.
:param params: Dictionary with test parameters.
...
@@ -96,7 +95,6 @@ def run(test, params, env):
...
@@ -96,7 +95,6 @@ def run(test, params, env):
acceptable_offset
=
float
(
params
.
get
(
"acceptable_offset"
,
5
))
acceptable_offset
=
float
(
params
.
get
(
"acceptable_offset"
,
5
))
ntp_query_cmd
=
params
.
get
(
"ntp_query_cmd"
,
""
)
ntp_query_cmd
=
params
.
get
(
"ntp_query_cmd"
,
""
)
ntp_sync_cmd
=
params
.
get
(
"ntp_sync_cmd"
,
""
)
ntp_sync_cmd
=
params
.
get
(
"ntp_sync_cmd"
,
""
)
ntp_service_stop_cmd
=
params
.
get
(
"ntp_service_stop_cmd"
)
error_context
.
context
(
"Boot the vm, with '-smp X,maxcpus=Y' option"
,
error_context
.
context
(
"Boot the vm, with '-smp X,maxcpus=Y' option"
,
logging
.
info
)
logging
.
info
)
...
@@ -110,9 +108,6 @@ def run(test, params, env):
...
@@ -110,9 +108,6 @@ def run(test, params, env):
if
ntp_sync_cmd
:
if
ntp_sync_cmd
:
error_context
.
context
(
"sync guest time via ntp server"
,
logging
.
info
)
error_context
.
context
(
"sync guest time via ntp server"
,
logging
.
info
)
session
.
cmd
(
ntp_sync_cmd
)
session
.
cmd
(
ntp_sync_cmd
)
if
ntp_service_stop_cmd
:
logging
.
info
(
"stop ntp service in guest"
)
session
.
cmd
(
ntp_service_stop_cmd
)
error_context
.
context
(
"Check if cpus in guest match qemu "
error_context
.
context
(
"Check if cpus in guest match qemu "
"cmd before hotplug"
,
logging
.
info
)
"cmd before hotplug"
,
logging
.
info
)
...
...
qemu/tests/timedrift_adjust_time.py
浏览文件 @
43bf981b
...
@@ -89,7 +89,7 @@ class TimedriftTest(object):
...
@@ -89,7 +89,7 @@ class TimedriftTest(object):
timeout
=
int
(
self
.
params
.
get
(
"execute_timeout"
,
360
))
timeout
=
int
(
self
.
params
.
get
(
"execute_timeout"
,
360
))
ret
=
session
.
cmd_output
(
cmd
,
timeout
=
timeout
)
ret
=
session
.
cmd_output
(
cmd
,
timeout
=
timeout
)
else
:
else
:
ret
=
process
.
system_output
(
cmd
,
shell
=
True
)
ret
=
process
.
system_output
(
cmd
,
shell
=
True
)
.
decode
()
target
=
session
and
"guest"
or
"host"
target
=
session
and
"guest"
or
"host"
logging
.
debug
(
"(%s) Execute command('%s')"
%
(
target
,
cmd
))
logging
.
debug
(
"(%s) Execute command('%s')"
%
(
target
,
cmd
))
return
ret
return
ret
...
@@ -101,7 +101,7 @@ class TimedriftTest(object):
...
@@ -101,7 +101,7 @@ class TimedriftTest(object):
calibrate guest time else calibrate host time;
calibrate guest time else calibrate host time;
:param session: ShellSession object or None
:param session: ShellSession object or None
:return:
ntpdate
command output;
:return:
sync
command output;
:rtype: str
:rtype: str
"""
"""
error_context
.
context
(
"Sync host time from ntp server"
,
logging
.
info
)
error_context
.
context
(
"Sync host time from ntp server"
,
logging
.
info
)
...
@@ -120,7 +120,7 @@ class TimedriftTest(object):
...
@@ -120,7 +120,7 @@ class TimedriftTest(object):
guest_epoch_time_cmd
,
guest_epoch_time_cmd
,
timeout
=
240
)
timeout
=
240
)
host_timestr
=
process
.
system_output
(
host_epoch_time_cmd
,
host_timestr
=
process
.
system_output
(
host_epoch_time_cmd
,
shell
=
True
)
shell
=
True
)
.
decode
()
epoch_host
,
epoch_guest
=
list
(
epoch_host
,
epoch_guest
=
list
(
map
(
lambda
x
:
re
.
findall
(
regex
,
x
)[
0
],
map
(
lambda
x
:
re
.
findall
(
regex
,
x
)[
0
],
[
host_timestr
,
guest_timestr
]))
[
host_timestr
,
guest_timestr
]))
...
...
qemu/tests/timedrift_check_when_crash.py
浏览文件 @
43bf981b
...
@@ -14,7 +14,7 @@ def run(test, params, env):
...
@@ -14,7 +14,7 @@ def run(test, params, env):
Time clock offset check when guest crash/bsod test:
Time clock offset check when guest crash/bsod test:
1) boot guest with '-rtc base=utc,clock=host,driftfix=slew';
1) boot guest with '-rtc base=utc,clock=host,driftfix=slew';
2) sync host system time with
"ntpdate clock.redhat.com"
;
2) sync host system time with
ntp server
;
3) inject nmi to guest/ make linux kernel crash;
3) inject nmi to guest/ make linux kernel crash;
4) sleep long time, then reset vm via system_reset;
4) sleep long time, then reset vm via system_reset;
5) query clock offset from ntp server;
5) query clock offset from ntp server;
...
@@ -23,7 +23,7 @@ def run(test, params, env):
...
@@ -23,7 +23,7 @@ def run(test, params, env):
:param params: Dictionary with test parameters.
:param params: Dictionary with test parameters.
:param env: Dictionary with the test environment.
:param env: Dictionary with the test environment.
"""
"""
ntp_server
=
params
.
get
(
"ntp_server"
,
"clock.redhat.com"
)
clock_sync_command
=
params
[
"clock_sync_command"
]
ntp_cmd
=
params
[
"ntp_cmd"
]
ntp_cmd
=
params
[
"ntp_cmd"
]
ntp_query_cmd
=
params
[
"ntp_query_cmd"
]
ntp_query_cmd
=
params
[
"ntp_query_cmd"
]
nmi_cmd
=
params
.
get
(
"nmi_cmd"
,
"inject-nmi"
)
nmi_cmd
=
params
.
get
(
"nmi_cmd"
,
"inject-nmi"
)
...
@@ -31,7 +31,7 @@ def run(test, params, env):
...
@@ -31,7 +31,7 @@ def run(test, params, env):
deviation
=
float
(
params
.
get
(
"deviation"
,
5
))
deviation
=
float
(
params
.
get
(
"deviation"
,
5
))
error_context
.
context
(
"sync host time with ntp server"
,
logging
.
info
)
error_context
.
context
(
"sync host time with ntp server"
,
logging
.
info
)
process
.
system
(
"ntpdate %s"
%
ntp_server
)
process
.
system
(
clock_sync_command
,
shell
=
True
)
error_context
.
context
(
"start guest"
,
logging
.
info
)
error_context
.
context
(
"start guest"
,
logging
.
info
)
params
[
"start_vm"
]
=
"yes"
params
[
"start_vm"
]
=
"yes"
...
...
qemu/tests/timedrift_no_net.py
浏览文件 @
43bf981b
import
logging
import
logging
import
time
import
time
from
avocado.utils
import
p
ath
,
p
rocess
from
avocado.utils
import
process
from
virttest
import
utils_test
from
virttest
import
utils_test
from
virttest
import
error_context
from
virttest
import
error_context
...
@@ -86,8 +86,6 @@ def run(test, params, env):
...
@@ -86,8 +86,6 @@ def run(test, params, env):
:param params: Dictionary with the test parameters
:param params: Dictionary with the test parameters
:param env: Dictionary with test environmen.
:param env: Dictionary with test environmen.
"""
"""
clock_server
=
params
.
get
(
"clock_server"
,
"clock.redhat.com"
)
ntputil_install
=
params
.
get
(
"ntputil_install"
,
"yum install -y ntpdate"
)
login_timeout
=
int
(
params
.
get
(
"login_timeout"
,
"240"
))
login_timeout
=
int
(
params
.
get
(
"login_timeout"
,
"240"
))
guest_clock_source
=
params
.
get
(
"guest_clock_source"
,
"kvm-clock"
)
guest_clock_source
=
params
.
get
(
"guest_clock_source"
,
"kvm-clock"
)
date_time_command
=
params
.
get
(
"date_time_command"
,
date_time_command
=
params
.
get
(
"date_time_command"
,
...
@@ -108,17 +106,11 @@ def run(test, params, env):
...
@@ -108,17 +106,11 @@ def run(test, params, env):
vm_name
=
params
.
get
(
"vms"
)
vm_name
=
params
.
get
(
"vms"
)
vm
=
env
.
get_vm
(
vm_name
)
vm
=
env
.
get_vm
(
vm_name
)
error_context
.
context
(
"Check if ntp utils are host in system."
,
logging
.
info
)
error_context
.
context
(
"Sync host machine with clock server %s"
,
logging
.
info
)
try
:
clock_sync_command
=
params
[
"clock_sync_command"
]
path
.
find_command
(
"ntpdate"
)
process
.
system
(
clock_sync_command
,
shell
=
True
)
except
path
.
CmdNotFoundError
:
error_context
.
context
(
"Install ntp utils `%s`."
%
(
ntputil_install
),
logging
.
info
)
process
.
run
(
ntputil_install
,
shell
=
True
)
error_context
.
context
(
"Sync host machine with clock server %s"
%
(
clock_server
),
logging
.
info
)
process
.
run
(
"ntpdate %s"
%
(
clock_server
))
error_context
.
context
(
"Check clock source on guest VM"
,
logging
.
info
)
error_context
.
context
(
"Check clock source on guest VM"
,
logging
.
info
)
session
=
vm
.
wait_for_serial_login
(
timeout
=
login_timeout
)
session
=
vm
.
wait_for_serial_login
(
timeout
=
login_timeout
)
out
=
session
.
cmd_output
(
"cat /sys/devices/system/clocksource/"
out
=
session
.
cmd_output
(
"cat /sys/devices/system/clocksource/"
...
...
qemu/tests/timedrift_no_net_win.py
浏览文件 @
43bf981b
import
logging
import
logging
import
time
import
time
from
avocado.utils
import
p
ath
,
p
rocess
from
avocado.utils
import
process
from
virttest
import
utils_test
from
virttest
import
utils_test
from
virttest
import
error_context
from
virttest
import
error_context
...
@@ -100,8 +100,7 @@ def run(test, params, env):
...
@@ -100,8 +100,7 @@ def run(test, params, env):
:param params: Dictionary with the test parameters
:param params: Dictionary with the test parameters
:param env: Dictionary with test environmen.
:param env: Dictionary with test environmen.
"""
"""
clock_server
=
params
.
get
(
"clock_server"
,
"clock.redhat.com"
)
clock_sync_command
=
params
[
"clock_sync_command"
]
ntputil_install
=
params
.
get
(
"ntputil_install"
,
"yum install -y ntpdate"
)
login_timeout
=
int
(
params
.
get
(
"login_timeout"
,
"240"
))
login_timeout
=
int
(
params
.
get
(
"login_timeout"
,
"240"
))
date_time_command
=
params
.
get
(
"date_time_command"
,
date_time_command
=
params
.
get
(
"date_time_command"
,
r
"date -u +'TIME: %a %m/%d/%Y %H:%M:%S.%N'"
)
r
"date -u +'TIME: %a %m/%d/%Y %H:%M:%S.%N'"
)
...
@@ -117,17 +116,8 @@ def run(test, params, env):
...
@@ -117,17 +116,8 @@ def run(test, params, env):
vm_name
=
params
.
get
(
"vms"
)
vm_name
=
params
.
get
(
"vms"
)
vm
=
env
.
get_vm
(
vm_name
)
vm
=
env
.
get_vm
(
vm_name
)
error_context
.
context
(
"Check if ntp utils are host in system."
,
error_context
.
context
(
"Sync host machine with clock server"
,
logging
.
info
)
logging
.
info
)
process
.
system
(
clock_sync_command
,
shell
=
True
)
try
:
path
.
find_command
(
"ntpdate"
)
except
path
.
CmdNotFoundError
:
error_context
.
context
(
"Install ntp utils `%s`."
%
(
ntputil_install
),
logging
.
info
)
process
.
run
(
ntputil_install
,
shell
=
True
)
error_context
.
context
(
"Sync host machine with clock server %s"
%
(
clock_server
),
logging
.
info
)
process
.
run
(
"ntpdate %s"
%
(
clock_server
))
session
=
vm
.
wait_for_login
(
timeout
=
login_timeout
)
session
=
vm
.
wait_for_login
(
timeout
=
login_timeout
)
error_context
.
context
(
"Get clock from host and guest VM using `date`"
,
error_context
.
context
(
"Get clock from host and guest VM using `date`"
,
...
...
qemu/tests/timerdevice_boot.py
浏览文件 @
43bf981b
...
@@ -47,7 +47,8 @@ def run(test, params, env):
...
@@ -47,7 +47,8 @@ def run(test, params, env):
error_context
.
context
(
"Sync the host system time with ntp server"
,
error_context
.
context
(
"Sync the host system time with ntp server"
,
logging
.
info
)
logging
.
info
)
process
.
system
(
"ntpdate clock.redhat.com"
)
clock_sync_command
=
params
[
"clock_sync_command"
]
process
.
system
(
clock_sync_command
,
shell
=
True
)
timerdevice_host_load_cmd
=
params
.
get
(
"timerdevice_host_load_cmd"
)
timerdevice_host_load_cmd
=
params
.
get
(
"timerdevice_host_load_cmd"
)
if
timerdevice_host_load_cmd
:
if
timerdevice_host_load_cmd
:
...
...
qemu/tests/timerdevice_clock_drift_with_ntp.py
浏览文件 @
43bf981b
...
@@ -11,18 +11,18 @@ from virttest import error_context
...
@@ -11,18 +11,18 @@ from virttest import error_context
@
error_context
.
context_aware
@
error_context
.
context_aware
def
run
(
test
,
params
,
env
):
def
run
(
test
,
params
,
env
):
"""
"""
Timer device check clock frequency offset using
NTP
on CPU starved guest:
Timer device check clock frequency offset using
chrony
on CPU starved guest:
1) Check for an appropriate clocksource on host.
1) Check for an appropriate clocksource on host.
2) Boot the guest.
2) Boot the guest.
3) Copy time-warp-test.c to guest.
3) Copy time-warp-test.c to guest.
4) Compile the time-warp-test.c.
4) Compile the time-warp-test.c.
5) Stop
ntp
d and apply load on guest.
5) Stop
chrony
d and apply load on guest.
6) Pin every vcpu to a physical cpu.
6) Pin every vcpu to a physical cpu.
7) Verify each vcpu is pinned on host.
7) Verify each vcpu is pinned on host.
8) Run time-warp-test on guest.
8) Run time-warp-test on guest.
9) Start
ntp
d on guest.
9) Start
chrony
d on guest.
10) Check the drift in /var/lib/
ntp
/drift file on guest after hours
10) Check the drift in /var/lib/
chrony
/drift file on guest after hours
of running.
of running.
:param test: QEMU test object.
:param test: QEMU test object.
...
@@ -31,7 +31,7 @@ def run(test, params, env):
...
@@ -31,7 +31,7 @@ def run(test, params, env):
"""
"""
def
_drift_file_exist
():
def
_drift_file_exist
():
try
:
try
:
session
.
cmd
(
"test -f /var/lib/
ntp
/drift"
)
session
.
cmd
(
"test -f /var/lib/
chrony
/drift"
)
return
True
return
True
except
Exception
:
except
Exception
:
return
False
return
False
...
@@ -62,8 +62,8 @@ def run(test, params, env):
...
@@ -62,8 +62,8 @@ def run(test, params, env):
cmd
+=
" gcc -Wall -o time-warp-test time-warp-test.c -lrt"
cmd
+=
" gcc -Wall -o time-warp-test time-warp-test.c -lrt"
sess_guest_load
.
cmd
(
cmd
)
sess_guest_load
.
cmd
(
cmd
)
error_context
.
context
(
"Stop
ntp
d and apply load on guest"
,
logging
.
info
)
error_context
.
context
(
"Stop
chrony
d and apply load on guest"
,
logging
.
info
)
sess_guest_load
.
cmd
(
"
yum install -y ntp; service ntpd stop
"
)
sess_guest_load
.
cmd
(
"
systemctl stop chronyd
"
)
load_cmd
=
"for ((I=0; I<`grep 'processor id' /proc/cpuinfo| wc -l`; I++));"
load_cmd
=
"for ((I=0; I<`grep 'processor id' /proc/cpuinfo| wc -l`; I++));"
load_cmd
+=
" do taskset $(( 1 << $I )) /bin/bash -c 'for ((;;)); do X=1; done &';"
load_cmd
+=
" do taskset $(( 1 << $I )) /bin/bash -c 'for ((;;)); do X=1; done &';"
load_cmd
+=
" done"
load_cmd
+=
" done"
...
@@ -86,8 +86,8 @@ def run(test, params, env):
...
@@ -86,8 +86,8 @@ def run(test, params, env):
cmd
=
"/tmp/time-warp-test > /dev/null &"
cmd
=
"/tmp/time-warp-test > /dev/null &"
session
.
sendline
(
cmd
)
session
.
sendline
(
cmd
)
error_context
.
context
(
"Start
ntp
d on guest"
,
logging
.
info
)
error_context
.
context
(
"Start
chrony
d on guest"
,
logging
.
info
)
cmd
=
"s
ervice ntpd start
; sleep 1; echo"
cmd
=
"s
ystemctl start chronyd
; sleep 1; echo"
session
.
cmd
(
cmd
)
session
.
cmd
(
cmd
)
error_context
.
context
(
"Check if the drift file exists on guest"
,
error_context
.
context
(
"Check if the drift file exists on guest"
,
...
@@ -97,10 +97,10 @@ def run(test, params, env):
...
@@ -97,10 +97,10 @@ def run(test, params, env):
utils_misc
.
wait_for
(
_drift_file_exist
,
test_run_timeout
,
step
=
5
)
utils_misc
.
wait_for
(
_drift_file_exist
,
test_run_timeout
,
step
=
5
)
except
aexpect
.
ShellCmdError
as
detail
:
except
aexpect
.
ShellCmdError
as
detail
:
test
.
error
(
"Failed to wait for the creation of"
test
.
error
(
"Failed to wait for the creation of"
" /var/lib/
ntp
/drift file. Detail: '%s'"
%
detail
)
" /var/lib/
chronyd
/drift file. Detail: '%s'"
%
detail
)
error_context
.
context
(
"Verify the drift file content on guest"
,
error_context
.
context
(
"Verify the drift file content on guest"
,
logging
.
info
)
logging
.
info
)
output
=
session
.
cmd
(
"cat /var/lib/
ntp/drift"
)
output
=
session
.
cmd
(
"cat /var/lib/
chrony/drift"
).
strip
().
split
()[
0
]
if
int
(
abs
(
float
(
output
)))
>
20
:
if
int
(
abs
(
float
(
output
)))
>
20
:
test
.
fail
(
"Failed to check the
ntp
drift. Output: '%s'"
%
output
)
test
.
fail
(
"Failed to check the
chrony
drift. Output: '%s'"
%
output
)
qemu/tests/timerdevice_clock_drift_with_sleep.py
浏览文件 @
43bf981b
...
@@ -99,11 +99,6 @@ def run(test, params, env):
...
@@ -99,11 +99,6 @@ def run(test, params, env):
vm
.
verify_alive
()
vm
.
verify_alive
()
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
error_context
.
context
(
"Stop auto sync service in guest"
,
logging
.
info
)
cmd
=
"(service chronyd status | grep 'Loaded: loaded')"
cmd
+=
" && service chronyd stop"
session
.
cmd_status_output
(
cmd
)
error_context
.
context
(
"Sync time from guest to ntpserver"
,
logging
.
info
)
error_context
.
context
(
"Sync time from guest to ntpserver"
,
logging
.
info
)
session
.
cmd
(
ntp_sync_cmd
,
timeout
=
timeout
)
session
.
cmd
(
ntp_sync_cmd
,
timeout
=
timeout
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录