[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 5/5] qemu-iotests: add block-stream speed val
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v3 5/5] qemu-iotests: add block-stream speed value test case |
Date: |
Wed, 25 Apr 2012 16:49:39 +0100 |
On Wed, Apr 25, 2012 at 3:21 PM, Eric Blake <address@hidden> wrote:
> On 04/25/2012 07:17 AM, Stefan Hajnoczi wrote:
>> Add tests to exercise the InvalidParameter 'speed' error code path, as
>> well as the regular success case for setting the speed. The
>> block-stream '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.
>>
>> It turns out that cancelling a block job is a common operation in these
>> test cases, let's extract a cancel_and_wait() function instead of
>> duplicating the QMP commands.
>>
>> Signed-off-by: Stefan Hajnoczi <address@hidden>
>> Acked-by: Kevin Wolf <address@hidden>
>> ---
>
>> +
>> + def test_set_speed_invalid(self):
>> self.assert_no_active_streams()
>>
>> + result = self.vm.qmp('block-stream', device='drive0', speed=2 *
>> 1024 * 1024)
>> + self.assert_qmp(result, {})
>> +
>> + self.assert_no_active_streams()
>> +
>> + result = self.vm.qmp('block-stream', device='drive0')
>> + self.assert_qmp(result, 'return', {})
>> +
>> + result = self.vm.qmp('block-job-set-speed', device='drive0',
>> speed=-1)
>> + self.assert_qmp(result, 'error/class', 'InvalidParameter')
>> + self.assert_qmp(result, 'error/data/name', 'speed')
>> +
>> + self.cancel_and_wait()
>> +
>> + def test_set_speed_invalid(self):
>
> Duplicate def test_set_speed_invalid. Bad copy-and-paste issue? The
> first one looks bogus, the second one looks correct.
Hmm...not my finest patch series. I made a mess, it was indeed a copy
paste error. Interestingly the tests still passed :).
I'm sending a new revision that fixes this. There are three cases for
set speed:
1. A throughput performance test which is not automatically run
(because it takes several seconds to complete and is really only good
for testing throttling).
2. A success case test that makes sure query-block-jobs reports the
speed that we set.
3. A failure case for InvalidParameter.
Stefan
- [Qemu-devel] [PATCH v3 0/5] block: add optional 'speed' parameter to block-stream, Stefan Hajnoczi, 2012/04/25
- [Qemu-devel] [PATCH v3 2/5] block: use Error mechanism instead of -errno for block_job_set_speed(), Stefan Hajnoczi, 2012/04/25
- [Qemu-devel] [PATCH v3 3/5] block: change block-job-set-speed argument from 'value' to 'speed', Stefan Hajnoczi, 2012/04/25
- [Qemu-devel] [PATCH v3 1/5] block: use Error mechanism instead of -errno for block_job_create(), Stefan Hajnoczi, 2012/04/25
- [Qemu-devel] [PATCH v3 5/5] qemu-iotests: add block-stream speed value test case, Stefan Hajnoczi, 2012/04/25
- [Qemu-devel] [PATCH v3 4/5] block: add 'speed' optional parameter to block-stream, Stefan Hajnoczi, 2012/04/25