Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
c556e47c
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,发现更多精彩内容 >>
未验证
提交
c556e47c
编写于
4月 13, 2018
作者:
X
Xu Han
提交者:
GitHub
4月 13, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1335 from luckyh/qemu-python3-replace-commands
[qemu] Python 3: Replace commands
上级
cf8631fe
06ac4ffb
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
47 addition
and
27 deletion
+47
-27
qemu/tests/kernbench.py
qemu/tests/kernbench.py
+2
-2
qemu/tests/ksm_base.py
qemu/tests/ksm_base.py
+8
-4
qemu/tests/performance.py
qemu/tests/performance.py
+5
-4
qemu/tests/qemu_img.py
qemu/tests/qemu_img.py
+6
-4
qemu/tests/qmp_event_notification.py
qemu/tests/qmp_event_notification.py
+7
-2
qemu/tests/stepmaker.py
qemu/tests/stepmaker.py
+3
-2
qemu/tests/timedrift.py
qemu/tests/timedrift.py
+11
-6
qemu/tests/tsc_drift.py
qemu/tests/tsc_drift.py
+5
-3
未找到文件。
qemu/tests/kernbench.py
浏览文件 @
c556e47c
import
logging
import
commands
import
os
import
re
...
...
@@ -32,7 +31,8 @@ def run(test, params, env):
if
"guest"
in
test_type
:
(
s
,
o
)
=
session
.
cmd_status_output
(
cmd
,
timeout
=
timeout
)
else
:
(
s
,
o
)
=
commands
.
getstatusoutput
(
cmd
)
cmd_result
=
process
.
run
(
cmd
,
ignore_status
=
True
,
shell
=
True
)
(
s
,
o
)
=
cmd_result
.
exit_status
,
cmd_result
.
stdout
return
(
s
,
o
)
def
check_ept
():
...
...
qemu/tests/ksm_base.py
浏览文件 @
c556e47c
...
...
@@ -2,11 +2,12 @@ import logging
import
time
import
random
import
os
import
commands
import
re
import
aexpect
from
avocado.utils
import
process
from
virttest
import
data_dir
from
virttest
import
error_context
from
virttest
import
utils_misc
...
...
@@ -99,7 +100,8 @@ def run(test, params, env):
query_cmd
=
re
.
sub
(
"QEMU_PID"
,
str
(
vm
.
process
.
get_pid
()),
query_cmd
)
_
,
sharing_page_0
=
commands
.
getstatusoutput
(
query_cmd
)
sharing_page_0
=
process
.
system_output
(
query_cmd
,
verbose
=
False
,
ignore_status
=
True
,
shell
=
True
)
if
query_regex
:
sharing_page_0
=
re
.
findall
(
query_regex
,
sharing_page_0
)[
0
]
...
...
@@ -112,7 +114,8 @@ def run(test, params, env):
_execute_allocator
(
cmd
,
vm
,
session
,
fill_timeout
)
time
.
sleep
(
120
)
_
,
sharing_page_1
=
commands
.
getstatusoutput
(
query_cmd
)
sharing_page_1
=
process
.
system_output
(
query_cmd
,
verbose
=
False
,
ignore_status
=
True
,
shell
=
True
)
if
query_regex
:
sharing_page_1
=
re
.
findall
(
query_regex
,
sharing_page_1
)[
0
]
...
...
@@ -127,7 +130,8 @@ def run(test, params, env):
_execute_allocator
(
cmd
,
vm
,
session
,
fill_timeout
)
time
.
sleep
(
120
)
_
,
sharing_page_2
=
commands
.
getstatusoutput
(
query_cmd
)
sharing_page_2
=
process
.
system_output
(
query_cmd
,
verbose
=
False
,
ignore_status
=
True
,
shell
=
True
)
if
query_regex
:
sharing_page_2
=
re
.
findall
(
query_regex
,
sharing_page_2
)[
0
]
...
...
qemu/tests/performance.py
浏览文件 @
c556e47c
import
os
import
re
import
commands
import
shutil
import
shelve
import
threading
...
...
@@ -31,12 +30,14 @@ def cmd_runner_monitor(test, vm, monitor_cmd, test_cmd,
"""
def
thread_kill
(
cmd
,
p_file
):
fd
=
shelve
.
open
(
p_file
)
o
=
commands
.
getoutput
(
"pstree -p %s"
%
fd
[
"pid"
])
o
=
process
.
system_output
(
"pstree -p %s"
%
fd
[
"pid"
],
verbose
=
False
,
ignore_status
=
True
)
tmp
=
re
.
split
(
r
"\s+"
,
cmd
)[
0
]
pid
=
re
.
findall
(
r
"%s.(\d+)"
%
tmp
,
o
)[
0
]
s
,
o
=
commands
.
getstatusoutput
(
"kill -9 %s"
%
pid
)
cmd_result
=
process
.
run
(
"kill -9 %s"
%
pid
,
verbose
=
False
,
ignore_status
=
True
)
fd
.
close
()
return
(
s
,
o
)
return
(
cmd_result
.
exit_status
,
cmd_result
.
stdout
)
def
monitor_thread
(
m_cmd
,
p_file
,
r_file
):
fd
=
shelve
.
open
(
p_file
)
...
...
qemu/tests/qemu_img.py
浏览文件 @
c556e47c
...
...
@@ -2,7 +2,6 @@ import os
import
time
import
re
import
logging
import
commands
import
shutil
import
tempfile
...
...
@@ -343,13 +342,15 @@ def run(test, params, env):
image_name
,
crtcmd
)
error_context
.
context
(
msg
,
logging
.
info
)
status
,
output
=
commands
.
getstatusoutput
(
crtcmd
)
cmd_result
=
process
.
run
(
crtcmd
,
verbose
=
False
,
ignore_status
=
True
)
status
,
output
=
cmd_result
.
exit_status
,
cmd_result
.
stdout
if
status
!=
0
:
test
.
fail
(
"Create snapshot failed via command: %s;"
"Output is: %s"
%
(
crtcmd
,
output
))
listcmd
=
cmd
listcmd
+=
" -l %s"
%
image_name
status
,
out
=
commands
.
getstatusoutput
(
listcmd
)
cmd_result
=
process
.
run
(
listcmd
,
verbose
=
False
,
ignore_status
=
True
)
status
,
out
=
cmd_result
.
exit_status
,
cmd_result
.
stdout
if
not
(
"snapshot0"
in
out
and
"snapshot1"
in
out
and
status
==
0
):
test
.
fail
(
"Snapshot created failed or missed;"
"snapshot list is:
\n
%s"
%
out
)
...
...
@@ -359,7 +360,8 @@ def run(test, params, env):
delcmd
+=
" -d %s %s"
%
(
sn_name
,
image_name
)
msg
=
"Delete snapshot '%s' by command %s"
%
(
sn_name
,
delcmd
)
error_context
.
context
(
msg
,
logging
.
info
)
status
,
output
=
commands
.
getstatusoutput
(
delcmd
)
cmd_result
=
process
.
run
(
delcmd
,
verbose
=
False
,
ignore_status
=
True
)
status
,
output
=
cmd_result
.
exit_status
,
cmd_result
.
stdout
if
status
!=
0
:
test
.
fail
(
"Delete snapshot '%s' failed: %s"
%
(
sn_name
,
output
))
...
...
qemu/tests/qmp_event_notification.py
浏览文件 @
c556e47c
import
logging
import
time
import
commands
from
functools
import
partial
from
avocado.utils
import
process
from
virttest
import
utils_misc
_system_output
=
partial
(
process
.
system_output
,
shell
=
True
)
def
run
(
test
,
params
,
env
):
"""
Test qmp event notification function:
...
...
@@ -28,7 +33,7 @@ def run(test, params, env):
qmp_monitor
=
list
(
filter
(
lambda
x
:
x
.
protocol
==
"qmp"
,
vm
.
monitors
))[
0
]
humam_monitor
=
list
(
filter
(
lambda
x
:
x
.
protocol
==
"human"
,
vm
.
monitors
))[
0
]
callback
=
{
"host_cmd"
:
commands
.
get
output
,
callback
=
{
"host_cmd"
:
_system_
output
,
"guest_cmd"
:
session
.
cmd
,
"monitor_cmd"
:
humam_monitor
.
send_args_cmd
,
"qmp_cmd"
:
qmp_monitor
.
send_args_cmd
}
...
...
qemu/tests/stepmaker.py
浏览文件 @
c556e47c
...
...
@@ -9,13 +9,14 @@ Step file creator/editor.
import
time
import
os
import
commands
import
logging
import
pygtk
import
gtk
import
gobject
from
avocado.utils
import
process
from
virttest
import
utils_misc
from
virttest
import
ppm_utils
from
virttest
import
step_editor
...
...
@@ -63,7 +64,7 @@ class StepMaker(step_editor.StepMakerWindow):
self
.
steps_file
.
write
(
"# Generated by Step Maker
\n
"
)
self
.
steps_file
.
write
(
"# Generated on %s
\n
"
%
time
.
asctime
())
self
.
steps_file
.
write
(
"# uname -a: %s
\n
"
%
commands
.
getoutput
(
"uname -a"
))
process
.
system_output
(
"uname -a"
,
verbose
=
False
))
self
.
steps_file
.
flush
()
self
.
vars_file
.
write
(
"# This file lists the vars used during recording"
...
...
qemu/tests/timedrift.py
浏览文件 @
c556e47c
import
logging
import
time
import
commands
import
aexpect
from
avocado.utils
import
process
from
virttest
import
utils_test
...
...
@@ -35,13 +37,16 @@ def run(test, params, env):
:param mask: The CPU affinity mask.
:return: A dict containing the previous mask for each thread.
"""
tids
=
commands
.
getoutput
(
"ps -L --pid=%s -o lwp="
%
pid
).
split
()
tids
=
process
.
system_output
(
"ps -L --pid=%s -o lwp="
%
pid
,
verbose
=
False
).
split
()
prev_masks
=
{}
for
tid
in
tids
:
prev_mask
=
commands
.
getoutput
(
"taskset -p %s"
%
tid
).
split
()[
-
1
]
prev_mask
=
process
.
system_output
(
"taskset -p %s"
%
tid
,
verbose
=
False
).
split
()[
-
1
]
prev_masks
[
tid
]
=
prev_mask
commands
.
getoutput
(
"taskset -p %s %s"
%
(
mask
,
tid
))
children
=
commands
.
getoutput
(
"ps --ppid=%s -o pid="
%
pid
).
split
()
process
.
system
(
"taskset -p %s %s"
%
(
mask
,
tid
),
verbose
=
False
)
children
=
process
.
system_output
(
"ps --ppid=%s -o pid="
%
pid
,
verbose
=
False
).
split
()
for
child
in
children
:
prev_masks
.
update
(
set_cpu_affinity
(
child
,
mask
))
return
prev_masks
...
...
@@ -53,7 +58,7 @@ def run(test, params, env):
:param prev_masks: A dict containing TIDs as keys and masks as values.
"""
for
tid
,
mask
in
prev_masks
.
items
():
commands
.
getoutput
(
"taskset -p %s %s"
%
(
mask
,
tid
)
)
process
.
system
(
"taskset -p %s %s"
%
(
mask
,
tid
),
verbose
=
False
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
...
...
qemu/tests/tsc_drift.py
浏览文件 @
c556e47c
import
time
import
os
import
logging
import
commands
import
re
from
avocado.utils
import
cpu
from
avocado.utils
import
process
from
virttest
import
data_dir
...
...
@@ -40,7 +41,8 @@ def run(test, params, env):
tsc_cmd
=
tsc_cmd_host
cmd
=
"taskset %s %s"
%
(
1
<<
i
,
tsc_cmd
)
if
machine
==
"host"
:
s
,
o
=
commands
.
getstatusoutput
(
cmd
)
result
=
process
.
run
(
cmd
,
ignore_status
=
True
)
s
,
o
=
result
.
exit_status
,
result
.
stdout
else
:
s
,
o
=
session
.
cmd_status_output
(
cmd
)
if
s
!=
0
:
...
...
@@ -54,7 +56,7 @@ def run(test, params, env):
session
=
vm
.
wait_for_login
(
timeout
=
int
(
params
.
get
(
"login_timeout"
,
360
)))
if
not
os
.
path
.
exists
(
tsc_cmd_guest
):
commands
.
getoutput
(
"gcc %s"
%
tsc_freq_path
)
process
.
run
(
"gcc %s"
%
tsc_freq_path
)
ncpu
=
cpu
.
online_cpus_count
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录