Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
da7daca3
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,发现更多精彩内容 >>
提交
da7daca3
编写于
4月 13, 2018
作者:
X
Xu Han
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[qemu] Python 3: Replace string
Signed-off-by:
N
Xu Han
<
xuhan@redhat.com
>
上级
96d6e516
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
27 addition
and
26 deletion
+27
-26
qemu/tests/cpuid.py
qemu/tests/cpuid.py
+11
-2
qemu/tests/guest_memory_dump_analysis.py
qemu/tests/guest_memory_dump_analysis.py
+3
-4
qemu/tests/multi_disk.py
qemu/tests/multi_disk.py
+1
-2
qemu/tests/pci_hotplug.py
qemu/tests/pci_hotplug.py
+2
-3
qemu/tests/pci_hotplug_check.py
qemu/tests/pci_hotplug_check.py
+2
-3
qemu/tests/physical_resources_check.py
qemu/tests/physical_resources_check.py
+7
-9
qemu/tests/virtio_scsi_mq.py
qemu/tests/virtio_scsi_mq.py
+1
-3
未找到文件。
qemu/tests/cpuid.py
浏览文件 @
da7daca3
...
@@ -3,7 +3,6 @@ Group of cpuid tests for X86 CPU
...
@@ -3,7 +3,6 @@ Group of cpuid tests for X86 CPU
"""
"""
import
re
import
re
import
os
import
os
import
string
import
logging
import
logging
from
avocado.utils
import
build
from
avocado.utils
import
build
...
@@ -19,6 +18,16 @@ dbg = logger.debug
...
@@ -19,6 +18,16 @@ dbg = logger.debug
info
=
logger
.
info
info
=
logger
.
info
def
isprintable
(
c
):
try
:
import
string
if
c
in
string
.
printable
:
return
True
return
False
except
ImportError
:
return
c
.
isprintable
()
def
run
(
test
,
params
,
env
):
def
run
(
test
,
params
,
env
):
"""
"""
Boot guest with different cpu_models and cpu flags and check if guest works correctly.
Boot guest with different cpu_models and cpu flags and check if guest works correctly.
...
@@ -446,7 +455,7 @@ def run(test, params, env):
...
@@ -446,7 +455,7 @@ def run(test, params, env):
for
i
in
regs
:
for
i
in
regs
:
for
shift
in
range
(
0
,
4
):
for
shift
in
range
(
0
,
4
):
c
=
chr
((
r
[
i
]
>>
(
shift
*
8
))
&
0xFF
)
c
=
chr
((
r
[
i
]
>>
(
shift
*
8
))
&
0xFF
)
if
c
in
string
.
printable
:
if
isprintable
(
c
)
:
signature
=
signature
+
c
signature
=
signature
+
c
else
:
else
:
signature
=
"%s
\\
x%02x"
%
(
signature
,
ord
(
c
))
signature
=
"%s
\\
x%02x"
%
(
signature
,
ord
(
c
))
...
...
qemu/tests/guest_memory_dump_analysis.py
浏览文件 @
da7daca3
...
@@ -9,7 +9,6 @@ Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=990118
...
@@ -9,7 +9,6 @@ Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=990118
"""
"""
import
logging
import
logging
import
string
import
os
import
os
import
gzip
import
gzip
import
threading
import
threading
...
@@ -138,7 +137,7 @@ def run(test, params, env):
...
@@ -138,7 +137,7 @@ def run(test, params, env):
logging
.
debug
(
"%s"
,
output
)
logging
.
debug
(
"%s"
,
output
)
output
=
session
.
cmd
(
"LC_ALL=C df --portability --block-size=1M ."
)
output
=
session
.
cmd
(
"LC_ALL=C df --portability --block-size=1M ."
)
logging
.
debug
(
"%s"
,
output
)
logging
.
debug
(
"%s"
,
output
)
df_megs
=
int
(
string
.
split
(
output
)[
10
])
df_megs
=
int
(
output
.
split
(
)[
10
])
if
(
df_megs
<
REQ_GUEST_DF
):
if
(
df_megs
<
REQ_GUEST_DF
):
test
.
error
(
"insufficient free disk space: %d < %d"
%
test
.
error
(
"insufficient free disk space: %d < %d"
%
(
df_megs
,
REQ_GUEST_DF
))
(
df_megs
,
REQ_GUEST_DF
))
...
@@ -259,8 +258,8 @@ def run(test, params, env):
...
@@ -259,8 +258,8 @@ def run(test, params, env):
"/usr/lib/debug/lib/modules/$(uname -r)/vmlinux "
"/usr/lib/debug/lib/modules/$(uname -r)/vmlinux "
"%s"
%
(
CRASH_SCRIPT
,
guest_plain
))
"%s"
%
(
CRASH_SCRIPT
,
guest_plain
))
logging
.
debug
(
"%s"
,
output
)
logging
.
debug
(
"%s"
,
output
)
if
(
string
.
find
(
output
,
"crash:"
)
>=
0
or
if
(
output
.
find
(
"crash:"
)
>=
0
or
string
.
find
(
output
,
"WARNING:"
)
>=
0
):
output
.
find
(
"WARNING:"
)
>=
0
):
test
.
fail
(
"vmcore corrupt"
)
test
.
fail
(
"vmcore corrupt"
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
...
...
qemu/tests/multi_disk.py
浏览文件 @
da7daca3
...
@@ -6,7 +6,6 @@ multi_disk test for Autotest framework.
...
@@ -6,7 +6,6 @@ multi_disk test for Autotest framework.
import
logging
import
logging
import
re
import
re
import
random
import
random
import
string
from
avocado.utils
import
astring
from
avocado.utils
import
astring
...
@@ -287,7 +286,7 @@ def run(test, params, env):
...
@@ -287,7 +286,7 @@ def run(test, params, env):
output
=
session
.
cmd_output
(
cmd
,
timeout
=
cmd_timeout
)
output
=
session
.
cmd_output
(
cmd
,
timeout
=
cmd_timeout
)
disks
=
re
.
findall
(
re_str
,
output
)
disks
=
re
.
findall
(
re_str
,
output
)
disks
=
list
(
map
(
string
.
strip
,
disks
))
disks
=
[
item
.
strip
()
for
item
in
disks
]
disks
.
sort
()
disks
.
sort
()
logging
.
debug
(
"Volume list that meet regular expressions: %s"
,
logging
.
debug
(
"Volume list that meet regular expressions: %s"
,
" "
.
join
(
disks
))
" "
.
join
(
disks
))
...
...
qemu/tests/pci_hotplug.py
浏览文件 @
da7daca3
import
re
import
re
import
logging
import
logging
import
string
import
aexpect
import
aexpect
from
virttest
import
error_context
from
virttest
import
error_context
...
@@ -209,8 +208,8 @@ def run(test, params, env):
...
@@ -209,8 +208,8 @@ def run(test, params, env):
# Define a helper function to catch PCI device string
# Define a helper function to catch PCI device string
def
_find_pci
():
def
_find_pci
():
output
=
session
.
cmd_output
(
params
.
get
(
"find_pci_cmd"
))
output
=
session
.
cmd_output
(
params
.
get
(
"find_pci_cmd"
))
output
=
map
(
string
.
strip
,
output
.
splitlines
())
output
=
[
line
.
strip
()
for
line
in
output
.
splitlines
()]
ref
=
map
(
string
.
strip
,
reference
.
splitlines
())
ref
=
[
line
.
strip
()
for
line
in
reference
.
splitlines
()]
output
=
[
_
for
_
in
output
if
_
not
in
ref
]
output
=
[
_
for
_
in
output
if
_
not
in
ref
]
output
=
"
\n
"
.
join
(
output
)
output
=
"
\n
"
.
join
(
output
)
if
re
.
search
(
params
.
get
(
"match_string"
),
output
,
re
.
I
|
re
.
M
):
if
re
.
search
(
params
.
get
(
"match_string"
),
output
,
re
.
I
|
re
.
M
):
...
...
qemu/tests/pci_hotplug_check.py
浏览文件 @
da7daca3
...
@@ -2,7 +2,6 @@ import re
...
@@ -2,7 +2,6 @@ import re
import
logging
import
logging
import
time
import
time
import
random
import
random
import
string
import
aexpect
import
aexpect
...
@@ -213,8 +212,8 @@ def run(test, params, env):
...
@@ -213,8 +212,8 @@ def run(test, params, env):
# Define a helper function to catch PCI device string
# Define a helper function to catch PCI device string
def
_find_pci
():
def
_find_pci
():
output
=
session
.
cmd_output
(
params
.
get
(
"find_pci_cmd"
))
output
=
session
.
cmd_output
(
params
.
get
(
"find_pci_cmd"
))
output
=
map
(
string
.
strip
,
output
.
splitlines
())
output
=
[
line
.
strip
()
for
line
in
output
.
splitlines
()]
ref
=
map
(
string
.
strip
,
reference
.
splitlines
())
ref
=
[
line
.
strip
()
for
line
in
reference
.
splitlines
()]
output
=
[
_
for
_
in
output
if
_
not
in
ref
]
output
=
[
_
for
_
in
output
if
_
not
in
ref
]
output
=
"
\n
"
.
join
(
output
)
output
=
"
\n
"
.
join
(
output
)
if
re
.
search
(
params
.
get
(
"match_string"
),
output
,
re
.
I
):
if
re
.
search
(
params
.
get
(
"match_string"
),
output
,
re
.
I
):
...
...
qemu/tests/physical_resources_check.py
浏览文件 @
da7daca3
import
re
import
re
import
string
import
logging
import
logging
import
random
import
random
...
@@ -42,7 +41,7 @@ def run(test, params, env):
...
@@ -42,7 +41,7 @@ def run(test, params, env):
f_fail
.
append
(
fail_log
)
f_fail
.
append
(
fail_log
)
logging
.
error
(
fail_log
)
logging
.
error
(
fail_log
)
actual_num
=
string
.
count
(
o
,
check_str
)
actual_num
=
o
.
count
(
check_str
)
if
expected_num
!=
actual_num
:
if
expected_num
!=
actual_num
:
fail_log
=
"%s number mismatch:
\n
"
%
str
(
devices
)
fail_log
=
"%s number mismatch:
\n
"
%
str
(
devices
)
fail_log
+=
" Assigned to VM: %d
\n
"
%
expected_num
fail_log
+=
" Assigned to VM: %d
\n
"
%
expected_num
...
@@ -90,7 +89,7 @@ def run(test, params, env):
...
@@ -90,7 +89,7 @@ def run(test, params, env):
actual
=
session
.
cmd_output
(
verify_cmd
)
actual
=
session
.
cmd_output
(
verify_cmd
)
if
not
re
.
findall
(
expect
,
actual
,
re
.
I
):
if
not
re
.
findall
(
expect
,
actual
,
re
.
I
):
fail_log
=
"%s mismatch:
\n
"
%
name
fail_log
=
"%s mismatch:
\n
"
%
name
fail_log
+=
" Assigned to VM: %s
\n
"
%
string
.
upper
(
expect
)
fail_log
+=
" Assigned to VM: %s
\n
"
%
expect
.
upper
(
)
fail_log
+=
" Reported by OS: %s"
%
actual
fail_log
+=
" Reported by OS: %s"
%
actual
f_fail
.
append
(
fail_log
)
f_fail
.
append
(
fail_log
)
logging
.
error
(
fail_log
)
logging
.
error
(
fail_log
)
...
@@ -121,8 +120,7 @@ def run(test, params, env):
...
@@ -121,8 +120,7 @@ def run(test, params, env):
logging
.
error
(
fail_log
)
logging
.
error
(
fail_log
)
return
-
2
return
-
2
logging
.
info
(
"CPU %s number: %d"
,
logging
.
info
(
"CPU %s number: %d"
,
chk_type
.
capitalize
(),
int
(
num
[
-
1
]))
string
.
capitalize
(
chk_type
),
int
(
num
[
-
1
]))
return
int
(
num
[
-
1
])
return
int
(
num
[
-
1
])
def
check_cpu_number
(
chk_type
,
actual_n
,
expected_n
):
def
check_cpu_number
(
chk_type
,
actual_n
,
expected_n
):
...
@@ -149,10 +147,10 @@ def run(test, params, env):
...
@@ -149,10 +147,10 @@ def run(test, params, env):
f_fail
.
append
(
fail_log
)
f_fail
.
append
(
fail_log
)
return
f_fail
return
f_fail
logging
.
info
(
"CPU %s number check"
,
string
.
capitalize
(
chk_type
))
logging
.
info
(
"CPU %s number check"
,
chk_type
.
capitalize
(
))
if
actual_n
!=
expected_n
:
if
actual_n
!=
expected_n
:
fail_log
=
"%s output mismatch:
\n
"
%
string
.
capitalize
(
chk_type
)
fail_log
=
"%s output mismatch:
\n
"
%
chk_type
.
capitalize
(
)
fail_log
+=
" Assigned to VM: '%s'
\n
"
%
expected_n
fail_log
+=
" Assigned to VM: '%s'
\n
"
%
expected_n
fail_log
+=
" Reported by OS: '%s'"
%
actual_n
fail_log
+=
" Reported by OS: '%s'"
%
actual_n
f_fail
.
append
(
fail_log
)
f_fail
.
append
(
fail_log
)
...
@@ -160,7 +158,7 @@ def run(test, params, env):
...
@@ -160,7 +158,7 @@ def run(test, params, env):
return
f_fail
return
f_fail
logging
.
debug
(
"%s check pass. Expected: '%s', Actual: '%s'"
,
logging
.
debug
(
"%s check pass. Expected: '%s', Actual: '%s'"
,
string
.
capitalize
(
chk_type
),
expected_n
,
actual_n
)
chk_type
.
capitalize
(
),
expected_n
,
actual_n
)
return
f_fail
return
f_fail
def
verify_machine_type
():
def
verify_machine_type
():
...
@@ -344,7 +342,7 @@ def run(test, params, env):
...
@@ -344,7 +342,7 @@ def run(test, params, env):
num_nics
=
len
(
params
.
objects
(
"nics"
))
num_nics
=
len
(
params
.
objects
(
"nics"
))
for
nic_index
in
range
(
num_nics
):
for
nic_index
in
range
(
num_nics
):
mac
=
vm
.
get_mac_address
(
nic_index
)
mac
=
vm
.
get_mac_address
(
nic_index
)
if
string
.
lower
(
mac
)
not
in
found_mac_addresses
:
if
mac
.
lower
(
)
not
in
found_mac_addresses
:
fail_log
=
"MAC address mismatch:
\n
"
fail_log
=
"MAC address mismatch:
\n
"
fail_log
+=
" Assigned to VM (not found): %s"
%
mac
fail_log
+=
" Assigned to VM (not found): %s"
%
mac
n_fail
.
append
(
fail_log
)
n_fail
.
append
(
fail_log
)
...
...
qemu/tests/virtio_scsi_mq.py
浏览文件 @
da7daca3
import
logging
import
logging
import
re
import
re
import
time
import
time
import
string
from
avocado.utils
import
cpu
as
utils_cpu
from
avocado.utils
import
cpu
as
utils_cpu
from
virttest
import
utils_misc
from
virttest
import
utils_misc
...
@@ -165,8 +164,7 @@ def run(test, params, env):
...
@@ -165,8 +164,7 @@ def run(test, params, env):
error_context
.
context
(
"Load I/O in all targets"
,
logging
.
info
)
error_context
.
context
(
"Load I/O in all targets"
,
logging
.
info
)
get_dev_cmd
=
params
.
get
(
"get_dev_cmd"
,
"ls /dev/[svh]d*"
)
get_dev_cmd
=
params
.
get
(
"get_dev_cmd"
,
"ls /dev/[svh]d*"
)
output
=
session
.
cmd_output
(
get_dev_cmd
)
output
=
session
.
cmd_output
(
get_dev_cmd
)
system_dev
=
re
.
findall
(
r
"/dev/[svh]d\w+\d+"
,
output
)[
0
]
system_dev
=
re
.
findall
(
r
"/dev/[svh]d\w+(?=\d+)"
,
output
)[
0
]
system_dev
=
system_dev
.
rstrip
(
string
.
digits
)
dd_timeout
=
int
(
re
.
findall
(
r
"\d+"
,
extra_image_size
)[
0
])
dd_timeout
=
int
(
re
.
findall
(
r
"\d+"
,
extra_image_size
)[
0
])
fill_cmd
=
""
fill_cmd
=
""
count
=
0
count
=
0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录