From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxGDJ-0005w9-1N for qemu-devel@nongnu.org; Wed, 18 Jun 2014 09:47:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxGDD-0002By-DL for qemu-devel@nongnu.org; Wed, 18 Jun 2014 09:47:44 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:51545 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxGDD-0002Bt-3o for qemu-devel@nongnu.org; Wed, 18 Jun 2014 09:47:39 -0400 Date: Wed, 18 Jun 2014 15:47:38 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140618134738.GC4424@irqsave.net> References: <1403043250-28472-1-git-send-email-mreitz@redhat.com> <1403043250-28472-3-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1403043250-28472-3-git-send-email-mreitz@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/2] iotests: Add test for set "filename" for NBD List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi The Wednesday 18 Jun 2014 =E0 00:14:10 (+0200), Max Reitz wrote : > Add a new test for qemu-iotests which checks whether the "filename" (an= d > consequently the "file") attribute is set for images which are opened > over NBD. >=20 > Signed-off-by: Max Reitz > --- > tests/qemu-iotests/097 | 72 ++++++++++++++++++++++++++++++++++++++= ++++++++ > tests/qemu-iotests/097.out | 13 +++++++++ > tests/qemu-iotests/group | 1 + > 3 files changed, 86 insertions(+) > create mode 100755 tests/qemu-iotests/097 > create mode 100644 tests/qemu-iotests/097.out >=20 > diff --git a/tests/qemu-iotests/097 b/tests/qemu-iotests/097 > new file mode 100755 > index 0000000..c471ef2 > --- /dev/null > +++ b/tests/qemu-iotests/097 > @@ -0,0 +1,72 @@ > +#!/bin/bash > +# > +# Test case for correct filename attribute for NBD > +# > +# Copyright (C) 2014 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 = . > +# > + > +# creator > +owner=3Dmreitz@redhat.com > + > +seq=3D"$(basename $0)" > +echo "QA output created by $seq" > + > +here=3D"$PWD" > +tmp=3D/tmp/$$ > +status=3D1 # failure is the default! > + > +_cleanup() > +{ > + _cleanup_test_img > +} > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +# get standard environment, filters and checks > +. ./common.rc > +. ./common.filter > + > +_supported_fmt generic > +_supported_proto nbd > +_supported_os Linux > + > +function do_run_qemu() > +{ > + $QEMU -nographic -qmp stdio -serial none "$@" > +} > + > +function run_qemu() > +{ > + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | sed -e "s#= $TEST_IMG#TEST_IMG#g" > +} > + > +IMG_SIZE=3D128K > + > +echo > +echo '=3D=3D=3D Testing NBD filename ("filename" and "file" should be = set to TEST_IMG) =3D=3D=3D' > +echo > + > +_make_test_img $IMG_SIZE > + > +run_qemu -drive file=3D$TEST_IMG,format=3Draw,if=3Dnone < +{ 'execute': 'qmp_capabilities' } > +{ 'execute': 'query-block' } > +{ 'execute': 'quit' } > +QMP > + > +# success, all done > +echo "*** done" > +rm -f $seq.full > +status=3D0 > diff --git a/tests/qemu-iotests/097.out b/tests/qemu-iotests/097.out > new file mode 100644 > index 0000000..8ee6680 > --- /dev/null > +++ b/tests/qemu-iotests/097.out > @@ -0,0 +1,13 @@ > +QA output created by 097 > + > +=3D=3D=3D Testing NBD filename =3D=3D=3D > + > +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D131072=20 > +QMP_VERSION > +{"return": {}} > +{"return": [{"device": "none0", "locked": false, "removable": true, "i= nserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size"= : 131072, "filename": "TEST_IMG", "format": "raw"}, "iops_wr": 0, "ro": f= alse, "backing_file_depth": 0, "drv": "raw", "iops": 0, "bps_wr": 0, "enc= rypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_IMG", "encryption_ke= y_missing": false}, "tray_open": false, "type": "unknown"}, {"io-status":= "ok", "device": "ide1-cd0", "locked": false, "removable": true, "tray_op= en": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "r= emovable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0"= , "locked": false, "removable": true, "tray_open": false, "type": "unknow= n"}]} Is the real filename really TEST_IMG ? or is it some result of the filena= me being passed in $TEST_IMG ? it's confusing. > +{"return": {}} > +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "ev= ent": "SHUTDOWN"} > +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "ev= ent": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": tr= ue}} > +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "ev= ent": "DEVICE_TRAY_MOVED", "data": {"device": "floppy0", "tray-open": tru= e}} > +*** done > diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group > index 0f07440..5447660 100644 > --- a/tests/qemu-iotests/group > +++ b/tests/qemu-iotests/group > @@ -99,3 +99,4 @@ > 090 rw auto quick > 091 rw auto > 092 rw auto quick > +097 rw auto > --=20 > 2.0.0 >=20 >=20