From patchwork Tue Jan 26 10:38:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 8120091 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 F11509F818 for ; Tue, 26 Jan 2016 10:43:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0CAA620265 for ; Tue, 26 Jan 2016 10:43:53 +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 EA16620256 for ; Tue, 26 Jan 2016 10:43:50 +0000 (UTC) Received: from localhost ([::1]:42953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO16E-00064d-AG for patchwork-qemu-devel@patchwork.kernel.org; Tue, 26 Jan 2016 05:43:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO13e-0000cD-Rx for qemu-devel@nongnu.org; Tue, 26 Jan 2016 05:41:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aO13a-0007hc-Gm for qemu-devel@nongnu.org; Tue, 26 Jan 2016 05:41:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49372) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO13V-0007gx-Tn; Tue, 26 Jan 2016 05:41:02 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 875EC8F26B; Tue, 26 Jan 2016 10:41:01 +0000 (UTC) Received: from fam-t430.redhat.com (vpn1-5-65.pek2.redhat.com [10.72.5.65]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0QAcRTR016464; Tue, 26 Jan 2016 05:40:53 -0500 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 26 Jan 2016 18:38:25 +0800 Message-Id: <1453804705-7205-17-git-send-email-famz@redhat.com> In-Reply-To: <1453804705-7205-1-git-send-email-famz@redhat.com> References: <1453804705-7205-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, jsnow@redhat.com, Markus Armbruster , mreitz@redhat.com, vsementsov@parallels.com, Stefan Hajnoczi Subject: [Qemu-devel] [RFC PATCH 16/16] iotests: Add persistent bitmap test case 141 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 For now it merely invokes block-dirty-bitmap-{add,set-persistent}. Verification of the bitmap data and user data to be added in the future. Signed-off-by: Fam Zheng --- tests/qemu-iotests/141 | 62 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/141.out | 5 ++++ tests/qemu-iotests/group | 1 + 3 files changed, 68 insertions(+) create mode 100644 tests/qemu-iotests/141 create mode 100644 tests/qemu-iotests/141.out diff --git a/tests/qemu-iotests/141 b/tests/qemu-iotests/141 new file mode 100644 index 0000000..434c7ce --- /dev/null +++ b/tests/qemu-iotests/141 @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# +# Tests for persistent dirty bitmap +# +# Copyright (C) 2016 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import os +import iotests +from iotests import qemu_img, qemu_io + +test_img = os.path.join(iotests.test_dir, 'test.img') + +class TestPersistentDirtyBitmap(iotests.QMPTestCase): + image_len = 64 * 1024 * 1024 # MB + def setUp(self): + # Write data to the image so we can compare later + qemu_img('create', '-f', iotests.imgfmt, test_img, str(self.image_len)) + self.vm = iotests.VM().add_drive(test_img) + self.vm.launch() + + def tearDown(self): + self.vm.shutdown() + os.remove(test_img) + + def do_test_create(self, n): + def make_range(k): + return (k * 65536, 512) + r = range(n) + for i in r: + result = self.vm.qmp('block-dirty-bitmap-add', node='drive0', + name='bitmap-%d' % i, + persistent=True) + self.assert_qmp(result, 'return', {}) + self.vm.hmp_qemu_io('drive0', 'write -P %d %d %d' % ((i % 255,) + make_range(i))) + for i in r: + result = self.vm.qmp('block-dirty-bitmap-set-persistent', + node='drive0', name='bitmap-%d' % i, + persistent=False) + self.assert_qmp(result, 'return', {}) + + def test_simple_one(self): + self.do_test_create(1) + + def test_simple_multiple(self): + self.do_test_create(10) + +if __name__ == '__main__': + iotests.main(supported_fmts=['qbm']) diff --git a/tests/qemu-iotests/141.out b/tests/qemu-iotests/141.out new file mode 100644 index 0000000..fbc63e6 --- /dev/null +++ b/tests/qemu-iotests/141.out @@ -0,0 +1,5 @@ +.. +---------------------------------------------------------------------- +Ran 2 tests + +OK diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index e220a00..877bdbb 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -142,4 +142,5 @@ 138 rw auto quick 139 rw auto quick 140 rw auto quick +141 rw auto quick 142 auto