Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
67525eef
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,发现更多精彩内容 >>
未验证
提交
67525eef
编写于
3月 05, 2020
作者:
L
Longxiang Lyu
提交者:
GitHub
3月 05, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2044 from hellohellenmao/1786420
New case of check_reports_end_offset
上级
1144043a
04fb0a34
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
62 addition
and
0 deletion
+62
-0
qemu/tests/cfg/check_reports_end_offset.cfg
qemu/tests/cfg/check_reports_end_offset.cfg
+13
-0
qemu/tests/check_reports_end_offset.py
qemu/tests/check_reports_end_offset.py
+49
-0
未找到文件。
qemu/tests/cfg/check_reports_end_offset.cfg
0 → 100755
浏览文件 @
67525eef
- check_reports_end_offset:
only qcow2
virt_test_type = qemu
type = check_reports_end_offset
start_vm = no
create_image = yes
remove_image = yes
images = "report"
image_name_report = "images/report"
image_size_report = 20G
image_end_offset = 262144
human_key = "Image end offset"
json_key = "image-end-offset"
qemu/tests/check_reports_end_offset.py
0 → 100755
浏览文件 @
67525eef
import
logging
import
re
import
json
from
virttest
import
data_dir
from
virttest.qemu_storage
import
QemuImg
def
run
(
test
,
params
,
env
):
"""
'qemu-img check' should report the end offset of the image.
1. Create a test qcow2 image.
2. Check there is image end offset and the value with both "humam"
and "json" output.
:param test: Qemu test object.
:param params: Dictionary with the test parameters.
:param env: Dictionary with test environment.
"""
def
_check_result
(
key
,
offset
,
output
):
"""Check the keywords and the value from the output."""
if
key
not
in
output
or
int
(
offset
)
!=
int
(
output
[
key
]):
test
.
fail
(
"The keyword/value is no correct. Check please."
)
report
=
params
[
"images"
]
root_dir
=
data_dir
.
get_data_dir
()
report
=
QemuImg
(
params
.
object_params
(
report
),
root_dir
,
report
)
offset
=
params
[
"image_end_offset"
]
human_key
=
params
[
"human_key"
]
json_key
=
params
[
"json_key"
]
logging
.
info
(
"Create the test image file."
)
report
.
create
(
report
.
params
)
# 'qemu-img check' the image and check the output info.
check_result
=
report
.
check
(
report
.
params
,
root_dir
,
output
=
"human"
).
stdout
.
decode
()
if
not
check_result
:
test
.
error
(
"There is no output of check command, check please."
)
logging
.
debug
(
"The check output with human output format: %s"
,
check_result
)
result_dict
=
dict
(
re
.
findall
(
r
'(.+):\s(.+)'
,
check_result
))
_check_result
(
human_key
,
offset
,
result_dict
)
check_result
=
report
.
check
(
report
.
params
,
root_dir
,
output
=
"json"
).
stdout
.
decode
()
if
not
check_result
:
test
.
error
(
"There is no output of check command, check please."
)
logging
.
debug
(
"The check output with json output format: %s"
,
check_result
)
_check_result
(
json_key
,
offset
,
json
.
loads
(
check_result
))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录