Message ID | 1335195589-13285-5-git-send-email-stefanha@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
Il 23/04/2012 17:39, Stefan Hajnoczi ha scritto: > + > + result = self.vm.qmp('block-stream', device='drive0', speed=-1) > + self.assert_qmp(result, 'error/class', 'BlockJobSpeedInvalid') > + self.assert_qmp(result, 'error/data/value', -1) Apart from /me disagreeing on introducing a new error value, for which I'll defer to Luiz, looks good. Paolo
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 978fd82..7f31841 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -147,5 +147,14 @@ class TestSetSpeed(ImageStreamingTestCase): self.assert_no_active_streams() + def test_set_speed_invalid(self): + self.assert_no_active_streams() + + result = self.vm.qmp('block-stream', device='drive0', speed=-1) + self.assert_qmp(result, 'error/class', 'BlockJobSpeedInvalid') + self.assert_qmp(result, 'error/data/value', -1) + + self.assert_no_active_streams() + if __name__ == '__main__': iotests.main(supported_fmts=['qcow2', 'qed']) diff --git a/tests/qemu-iotests/030.out b/tests/qemu-iotests/030.out index 8d7e996..89968f3 100644 --- a/tests/qemu-iotests/030.out +++ b/tests/qemu-iotests/030.out @@ -1,5 +1,5 @@ -... +.... ---------------------------------------------------------------------- -Ran 3 tests +Ran 4 tests OK
Add a test to exercise the BlockJobSpeedInvalid error code path in the block-stream command. The 'speed' parameter allows the speed limit of the job to be applied immediately when the job starts instead of issuing a separate block-job-set-speed command later. If the parameter has an invalid value we expect to get an error and the job is not created. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> --- tests/qemu-iotests/030 | 9 +++++++++ tests/qemu-iotests/030.out | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-)