From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGyME-0003JY-Ss for qemu-devel@nongnu.org; Fri, 21 Feb 2014 17:14:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGyMA-0000k1-DI for qemu-devel@nongnu.org; Fri, 21 Feb 2014 17:14:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28263) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGyMA-0000js-4i for qemu-devel@nongnu.org; Fri, 21 Feb 2014 17:14:06 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1LME5sO028479 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 Feb 2014 17:14:05 -0500 From: Kevin Wolf Date: Fri, 21 Feb 2014 23:12:49 +0100 Message-Id: <1393020771-32712-53-git-send-email-kwolf@redhat.com> In-Reply-To: <1393020771-32712-1-git-send-email-kwolf@redhat.com> References: <1393020771-32712-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 52/54] quorum: Add unit test. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Beno=C3=AEt Canet Signed-off-by: Benoit Canet Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- tests/qemu-iotests/081 | 95 ++++++++++++++++++++++++++++++++++++++++= ++++++ tests/qemu-iotests/081.out | 34 +++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 130 insertions(+) create mode 100755 tests/qemu-iotests/081 create mode 100644 tests/qemu-iotests/081.out diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081 new file mode 100755 index 0000000..be34544 --- /dev/null +++ b/tests/qemu-iotests/081 @@ -0,0 +1,95 @@ +#!/bin/bash +# +# Test Quorum block driver +# +# Copyright (C) 2013 Nodalink, SARL. +# +# 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 . +# + +# creator +owner=3Dbenoit@irqsave.net + +seq=3D`basename $0` +echo "QA output created by $seq" + +here=3D`pwd` +tmp=3D/tmp/$$ +status=3D1 # failure is the default! + +_cleanup() +{ + rm -rf $TEST_DIR/1.raw + rm -rf $TEST_DIR/2.raw + rm -rf $TEST_DIR/3.raw +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt raw +_supported_proto generic +_supported_os Linux + +quorum=3D"file.driver=3Dquorum,file.children.0.file.filename=3D$TEST_DIR= /1.raw" +quorum=3D"$quorum,file.children.1.file.filename=3D$TEST_DIR/2.raw" +quorum=3D"$quorum,file.children.2.file.filename=3D$TEST_DIR/3.raw,file.v= ote-threshold=3D2" + +echo +echo "=3D=3D creating quorum files =3D=3D" + +size=3D10M + +TEST_IMG=3D"$TEST_DIR/1.raw" _make_test_img $size +TEST_IMG=3D"$TEST_DIR/2.raw" _make_test_img $size +TEST_IMG=3D"$TEST_DIR/3.raw" _make_test_img $size + +echo +echo "=3D=3D writing images =3D=3D" + +$QEMU_IO -c "open -o $quorum" -c "write -P 0x32 0 $size" | _filter_qemu_= io + +echo +echo "=3D=3D checking quorum write =3D=3D" + +$QEMU_IO -c "read -P 0x32 0 $size" "$TEST_DIR/1.raw" | _filter_qemu_io +$QEMU_IO -c "read -P 0x32 0 $size" "$TEST_DIR/2.raw" | _filter_qemu_io +$QEMU_IO -c "read -P 0x32 0 $size" "$TEST_DIR/3.raw" | _filter_qemu_io + +echo +echo "=3D=3D corrupting image =3D=3D" + +$QEMU_IO -c "write -P 0x42 0 $size" "$TEST_DIR/2.raw" | _filter_qemu_io + +echo +echo "=3D=3D checking quorum correction =3D=3D" + +$QEMU_IO -c "open -o $quorum" -c "read -P 0x32 0 $size" | _filter_qemu_i= o + +echo +echo "=3D=3D breaking quorum =3D=3D" + +$QEMU_IO -c "write -P 0x41 0 $size" "$TEST_DIR/1.raw" | _filter_qemu_io +echo +echo "=3D=3D checking that quorum is broken =3D=3D" + +$QEMU_IO -c "open -o $quorum" -c "read -P 0x32 0 $size" | _filter_qemu_i= o + + +# success, all done +echo "*** done" +rm -f $seq.full +status=3D0 diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out new file mode 100644 index 0000000..b5b55ab --- /dev/null +++ b/tests/qemu-iotests/081.out @@ -0,0 +1,34 @@ +QA output created by 081 + +=3D=3D creating quorum files =3D=3D +Formatting 'TEST_DIR/1.IMGFMT', fmt=3DIMGFMT size=3D10485760=20 +Formatting 'TEST_DIR/2.IMGFMT', fmt=3DIMGFMT size=3D10485760=20 +Formatting 'TEST_DIR/3.IMGFMT', fmt=3DIMGFMT size=3D10485760=20 + +=3D=3D writing images =3D=3D +wrote 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D checking quorum write =3D=3D +read 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D corrupting image =3D=3D +wrote 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D checking quorum correction =3D=3D +read 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D breaking quorum =3D=3D +wrote 10485760/10485760 bytes at offset 0 +10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D checking that quorum is broken =3D=3D +qemu-io: can't open device (null): Could not read image for determining = its format: Input/output error +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 80b181f..db127d9 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -83,4 +83,5 @@ 074 rw auto 077 rw auto 079 rw auto +081 rw auto 082 rw auto quick --=20 1.8.1.4