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