[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 37/37] iotests: Add test for change-related Q
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 37/37] iotests: Add test for change-related QMP commands |
Date: |
Mon, 09 Feb 2015 17:06:03 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 02/09/2015 10:11 AM, Max Reitz wrote:
> Signed-off-by: Max Reitz <address@hidden>
> ---
> tests/qemu-iotests/118 | 653
> +++++++++++++++++++++++++++++++++++++++++++++
> tests/qemu-iotests/118.out | 5 +
> tests/qemu-iotests/group | 1 +
> 3 files changed, 659 insertions(+)
> create mode 100755 tests/qemu-iotests/118
> create mode 100644 tests/qemu-iotests/118.out
>
> +
> + def process_events(self):
> + for event in self.vm.get_qmp_events(wait=True):
> + if event['event'] == 'DEVICE_TRAY_MOVED' and
> event['data']['device'] == 'drive0':
Long line; I think you can wrap it as:
if (event['event'] == 'DEVICE_TRAY_MOVED' and
event['data']['device'] == 'drive0'):
> +class GeneralChangeTestsBaseClass(ChangeBaseClass):
> + def test_change(self):
> + result = self.vm.qmp('change', device='drive0', target=new_img,
> + arg=iotests.imgfmt)
Unusual indentation. [1]
> + self.assert_qmp(result, 'return', {})
> +
> + while not self.has_opened:
> + self.process_events()
> + while not self.has_closed:
> + self.process_events()
> +
Are we guaranteed that loops like this will gracefully timeout and fail
the test if the event doesn't happen, instead of hanging forever? But
that's probably something affecting multiple tests, so I won't hold up
review of this one.
> + result = self.vm.qmp('query-block')
> + self.assert_qmp(result, 'return[0]/tray_open', False)
> + self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
> +
> + def test_blockdev_change_medium(self):
> + result = self.vm.qmp('blockdev-change-medium', device='drive0',
> + filename=new_img,
> + format=iotests.imgfmt)
[1] I guess your choice of not flushing arguments to the ( is intentional.
The long line thing is minor, so:
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v2 27/37] blockdev: Add blockdev-remove-medium, (continued)
- [Qemu-devel] [PATCH v2 27/37] blockdev: Add blockdev-remove-medium, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 33/37] hmp: Use blockdev-change-medium for change command, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 36/37] iotests: More options for VM.add_drive(), Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 31/37] block: Inquire tray state before tray-moved events, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 32/37] qmp: Introduce blockdev-change-medium, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 35/37] hmp: Add read-only-mode option to change command, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 37/37] iotests: Add test for change-related QMP commands, Max Reitz, 2015/02/09
- Re: [Qemu-devel] [PATCH v2 37/37] iotests: Add test for change-related QMP commands,
Eric Blake <=
- [Qemu-devel] [PATCH v2 23/37] blockdev: Allow more options for BB-less BDS tree, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 28/37] blockdev: Add blockdev-insert-medium, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 30/37] blockdev: Implement change with basic operations, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 29/37] blockdev: Implement eject with basic operations, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 20/37] block: Prepare for NULL BDS, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 26/37] blockdev: Add blockdev-close-tray, Max Reitz, 2015/02/09