From patchwork Mon Apr 23 15:39:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 154475 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E41DEB6EEB for ; Tue, 24 Apr 2012 01:45:09 +1000 (EST) Received: from localhost ([::1]:48655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMLNp-0006XZ-FJ for incoming@patchwork.ozlabs.org; Mon, 23 Apr 2012 11:40:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMLN8-0004gD-4f for qemu-devel@nongnu.org; Mon, 23 Apr 2012 11:40:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SMLN1-0005Kp-5Y for qemu-devel@nongnu.org; Mon, 23 Apr 2012 11:40:13 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:52807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMLN0-0005DP-TO for qemu-devel@nongnu.org; Mon, 23 Apr 2012 11:40:07 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Apr 2012 16:40:03 +0100 Received: from d06nrmr1307.portsmouth.uk.ibm.com (9.149.38.129) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 23 Apr 2012 16:40:01 +0100 Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q3NFe0dG2810022 for ; Mon, 23 Apr 2012 16:40:00 +0100 Received: from d06av08.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q3NFdxwg008729 for ; Mon, 23 Apr 2012 09:40:00 -0600 Received: from localhost (stefanha-thinkpad.manchester-maybrook.uk.ibm.com [9.174.219.241]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q3NFdxZr008720; Mon, 23 Apr 2012 09:39:59 -0600 From: Stefan Hajnoczi To: Date: Mon, 23 Apr 2012 16:39:49 +0100 Message-Id: <1335195589-13285-5-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1335195589-13285-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1335195589-13285-1-git-send-email-stefanha@linux.vnet.ibm.com> x-cbid: 12042315-3548-0000-0000-000001B3E715 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.112 Cc: Paolo Bonzini , Eric Blake , Stefan Hajnoczi , Luiz Capitulino Subject: [Qemu-devel] [PATCH 4/4] qemu-iotests: add block-stream with invalid speed value test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- tests/qemu-iotests/030 | 9 +++++++++ tests/qemu-iotests/030.out | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) 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