diff mbox

[v2] qemu-iotests: prefill some data to test image

Message ID 1383126148-1664-1-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng Oct. 30, 2013, 9:42 a.m. UTC
Case 030 occasionally fails because of block job compltes too fast to be
captured by script, and 'unexpected qmp event' of job completion causes
the test failure.

Simply fill in some data to the test image to make this false alarm less
likely to happen.

(For other benefits to prefill data to test image, see also commit
ab68cdfaa).

Signed-off-by: Fam Zheng <famz@redhat.com>

---
v2: subsequent to "qemu-iotests: fix 030 for faster machines".

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/qemu-iotests/030 | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Kevin Wolf Oct. 30, 2013, 11:15 a.m. UTC | #1
Am 30.10.2013 um 10:42 hat Fam Zheng geschrieben:
> Case 030 occasionally fails because of block job compltes too fast to be
> captured by script, and 'unexpected qmp event' of job completion causes
> the test failure.
> 
> Simply fill in some data to the test image to make this false alarm less
> likely to happen.
> 
> (For other benefits to prefill data to test image, see also commit
> ab68cdfaa).
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> 
> ---
> v2: subsequent to "qemu-iotests: fix 030 for faster machines".
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>

Did you try using blkdebug to make it deterministic instead of just
making failure less likely?

Kevin
Fam Zheng Oct. 30, 2013, 11:31 a.m. UTC | #2
On Wed, 10/30 12:15, Kevin Wolf wrote:
> Am 30.10.2013 um 10:42 hat Fam Zheng geschrieben:
> > Case 030 occasionally fails because of block job compltes too fast to be
> > captured by script, and 'unexpected qmp event' of job completion causes
> > the test failure.
> > 
> > Simply fill in some data to the test image to make this false alarm less
> > likely to happen.
> > 
> > (For other benefits to prefill data to test image, see also commit
> > ab68cdfaa).
> > 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > 
> > ---
> > v2: subsequent to "qemu-iotests: fix 030 for faster machines".
> > 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> 
> Did you try using blkdebug to make it deterministic instead of just
> making failure less likely?

Yes. blkdebug relies on actual IO, but using images with no data doesn't
trigger any IO and just completes. Prefilling is the prerequisite to use that.
This alone already works very well for me, but blkdebug is good to have, too.

Suspending before starting the block job is obviously the way to do, but
resuming before cancel_and_wait is not deterministic, either, in the same way.
We'll need to add cancel_and_resume_and_wait().

Do you like me to respin or use a follow up patch?

Fam
Kevin Wolf Oct. 30, 2013, 11:51 a.m. UTC | #3
Am 30.10.2013 um 12:31 hat Fam Zheng geschrieben:
> On Wed, 10/30 12:15, Kevin Wolf wrote:
> > Am 30.10.2013 um 10:42 hat Fam Zheng geschrieben:
> > > Case 030 occasionally fails because of block job compltes too fast to be
> > > captured by script, and 'unexpected qmp event' of job completion causes
> > > the test failure.
> > > 
> > > Simply fill in some data to the test image to make this false alarm less
> > > likely to happen.
> > > 
> > > (For other benefits to prefill data to test image, see also commit
> > > ab68cdfaa).
> > > 
> > > Signed-off-by: Fam Zheng <famz@redhat.com>
> > > 
> > > ---
> > > v2: subsequent to "qemu-iotests: fix 030 for faster machines".
> > > 
> > > Signed-off-by: Fam Zheng <famz@redhat.com>
> > 
> > Did you try using blkdebug to make it deterministic instead of just
> > making failure less likely?
> 
> Yes. blkdebug relies on actual IO, but using images with no data doesn't
> trigger any IO and just completes. Prefilling is the prerequisite to use that.
> This alone already works very well for me, but blkdebug is good to have, too.

That's actually a good point.

> Suspending before starting the block job is obviously the way to do, but
> resuming before cancel_and_wait is not deterministic, either, in the same way.
> We'll need to add cancel_and_resume_and_wait().
> 
> Do you like me to respin or use a follow up patch?

A follow-up patch works for me.

Kevin
diff mbox

Patch

diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index ae56f3b..d0f96ea 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -388,7 +388,9 @@  class TestStreamStop(iotests.QMPTestCase):
 
     def setUp(self):
         qemu_img('create', backing_img, str(TestStreamStop.image_len))
+        qemu_io('-c', 'write -P 0x1 0 32M', backing_img)
         qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, test_img)
+        qemu_io('-c', 'write -P 0x1 32M 32M', test_img)
         self.vm = iotests.VM().add_drive(test_img)
         self.vm.launch()
 
@@ -414,7 +416,9 @@  class TestSetSpeed(iotests.QMPTestCase):
 
     def setUp(self):
         qemu_img('create', backing_img, str(TestSetSpeed.image_len))
+        qemu_io('-c', 'write -P 0x1 0 32M', backing_img)
         qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, test_img)
+        qemu_io('-c', 'write -P 0x1 32M 32M', test_img)
         self.vm = iotests.VM().add_drive(test_img)
         self.vm.launch()