[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v2 9/9] iotests: Test commit with a filter on the ch
From: |
Max Reitz |
Subject: |
[Qemu-block] [PATCH v2 9/9] iotests: Test commit with a filter on the chain |
Date: |
Wed, 19 Jun 2019 17:26:03 +0200 |
Before the previous patches, the first case resulted in a failed
assertion (which is noted as qemu receiving a SIGABRT in the test
output), and the second usually triggered a segmentation fault.
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/040 | 40 +++++++++++++++++++++++++++++++++++++-
tests/qemu-iotests/040.out | 4 ++--
2 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040
index b81133a474..aa0b1847e3 100755
--- a/tests/qemu-iotests/040
+++ b/tests/qemu-iotests/040
@@ -92,9 +92,10 @@ class TestSingleDrive(ImageCommitTestCase):
self.vm.add_device("scsi-hd,id=scsi0,drive=drive0")
self.vm.launch()
+ self.has_quit = False
def tearDown(self):
- self.vm.shutdown()
+ self.vm.shutdown(has_quit=self.has_quit)
os.remove(test_img)
os.remove(mid_img)
os.remove(backing_img)
@@ -109,6 +110,43 @@ class TestSingleDrive(ImageCommitTestCase):
self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xab 0
524288', backing_img).find("verification failed"))
self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xef 524288
524288', backing_img).find("verification failed"))
+ def test_commit_with_filter_and_quit(self):
+ result = self.vm.qmp('object-add', qom_type='throttle-group', id='tg')
+ self.assert_qmp(result, 'return', {})
+
+ # Add a filter outside of the backing chain
+ result = self.vm.qmp('blockdev-add', driver='throttle',
node_name='filter', throttle_group='tg', file='mid')
+ self.assert_qmp(result, 'return', {})
+
+ result = self.vm.qmp('block-commit', device='drive0')
+ self.assert_qmp(result, 'return', {})
+
+ # Quit immediately, thus forcing a simultaneous cancel of the
+ # block job and a bdrv_drain_all()
+ result = self.vm.qmp('quit')
+ self.assert_qmp(result, 'return', {})
+
+ self.has_quit = True
+
+ # Same as above, but this time we add the filter after starting the job
+ def test_commit_plus_filter_and_quit(self):
+ result = self.vm.qmp('object-add', qom_type='throttle-group', id='tg')
+ self.assert_qmp(result, 'return', {})
+
+ result = self.vm.qmp('block-commit', device='drive0')
+ self.assert_qmp(result, 'return', {})
+
+ # Add a filter outside of the backing chain
+ result = self.vm.qmp('blockdev-add', driver='throttle',
node_name='filter', throttle_group='tg', file='mid')
+ self.assert_qmp(result, 'return', {})
+
+ # Quit immediately, thus forcing a simultaneous cancel of the
+ # block job and a bdrv_drain_all()
+ result = self.vm.qmp('quit')
+ self.assert_qmp(result, 'return', {})
+
+ self.has_quit = True
+
def test_device_not_found(self):
result = self.vm.qmp('block-commit', device='nonexistent', top='%s' %
mid_img)
self.assert_qmp(result, 'error/class', 'DeviceNotFound')
diff --git a/tests/qemu-iotests/040.out b/tests/qemu-iotests/040.out
index 802ffaa0c0..220a5fa82c 100644
--- a/tests/qemu-iotests/040.out
+++ b/tests/qemu-iotests/040.out
@@ -1,5 +1,5 @@
-...........................................
+...............................................
----------------------------------------------------------------------
-Ran 43 tests
+Ran 47 tests
OK
--
2.21.0
- [Qemu-block] [PATCH v2 0/9] block: Delay poll when ending drained sections, Max Reitz, 2019/06/19
- [Qemu-block] [PATCH v2 4/9] block: Move polling out of bdrv_drain_invoke(), Max Reitz, 2019/06/19
- [Qemu-block] [PATCH v2 2/9] block: Add @data_objs to bdrv_drain_invoke(), Max Reitz, 2019/06/19
- [Qemu-block] [PATCH v2 6/9] block: Add bdrv_drained_end_no_poll(), Max Reitz, 2019/06/19
- [Qemu-block] [PATCH v2 5/9] block: Add @poll to bdrv_parent_drained_end_single(), Max Reitz, 2019/06/19
- [Qemu-block] [PATCH v2 1/9] block: Introduce BdrvChild.parent_quiesce_counter, Max Reitz, 2019/06/19
- [Qemu-block] [PATCH v2 7/9] block: Fix BDS children's .drained_end(), Max Reitz, 2019/06/19
- [Qemu-block] [PATCH v2 8/9] iotests: Add @has_quit to vm.shutdown(), Max Reitz, 2019/06/19
- [Qemu-block] [PATCH v2 9/9] iotests: Test commit with a filter on the chain,
Max Reitz <=
- [Qemu-block] [PATCH v2 3/9] block: Add bdrv_poll_drain_data_objs(), Max Reitz, 2019/06/19