From patchwork Mon Apr 4 13:44:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 8741071 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DF7719F36E for ; Mon, 4 Apr 2016 13:45:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E4D292024F for ; Mon, 4 Apr 2016 13:45:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97C0920263 for ; Mon, 4 Apr 2016 13:45:42 +0000 (UTC) Received: from localhost ([::1]:58728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1an4p3-00025t-VA for patchwork-qemu-devel@patchwork.kernel.org; Mon, 04 Apr 2016 09:45:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1an4oi-00020z-1H for qemu-devel@nongnu.org; Mon, 04 Apr 2016 09:45:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1an4og-0000BO-Rw for qemu-devel@nongnu.org; Mon, 04 Apr 2016 09:45:19 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:15153 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1an4og-0008Qw-Lf; Mon, 04 Apr 2016 09:45:18 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CSAwCybgJX/5tjdVtdHYMagVCnFQEBAQEBBQGBEQGQZoIPAQ2BcoYNAoEzOBQBAQEBAQEBZSeEQgEBBHkQPxI8GxmIKwG9BwEBAQcghViCRYZnhXsFh2+FXnCJRI4IiTqFVY8aHgEBQoNqaYZqgTwBAQE X-IPAS-Result: A2CSAwCybgJX/5tjdVtdHYMagVCnFQEBAQEBBQGBEQGQZoIPAQ2BcoYNAoEzOBQBAQEBAQEBZSeEQgEBBHkQPxI8GxmIKwG9BwEBAQcghViCRYZnhXsFh2+FXnCJRI4IiTqFVY8aHgEBQoNqaYZqgTwBAQE X-IronPort-AV: E=Sophos;i="5.24,440,1454972400"; d="scan'208";a="39334390" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 04 Apr 2016 15:44:47 +0200 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim) id 1an4oB-000511-2M; Mon, 04 Apr 2016 15:44:47 +0200 Received: from berto by perseus.local with local (Exim 4.87) (envelope-from ) id 1an4nj-0003vh-5z; Mon, 04 Apr 2016 16:44:19 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 4 Apr 2016 16:44:00 +0300 Message-Id: <2483f3f1b677752d0f77da8628b0216bd4a26d3f.1459776815.git.berto@igalia.com> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH v9 10/11] qemu-iotests: test overlapping block-stream operations 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This test case checks that it's not possible to perform two block-stream operations if there are nodes involved in both. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- tests/qemu-iotests/030 | 60 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/030.out | 4 ++-- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 1c53f80..6348872 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -145,6 +145,66 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_qmp(result, 'error/class', 'GenericError') +class TestMultipleOps(iotests.QMPTestCase): + num_imgs = 9 # It must be > 5 or some tests will break + image_len = num_imgs * 1024 * 1024 + imgs = [] + + def setUp(self): + opts = [] + self.imgs = [] + + # Initialize file names and command-line options + for i in range(self.num_imgs): + img_depth = self.num_imgs - i - 1 + opts.append("backing." * img_depth + "node-name=node%d" % i) + self.imgs.append(os.path.join(iotests.test_dir, 'img-%d.img' % i)) + + # Create all images + iotests.create_image(self.imgs[0], self.image_len) + for i in range(1, self.num_imgs): + qemu_img('create', '-f', iotests.imgfmt, + '-o', 'backing_file=%s' % self.imgs[i-1], self.imgs[i]) + + # Put data into some images so there's something to copy + for i in range(1, self.num_imgs, 2): + qemu_io('-f', iotests.imgfmt, + '-c', 'write -P %d %d %d' % (i, i*1024*1024, 1024*1024), + self.imgs[i]) + + # Attach the drive to the VM + self.vm = iotests.VM() + self.vm.add_drive("blkdebug::" + self.imgs[-1], ','.join(opts)) + self.vm.launch() + + def tearDown(self): + self.vm.shutdown() + for img in self.imgs: + os.remove(img) + + # Test that it's not possible to perform two block-stream + # operations if there are nodes involved in both. + def test_overlapping(self): + self.assert_no_active_block_jobs() + + # Set a speed limit to make sure that this job blocks the rest + result = self.vm.qmp('block-stream', device='node4', base=self.imgs[0], speed=32768) + self.assert_qmp(result, 'return', {}) + + result = self.vm.qmp('block-stream', device='node5', base=self.imgs[1]) + self.assert_qmp(result, 'error/class', 'GenericError') + + result = self.vm.qmp('block-stream', device='node3', base=self.imgs[2]) + self.assert_qmp(result, 'error/class', 'GenericError') + + result = self.vm.qmp('block-stream', device='node4') + self.assert_qmp(result, 'error/class', 'GenericError') + + self.wait_until_completed(drive='node4') + self.assert_no_active_block_jobs() + + self.vm.shutdown() + class TestSmallerBackingFile(iotests.QMPTestCase): backing_len = 1 * 1024 * 1024 # MB image_len = 2 * backing_len diff --git a/tests/qemu-iotests/030.out b/tests/qemu-iotests/030.out index 96961ed..b6f2576 100644 --- a/tests/qemu-iotests/030.out +++ b/tests/qemu-iotests/030.out @@ -1,5 +1,5 @@ -............... +................ ---------------------------------------------------------------------- -Ran 15 tests +Ran 16 tests OK