[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 10/20] iotests: Make 055 less flaky
From: |
Max Reitz |
Subject: |
[Qemu-block] [PULL 10/20] iotests: Make 055 less flaky |
Date: |
Tue, 14 Nov 2017 18:24:07 +0100 |
First of all, test 055 does a valiant job of invoking pause_drive()
sometimes, but that is worth nothing without blkdebug. So the first
thing to do is to sprinkle a couple of "blkdebug::" in there -- with the
exception of the transaction tests, because the blkdebug break points
make the transaction QMP command hang (which is bad). In that case, we
can get away with throttling the block job that it effectively is
paused.
Then, 055 usually does not pause the drive before starting a block job
that should be cancelled. This means that the backup job might be
completed already before block-job-cancel is invoked; thus making the
test either fail (currently) or moot if cancel_and_wait() ignored this
condition. Fix this by pausing the drive before starting the job.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/055 | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055
index e1206caf9b..8a5d9fd269 100755
--- a/tests/qemu-iotests/055
+++ b/tests/qemu-iotests/055
@@ -48,7 +48,7 @@ class TestSingleDrive(iotests.QMPTestCase):
def setUp(self):
qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img,
str(image_len))
- self.vm = iotests.VM().add_drive(test_img)
+ self.vm = iotests.VM().add_drive('blkdebug::' + test_img)
self.vm.add_drive(blockdev_target_img, interface="none")
if iotests.qemu_default_machine == 'pc':
self.vm.add_drive(None, 'media=cdrom', 'ide')
@@ -65,10 +65,11 @@ class TestSingleDrive(iotests.QMPTestCase):
def do_test_cancel(self, cmd, target):
self.assert_no_active_block_jobs()
+ self.vm.pause_drive('drive0')
result = self.vm.qmp(cmd, device='drive0', target=target, sync='full')
self.assert_qmp(result, 'return', {})
- event = self.cancel_and_wait()
+ event = self.cancel_and_wait(resume=True)
self.assert_qmp(event, 'data/type', 'backup')
def test_cancel_drive_backup(self):
@@ -166,7 +167,7 @@ class TestSetSpeed(iotests.QMPTestCase):
def setUp(self):
qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img,
str(image_len))
- self.vm = iotests.VM().add_drive(test_img)
+ self.vm = iotests.VM().add_drive('blkdebug::' + test_img)
self.vm.add_drive(blockdev_target_img, interface="none")
self.vm.launch()
@@ -246,6 +247,8 @@ class TestSetSpeed(iotests.QMPTestCase):
def test_set_speed_invalid_blockdev_backup(self):
self.do_test_set_speed_invalid('blockdev-backup', 'drive1')
+# Note: We cannot use pause_drive() here, or the transaction command
+# would stall. Instead, we limit the block job speed here.
class TestSingleTransaction(iotests.QMPTestCase):
def setUp(self):
qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img,
str(image_len))
@@ -271,7 +274,8 @@ class TestSingleTransaction(iotests.QMPTestCase):
'type': cmd,
'data': { 'device': 'drive0',
'target': target,
- 'sync': 'full' },
+ 'sync': 'full',
+ 'speed': 64 * 1024 },
}
])
@@ -289,12 +293,12 @@ class TestSingleTransaction(iotests.QMPTestCase):
def do_test_pause(self, cmd, target, image):
self.assert_no_active_block_jobs()
- self.vm.pause_drive('drive0')
result = self.vm.qmp('transaction', actions=[{
'type': cmd,
'data': { 'device': 'drive0',
'target': target,
- 'sync': 'full' },
+ 'sync': 'full',
+ 'speed': 64 * 1024 },
}
])
self.assert_qmp(result, 'return', {})
@@ -302,7 +306,9 @@ class TestSingleTransaction(iotests.QMPTestCase):
result = self.vm.qmp('block-job-pause', device='drive0')
self.assert_qmp(result, 'return', {})
- self.vm.resume_drive('drive0')
+ result = self.vm.qmp('block-job-set-speed', device='drive0', speed=0)
+ self.assert_qmp(result, 'return', {})
+
self.pause_job('drive0')
result = self.vm.qmp('query-block-jobs')
@@ -461,7 +467,7 @@ class TestDriveCompression(iotests.QMPTestCase):
pass
def do_prepare_drives(self, fmt, args, attach_target):
- self.vm = iotests.VM().add_drive(test_img)
+ self.vm = iotests.VM().add_drive('blkdebug::' + test_img)
qemu_img('create', '-f', fmt, blockdev_target_img,
str(TestDriveCompression.image_len), *args)
@@ -500,10 +506,11 @@ class TestDriveCompression(iotests.QMPTestCase):
self.assert_no_active_block_jobs()
+ self.vm.pause_drive('drive0')
result = self.vm.qmp(cmd, device='drive0', sync='full', compress=True,
**args)
self.assert_qmp(result, 'return', {})
- event = self.cancel_and_wait()
+ event = self.cancel_and_wait(resume=True)
self.assert_qmp(event, 'data/type', 'backup')
self.vm.shutdown()
--
2.13.6
- [Qemu-block] [PULL 00/20] Block patches for 2.11.0-rc1, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 01/20] qcow2: Prevent allocating refcount blocks at offset 0, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 02/20] qcow2: Prevent allocating L2 tables at offset 0, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 03/20] qcow2: Prevent allocating compressed clusters at offset 0, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 05/20] qcow2: Add iotest for an image with header.refcount_table_offset == 0, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 04/20] qcow2: Don't open images with header.refcount_table_clusters == 0, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 06/20] qcow2: Add iotest for an empty refcount table, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 07/20] qcow2: Assert that the crypto header does not overlap other metadata, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 08/20] iotests: Make 030 less flaky, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 09/20] iotests: Add missing 'blkdebug::' in 040, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 10/20] iotests: Make 055 less flaky,
Max Reitz <=
- [Qemu-block] [PULL 11/20] iotests: Make 083 less flaky, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 12/20] iotests: Make 136 less flaky, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 13/20] iotests: Use new-style NBD connections, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 14/20] qcow2: Check that corrupted images can be repaired in iotest 060, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 16/20] iotests: 077: Filter out 'resume' lines, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 15/20] block/snapshot: dirty all dirty bitmaps on snapshot-switch, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 17/20] block/vhdx.c: Don't blindly update the header, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 18/20] block/parallels: Do not update header or truncate image when INMIGRATE, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 20/20] qemu-iotests: update unsupported image formats in 194, Max Reitz, 2017/11/14
- [Qemu-block] [PULL 19/20] block/parallels: add migration blocker, Max Reitz, 2017/11/14