From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx1e7-0008WS-Fx for qemu-devel@nongnu.org; Tue, 17 Jun 2014 18:14:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wx1e2-0000B5-Jf for qemu-devel@nongnu.org; Tue, 17 Jun 2014 18:14:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30942) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx1e2-0000Al-57 for qemu-devel@nongnu.org; Tue, 17 Jun 2014 18:14:22 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5HMELNl018384 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 17 Jun 2014 18:14:21 -0400 From: Max Reitz Date: Wed, 18 Jun 2014 00:14:10 +0200 Message-Id: <1403043250-28472-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1403043250-28472-1-git-send-email-mreitz@redhat.com> References: <1403043250-28472-1-git-send-email-mreitz@redhat.com> Subject: [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: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz Add a new test for qemu-iotests which checks whether the "filename" (and consequently the "file") attribute is set for images which are opened over NBD. 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 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=mreitz@redhat.com + +seq="$(basename $0)" +echo "QA output created by $seq" + +here="$PWD" +tmp=/tmp/$$ +status=1 # 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=128K + +echo +echo '=== Testing NBD filename ("filename" and "file" should be set to TEST_IMG) ===' +echo + +_make_test_img $IMG_SIZE + +run_qemu -drive file=$TEST_IMG,format=raw,if=none <