未验证 提交 735c791c 编写于 作者: Y YongxueHong 提交者: GitHub

Merge pull request #2343 from XueqiangWei/create_large_raw_img

add new error message when creating large image over xfs filesystem
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
- over_xfs: - over_xfs:
file_sys = "xfs" file_sys = "xfs"
image_size_large = 10240000T image_size_large = 10240000T
err_info = "Image size must be less than 8 EiB!" err_info = "Image size must be less than 8 EiB!;"
err_info = '${err_info}Invalid image size specified. Must be between 0 and 9223372036854775807.'
- over_ext4: - over_ext4:
file_sys = "ext4" file_sys = "ext4"
image_size_large = 16T image_size_large = 16T
......
import logging import logging
import os import os
import six
from avocado import TestError from avocado import TestError
from avocado.utils import partition as p from avocado.utils import partition as p
...@@ -25,6 +26,7 @@ def run(test, params, env): ...@@ -25,6 +26,7 @@ def run(test, params, env):
loop_img = os.path.join(root_dir, "loop.img") loop_img = os.path.join(root_dir, "loop.img")
loop_size = int(params["loop_file_size"]) loop_size = int(params["loop_file_size"])
file_sys = params["file_sys"] file_sys = params["file_sys"]
err_info = params["err_info"].split(";")
mnt_dir = os.path.join(root_dir, "tmp") mnt_dir = os.path.join(root_dir, "tmp")
large = QemuImg(params.object_params(large_img), mnt_dir, large_img) large = QemuImg(params.object_params(large_img), mnt_dir, large_img)
...@@ -38,11 +40,14 @@ def run(test, params, env): ...@@ -38,11 +40,14 @@ def run(test, params, env):
try: try:
large.create(large.params) large.create(large.params)
except TestError as err: except TestError as err:
if params["err_info"] not in str(err): for info in err_info:
if info in six.text_type(err):
break
else:
test.fail("CML failed with unexpected output: %s" % err) test.fail("CML failed with unexpected output: %s" % err)
else: else:
test.fail("There is no error when creating an image with large size.") test.fail("There is no error when creating an image with large size.")
finally:
part.unmount() part.unmount()
os.rmdir(mnt_dir) os.rmdir(mnt_dir)
os.remove(loop_img) os.remove(loop_img)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册