@@ -23,7 +23,7 @@ import os
import re
import json
import iotests
-from iotests import qemu_img, qemu_img_pipe
+from iotests import create_test_image, remove_test_image, qemu_img_pipe
import unittest
test_img = os.path.join(iotests.test_dir, 'test.img')
@@ -34,11 +34,10 @@ class TestImageInfoSpecific(iotests.QMPTestCase):
def setUp(self):
if self.img_options is None:
self.skipTest('Skipping abstract test class')
- qemu_img('create', '-f', iotests.imgfmt, '-o', self.img_options,
- test_img, '128K')
+ create_test_image(test_img, '128K', opts=self.img_options)
def tearDown(self):
- os.remove(test_img)
+ remove_test_image(test_img)
class TestQemuImgInfo(TestImageInfoSpecific):
'''Abstract base class for qemu-img info tests'''
@@ -87,13 +86,13 @@ class TestQMP(TestImageInfoSpecific):
class TestQCow2(TestQemuImgInfo):
'''Testing a qcow2 version 2 image'''
- img_options = 'compat=0.10'
+ img_options = ['compat=0.10']
json_compare = { 'compat': '0.10', 'refcount-bits': 16 }
human_compare = [ 'compat: 0.10', 'refcount bits: 16' ]
class TestQCow3NotLazy(TestQemuImgInfo):
'''Testing a qcow2 version 3 image with lazy refcounts disabled'''
- img_options = 'compat=1.1,lazy_refcounts=off'
+ img_options = ['compat=1.1', 'lazy_refcounts=off']
json_compare = { 'compat': '1.1', 'lazy-refcounts': False,
'refcount-bits': 16, 'corrupt': False }
human_compare = [ 'compat: 1.1', 'lazy refcounts: false',
@@ -101,7 +100,7 @@ class TestQCow3NotLazy(TestQemuImgInfo):
class TestQCow3Lazy(TestQemuImgInfo):
'''Testing a qcow2 version 3 image with lazy refcounts enabled'''
- img_options = 'compat=1.1,lazy_refcounts=on'
+ img_options = ['compat=1.1', 'lazy_refcounts=on']
json_compare = { 'compat': '1.1', 'lazy-refcounts': True,
'refcount-bits': 16, 'corrupt': False }
human_compare = [ 'compat: 1.1', 'lazy refcounts: true',
@@ -110,7 +109,7 @@ class TestQCow3Lazy(TestQemuImgInfo):
class TestQCow3NotLazyQMP(TestQMP):
'''Testing a qcow2 version 3 image with lazy refcounts disabled, opening
with lazy refcounts enabled'''
- img_options = 'compat=1.1,lazy_refcounts=off'
+ img_options = ['compat=1.1', 'lazy_refcounts=off']
qemu_options = 'lazy-refcounts=on'
compare = { 'compat': '1.1', 'lazy-refcounts': False,
'refcount-bits': 16, 'corrupt': False }
@@ -119,7 +118,7 @@ class TestQCow3NotLazyQMP(TestQMP):
class TestQCow3LazyQMP(TestQMP):
'''Testing a qcow2 version 3 image with lazy refcounts enabled, opening
with lazy refcounts disabled'''
- img_options = 'compat=1.1,lazy_refcounts=on'
+ img_options = ['compat=1.1', 'lazy_refcounts=on']
qemu_options = 'lazy-refcounts=off'
compare = { 'compat': '1.1', 'lazy-refcounts': True,
'refcount-bits': 16, 'corrupt': False }
Signed-off-by: Max Reitz <mreitz@redhat.com> --- tests/qemu-iotests/065 | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)