From patchwork Fri Sep 28 15:22:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 187804 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 749362C009E for ; Sat, 29 Sep 2012 01:24:46 +1000 (EST) Received: from localhost ([::1]:43153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THcQm-00076S-CM for incoming@patchwork.ozlabs.org; Fri, 28 Sep 2012 11:24:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THcPz-00060Y-1k for qemu-devel@nongnu.org; Fri, 28 Sep 2012 11:24:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THcPx-0001D6-Gg for qemu-devel@nongnu.org; Fri, 28 Sep 2012 11:23:54 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:40969) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THcPx-00017A-Aj for qemu-devel@nongnu.org; Fri, 28 Sep 2012 11:23:53 -0400 Received: by mail-pb0-f45.google.com with SMTP id rp2so5308240pbb.4 for ; Fri, 28 Sep 2012 08:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=wHuch5Dtb2bB0IealDtQu0l99dHuupOvdyAVUJ/ez98=; b=ysbgOaW3F09ESc5SPDZPnTvkuqwZFhKt5lwyQqhUB5VbysmxxZMSQUDhK6bLd9/AdL wmzR+RZrsBLj7FRW0GN3v7iq3EpsssAFb2Us8au1WjavjCip3YLyRBehIQcYIeeagFg6 j6uKtSnx95fqY9hHvnSPXGb2EMQgxOywvGCMDSAxqNBjhRf5cRZRHa/yR3ObYlfF/jSv rwKc8aqhmd0whxoQzO/qHyMcNG4h6vOf3hlM992wqqyKSX7r7Pqp/P4OzwMECah+xPkv 4aemFN6UUd4FtQ7QYxqzAvy18TRIKAGd66E2jI29eaVE3ZuNXMeCYqqDhiHAQZb5Cqkl bZMg== Received: by 10.68.233.198 with SMTP id ty6mr20902124pbc.107.1348845833002; Fri, 28 Sep 2012 08:23:53 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id e9sm5648599pay.34.2012.09.28.08.23.50 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Sep 2012 08:23:51 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 28 Sep 2012 17:22:52 +0200 Message-Id: <1348845782-15073-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1348845782-15073-1-git-send-email-pbonzini@redhat.com> References: <1348845782-15073-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: kwolf@redhat.com Subject: [Qemu-devel] [PATCH 09/19] qemu-iotests: add test for pausing a streaming operation 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 These check that a paused streaming job does not advance its offset. Sometimes the new test fails; the map is different between the source and the destination of the streaming because qemu-io does not always pack adjacent clusters that have the same allocated/unallocated state. However, this also happens with the existing test_stream testcase, and is better fixed in qemu-io. Signed-off-by: Paolo Bonzini --- tests/qemu-iotests/030 | 40 ++++++++++++++++++++++++++++++++++++++-- tests/qemu-iotests/030.out | 4 ++-- tests/qemu-iotests/group | 2 +- 3 file modificati, 41 inserzioni(+), 5 rimozioni(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 55b16f8..dfacdf1 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -18,6 +18,7 @@ # along with this program. If not, see . # +import time import os import iotests from iotests import qemu_img, qemu_io @@ -98,6 +99,43 @@ class TestSingleDrive(ImageStreamingTestCase): qemu_io('-c', 'map', test_img), 'image file map does not match backing file after streaming') + def test_stream_pause(self): + self.assert_no_active_streams() + + result = self.vm.qmp('block-stream', device='drive0') + self.assert_qmp(result, 'return', {}) + + result = self.vm.qmp('block-job-pause', device='drive0') + self.assert_qmp(result, 'return', {}) + + time.sleep(1) + result = self.vm.qmp('query-block-jobs') + offset = self.dictpath(result, 'return[0]/offset') + + time.sleep(1) + result = self.vm.qmp('query-block-jobs') + self.assert_qmp(result, 'return[0]/offset', offset) + + result = self.vm.qmp('block-job-resume', device='drive0') + self.assert_qmp(result, 'return', {}) + + completed = False + while not completed: + for event in self.vm.get_qmp_events(wait=True): + if event['event'] == 'BLOCK_JOB_COMPLETED': + self.assert_qmp(event, 'data/type', 'stream') + self.assert_qmp(event, 'data/device', 'drive0') + self.assert_qmp(event, 'data/offset', self.image_len) + self.assert_qmp(event, 'data/len', self.image_len) + completed = True + + self.assert_no_active_streams() + self.vm.shutdown() + + self.assertEqual(qemu_io('-c', 'map', backing_img), + qemu_io('-c', 'map', test_img), + 'image file map does not match backing file after streaming') + def test_stream_partial(self): self.assert_no_active_streams() @@ -173,8 +211,6 @@ class TestStreamStop(ImageStreamingTestCase): os.remove(backing_img) def test_stream_stop(self): - import time - self.assert_no_active_streams() result = self.vm.qmp('block-stream', device='drive0') diff --git a/tests/qemu-iotests/030.out b/tests/qemu-iotests/030.out index 2f7d390..594c16f 100644 --- a/tests/qemu-iotests/030.out +++ b/tests/qemu-iotests/030.out @@ -1,5 +1,5 @@ -....... +........ ---------------------------------------------------------------------- -Ran 7 tests +Ran 8 tests OK diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index ebb5ca4..fa4da7d 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -36,7 +36,7 @@ 027 rw auto quick 028 rw backing auto 029 rw auto quick -030 rw auto +030 rw auto backing 031 rw auto quick 032 rw auto 033 rw auto