Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
7086330f
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,发现更多精彩内容 >>
提交
7086330f
编写于
4月 08, 2014
作者:
L
Lucas Meneghel Rodrigues
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #61 from FengYang/qemu_disk_img
qemu.tests.qemu_disk_img: Do not use -c parameter in md5sum command.
上级
daebe92f
012b49d9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
22 deletion
+32
-22
qemu/tests/cfg/qemu_disk_img.cfg
qemu/tests/cfg/qemu_disk_img.cfg
+4
-4
qemu/tests/qemu_disk_img.py
qemu/tests/qemu_disk_img.py
+17
-9
qemu/tests/qemu_disk_img_commit.py
qemu/tests/qemu_disk_img_commit.py
+3
-3
qemu/tests/qemu_disk_img_convert.py
qemu/tests/qemu_disk_img_convert.py
+3
-3
qemu/tests/qemu_disk_img_rebase.py
qemu/tests/qemu_disk_img_rebase.py
+5
-3
未找到文件。
qemu/tests/cfg/qemu_disk_img.cfg
浏览文件 @
7086330f
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
type = qemu_disk_img_rebase
type = qemu_disk_img_rebase
rebase_mode = safe
rebase_mode = safe
base_format = qcow2
base_format = qcow2
guest_file_name_image1 = "${tmp_dir}/
base
"
guest_file_name_image1 = "${tmp_dir}/
test.img
"
image_chain += " snA snB"
image_chain += " snA snB"
image_name_snA = "images/snA"
image_name_snA = "images/snA"
image_name_snB = "images/snB"
image_name_snB = "images/snB"
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
guest_file_name_snB = "${tmp_dir}/snB"
guest_file_name_snB = "${tmp_dir}/snB"
variants:
variants:
- snB:
- snB:
check_files = "${tmp_dir}/
base
${tmp_dir}/snA ${tmp_dir}/snB"
check_files = "${tmp_dir}/
test.img
${tmp_dir}/snA ${tmp_dir}/snB"
variants:
variants:
- to_base:
- to_base:
rebase_list = "snB > image1"
rebase_list = "snB > image1"
...
@@ -64,7 +64,7 @@
...
@@ -64,7 +64,7 @@
image_chain += " snC"
image_chain += " snC"
image_name_snC = "images/snC"
image_name_snC = "images/snC"
guest_file_name_snC = "${tmp_dir}/snC"
guest_file_name_snC = "${tmp_dir}/snC"
check_files = "${tmp_dir}/
base
${tmp_dir}/snA ${tmp_dir}/snB ${tmp_dir}/snC"
check_files = "${tmp_dir}/
test.img
${tmp_dir}/snA ${tmp_dir}/snB ${tmp_dir}/snC"
variants:
variants:
- to_base:
- to_base:
rebase_list = "snC > image1"
rebase_list = "snC > image1"
...
@@ -85,7 +85,7 @@
...
@@ -85,7 +85,7 @@
image_name_snD = "images/snD"
image_name_snD = "images/snD"
guest_file_name_snC = "${tmp_dir}/snC"
guest_file_name_snC = "${tmp_dir}/snC"
guest_file_name_snD = "${tmp_dir}/snD"
guest_file_name_snD = "${tmp_dir}/snD"
check_files = "${tmp_dir}/
base
${tmp_dir}/snA ${tmp_dir}/snB ${tmp_dir}/snC ${tmp_dir}/snD"
check_files = "${tmp_dir}/
test.img
${tmp_dir}/snA ${tmp_dir}/snB ${tmp_dir}/snC ${tmp_dir}/snD"
variants:
variants:
- to_snB_snA_base:
- to_snB_snA_base:
rebase_list = "snD > snB; snD > snA; snD > image1"
rebase_list = "snD > snB; snD > snA; snD > image1"
qemu/tests/qemu_disk_img.py
浏览文件 @
7086330f
import
os
import
os
import
re
import
logging
import
logging
from
autotest.client.shared
import
error
from
autotest.client.shared
import
error
from
autotest.client
import
utils
from
autotest.client
import
utils
...
@@ -80,24 +81,31 @@ class QemuImgTest(qemu_storage.QemuImg):
...
@@ -80,24 +81,31 @@ class QemuImgTest(qemu_storage.QemuImg):
session
=
self
.
vm
.
wait_for_login
(
timeout
=
login_timeout
)
session
=
self
.
vm
.
wait_for_login
(
timeout
=
login_timeout
)
md5bin
=
self
.
params
[
"md5sum_bin"
]
md5bin
=
self
.
params
[
"md5sum_bin"
]
cmd
=
"%s %s"
%
(
md5bin
,
cmd
)
cmd
=
"%s %s"
%
(
md5bin
,
cmd
)
s
,
o
=
session
.
cmd_status_output
(
cmd
)
status
,
output
=
session
.
cmd_status_output
(
cmd
)
if
s
!=
0
:
if
status
!=
0
:
logging
.
info
(
"Execute '%s' with failures('%s') "
%
(
cmd
,
o
))
logging
.
info
(
"Execute '%s' with failures('%s') "
%
(
cmd
,
output
))
return
False
return
None
return
True
md5
=
re
.
findall
(
"\w{32}"
,
output
)[
0
]
return
md5
@
error
.
context_aware
@
error
.
context_aware
def
save_file
(
self
,
dst
):
def
save_file
(
self
,
dst
):
error
.
context
(
"save file('%s') md5sum in guest"
%
dst
,
logging
.
info
)
error
.
context
(
"save file('%s') md5sum in guest"
%
dst
,
logging
.
info
)
self
.
__create_file
(
dst
)
self
.
__create_file
(
dst
)
cmd
=
"%s > %s.md5 "
%
(
dst
,
dst
)
cmd
=
dst
return
self
.
__md5sum
(
cmd
)
return
self
.
__md5sum
(
cmd
)
@
error
.
context_aware
@
error
.
context_aware
def
check_file
(
self
,
dst
):
def
check_file
(
self
,
dst
,
md5
):
error
.
context
(
"check file('%s') md5sum in guest"
%
dst
,
logging
.
info
)
error
.
context
(
"check file('%s') md5sum in guest"
%
dst
,
logging
.
info
)
cmd
=
"-c %s.md5 "
%
dst
cmd
=
" %s"
%
dst
return
self
.
__md5sum
(
cmd
)
if
md5
==
self
.
__md5sum
(
cmd
):
return
True
else
:
err
=
"Md5 value does not match. Expected value: %s"
%
md5
err
+=
"Actual value: %s"
%
self
.
__md5sum
(
cmd
)
logging
.
error
(
err
)
return
False
@
error
.
context_aware
@
error
.
context_aware
def
destroy_vm
(
self
):
def
destroy_vm
(
self
):
...
...
qemu/tests/qemu_disk_img_commit.py
浏览文件 @
7086330f
...
@@ -41,15 +41,15 @@ def run(test, params, env):
...
@@ -41,15 +41,15 @@ def run(test, params, env):
commit_test
.
start_vm
(
n_params
)
commit_test
.
start_vm
(
n_params
)
# save file md5sum before commit
# save file md5sum before commit
ret
=
commit_test
.
save_file
(
t_file
)
md5
=
commit_test
.
save_file
(
t_file
)
if
not
ret
:
if
not
md5
:
raise
error
.
TestError
(
"Fail to save tmp file"
)
raise
error
.
TestError
(
"Fail to save tmp file"
)
commit_test
.
destroy_vm
()
commit_test
.
destroy_vm
()
commit_test
.
commit
()
commit_test
.
commit
()
commit_test
.
start_vm
(
params
)
commit_test
.
start_vm
(
params
)
# check md5sum after commit
# check md5sum after commit
ret
=
commit_test
.
check_file
(
t_file
)
ret
=
commit_test
.
check_file
(
t_file
,
md5
)
if
not
ret
:
if
not
ret
:
raise
error
.
TestError
(
"image content changed after commit"
)
raise
error
.
TestError
(
"image content changed after commit"
)
commit_test
.
clean
()
commit_test
.
clean
()
qemu/tests/qemu_disk_img_convert.py
浏览文件 @
7086330f
...
@@ -49,15 +49,15 @@ def run(test, params, env):
...
@@ -49,15 +49,15 @@ def run(test, params, env):
convert_test
.
start_vm
(
n_params
)
convert_test
.
start_vm
(
n_params
)
# save file md5sum before conversion
# save file md5sum before conversion
ret
=
convert_test
.
save_file
(
t_file
)
md5
=
convert_test
.
save_file
(
t_file
)
if
not
ret
:
if
not
md5
:
raise
error
.
TestError
(
"Fail to save tmp file"
)
raise
error
.
TestError
(
"Fail to save tmp file"
)
convert_test
.
destroy_vm
()
convert_test
.
destroy_vm
()
n_params
=
convert_test
.
convert
()
n_params
=
convert_test
.
convert
()
convert_test
.
start_vm
(
n_params
)
convert_test
.
start_vm
(
n_params
)
# check md5sum after conversion
# check md5sum after conversion
ret
=
convert_test
.
check_file
(
t_file
)
ret
=
convert_test
.
check_file
(
t_file
,
md5
)
if
not
ret
:
if
not
ret
:
raise
error
.
TestError
(
"image content changed after convert"
)
raise
error
.
TestError
(
"image content changed after convert"
)
convert_test
.
clean
()
convert_test
.
clean
()
qemu/tests/qemu_disk_img_rebase.py
浏览文件 @
7086330f
...
@@ -60,6 +60,7 @@ def run(test, params, env):
...
@@ -60,6 +60,7 @@ def run(test, params, env):
"""
"""
base_image
=
params
.
get
(
"images"
,
"image1"
).
split
()[
0
]
base_image
=
params
.
get
(
"images"
,
"image1"
).
split
()[
0
]
params_bak
=
copy
.
deepcopy
(
params
)
params_bak
=
copy
.
deepcopy
(
params
)
md5_dict
=
{}
params
.
update
(
params
.
update
(
{
"image_name_%s"
%
base_image
:
params
[
"image_name"
],
{
"image_name_%s"
%
base_image
:
params
[
"image_name"
],
"image_format_%s"
%
base_image
:
params
[
"image_format"
]})
"image_format_%s"
%
base_image
:
params
[
"image_format"
]})
...
@@ -70,9 +71,10 @@ def run(test, params, env):
...
@@ -70,9 +71,10 @@ def run(test, params, env):
n_params
=
rebase_test
.
create_snapshot
()
n_params
=
rebase_test
.
create_snapshot
()
rebase_test
.
start_vm
(
n_params
)
rebase_test
.
start_vm
(
n_params
)
t_file
=
params
[
"guest_file_name_%s"
%
tag
]
t_file
=
params
[
"guest_file_name_%s"
%
tag
]
ret
=
rebase_test
.
save_file
(
t_file
)
md5
=
rebase_test
.
save_file
(
t_file
)
if
not
ret
:
if
not
md5
:
raise
error
.
TestError
(
"Fail to save tmp file"
)
raise
error
.
TestError
(
"Fail to save tmp file"
)
md5_dict
[
t_file
]
=
md5
rebase_test
.
destroy_vm
()
rebase_test
.
destroy_vm
()
# rebase snapshot image
# rebase snapshot image
...
@@ -95,7 +97,7 @@ def run(test, params, env):
...
@@ -95,7 +97,7 @@ def run(test, params, env):
rebase_test
.
start_vm
(
t_params
)
rebase_test
.
start_vm
(
t_params
)
check_files
=
params
.
get
(
"check_files"
,
""
).
split
()
check_files
=
params
.
get
(
"check_files"
,
""
).
split
()
for
_file
in
check_files
:
for
_file
in
check_files
:
ret
=
rebase_test
.
check_file
(
_file
)
ret
=
rebase_test
.
check_file
(
_file
,
md5_dict
[
_file
]
)
if
not
ret
:
if
not
ret
:
raise
error
.
TestError
(
"Check md5sum fail (file:%s)"
%
_file
)
raise
error
.
TestError
(
"Check md5sum fail (file:%s)"
%
_file
)
rebase_test
.
destroy_vm
()
rebase_test
.
destroy_vm
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录