[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 10/11] iotests: Add read-only test case to 030
From: |
Max Reitz |
Subject: |
[Qemu-block] [PULL 10/11] iotests: Add read-only test case to 030 |
Date: |
Mon, 15 Jul 2019 16:29:04 +0200 |
This tests that the stream job exits cleanly (without abort) when the
top node is read-only and cannot be reopened read/write.
Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/030 | 29 ++++++++++++++++++++++++++++-
tests/qemu-iotests/030.out | 4 ++--
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index a0397072bc..1b69f318c6 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -36,7 +36,9 @@ class TestSingleDrive(iotests.QMPTestCase):
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' %
mid_img, test_img)
qemu_io('-f', 'raw', '-c', 'write -P 0x1 0 512', backing_img)
qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0x1 524288 512', mid_img)
- self.vm = iotests.VM().add_drive("blkdebug::" + test_img,
"backing.node-name=mid")
+ self.vm = iotests.VM().add_drive("blkdebug::" + test_img,
+ "backing.node-name=mid," +
+ "backing.backing.node-name=base")
self.vm.launch()
def tearDown(self):
@@ -151,6 +153,31 @@ class TestSingleDrive(iotests.QMPTestCase):
result = self.vm.qmp('block-stream', device='mid')
self.assert_qmp(result, 'error/desc', "Invalid job ID ''")
+ def test_read_only(self):
+ # Create a new file that we can attach (we need a read-only top)
+ with iotests.FilePath('ro-top.img') as ro_top_path:
+ qemu_img('create', '-f', iotests.imgfmt, ro_top_path,
+ str(self.image_len))
+
+ result = self.vm.qmp('blockdev-add',
+ node_name='ro-top',
+ driver=iotests.imgfmt,
+ read_only=True,
+ file={
+ 'driver': 'file',
+ 'filename': ro_top_path,
+ 'read-only': True
+ },
+ backing='mid')
+ self.assert_qmp(result, 'return', {})
+
+ result = self.vm.qmp('block-stream', job_id='stream',
+ device='ro-top', base_node='base')
+ self.assert_qmp(result, 'error/desc', 'Block node is read-only')
+
+ result = self.vm.qmp('blockdev-del', node_name='ro-top')
+ self.assert_qmp(result, 'return', {})
+
class TestParallelOps(iotests.QMPTestCase):
num_ops = 4 # Number of parallel block-stream operations
diff --git a/tests/qemu-iotests/030.out b/tests/qemu-iotests/030.out
index 5eb508de07..6d9bee1a4b 100644
--- a/tests/qemu-iotests/030.out
+++ b/tests/qemu-iotests/030.out
@@ -1,5 +1,5 @@
-..........................
+...........................
----------------------------------------------------------------------
-Ran 26 tests
+Ran 27 tests
OK
--
2.21.0
- [Qemu-block] [PULL 00/11] Block patches for rc1, Max Reitz, 2019/07/15
- [Qemu-block] [PULL 01/11] nvme: Set number of queues later in nvme_init(), Max Reitz, 2019/07/15
- [Qemu-block] [PULL 02/11] block: Add BDS.never_freeze, Max Reitz, 2019/07/15
- [Qemu-block] [PULL 03/11] block/stream: Fix error path, Max Reitz, 2019/07/15
- [Qemu-block] [PULL 04/11] block/stream: Swap backing file change order, Max Reitz, 2019/07/15
- [Qemu-block] [PULL 05/11] block: Deep-clear inherits_from, Max Reitz, 2019/07/15
- [Qemu-block] [PULL 06/11] iotests: Fix throttling in 030, Max Reitz, 2019/07/15
- [Qemu-block] [PULL 07/11] iotests: Compare error messages in 030, Max Reitz, 2019/07/15
- [Qemu-block] [PULL 08/11] iotests: Add @use_log to VM.run_job(), Max Reitz, 2019/07/15
- [Qemu-block] [PULL 09/11] iotests: Add new case to 030, Max Reitz, 2019/07/15
- [Qemu-block] [PULL 10/11] iotests: Add read-only test case to 030,
Max Reitz <=
- [Qemu-block] [PULL 11/11] gluster: fix .bdrv_reopen_prepare when backing file is a JSON object, Max Reitz, 2019/07/15
- Re: [Qemu-block] [PULL 00/11] Block patches for rc1, Peter Maydell, 2019/07/15