From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0HNy-0006xJ-Gj for qemu-devel@nongnu.org; Thu, 26 Jun 2014 17:39:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0HNs-0001Rq-RB for qemu-devel@nongnu.org; Thu, 26 Jun 2014 17:39:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0HNs-0001Rd-Je for qemu-devel@nongnu.org; Thu, 26 Jun 2014 17:39:08 -0400 From: Max Reitz Date: Thu, 26 Jun 2014 23:38:47 +0200 Message-Id: <1403818727-11215-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1403818727-11215-1-git-send-email-mreitz@redhat.com> References: <1403818727-11215-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v3 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 , =?UTF-8?q?Beno=C3=AEt=20Canet?= , 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 <