From patchwork Tue Apr 9 13:56:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 235091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4619A2C00BF for ; Tue, 9 Apr 2013 23:56:45 +1000 (EST) Received: from localhost ([::1]:47570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPZ2R-0002ku-Ae for incoming@patchwork.ozlabs.org; Tue, 09 Apr 2013 09:56:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPZ2A-0002kW-99 for qemu-devel@nongnu.org; Tue, 09 Apr 2013 09:56:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPZ24-0003Tp-Ce for qemu-devel@nongnu.org; Tue, 09 Apr 2013 09:56:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPZ24-0003TS-4C for qemu-devel@nongnu.org; Tue, 09 Apr 2013 09:56:20 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r39DuIi5006083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Apr 2013 09:56:19 -0400 Received: from dhcp-200-207.str.redhat.com (dhcp-192-246.str.redhat.com [10.33.192.246]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r39DuH9H030585; Tue, 9 Apr 2013 09:56:17 -0400 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Tue, 9 Apr 2013 15:56:13 +0200 Message-Id: <1365515773-9811-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v2] qemu-iotests: Add test for -drive options 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Kevin Wolf --- v2: - Filter path names in the output, not many users will have a /home/kwolf/... tests/qemu-iotests/051 | 148 +++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/051.out | 162 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 311 insertions(+) create mode 100755 tests/qemu-iotests/051 create mode 100644 tests/qemu-iotests/051.out diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051 new file mode 100755 index 0000000..17a1d92 --- /dev/null +++ b/tests/qemu-iotests/051 @@ -0,0 +1,148 @@ +#!/bin/bash +# +# Test command line configuration of block devices and driver-specific options +# +# Copyright (C) 2013 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=kwolf@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 qcow2 +_supported_proto file +_supported_os Linux + +function do_run_qemu() +{ + echo Testing: "$@" + echo quit | $QEMU -nographic -monitor stdio -serial none "$@" + echo +} + +function run_qemu() +{ + do_run_qemu "$@" 2>&1 | _filter_testdir +} + +size=128M + +_make_test_img $size + +echo +echo === Unknown option === +echo + +run_qemu -drive file=$TEST_IMG,format=qcow2,unknown_opt= +run_qemu -drive file=$TEST_IMG,format=qcow2,unknown_opt=on +run_qemu -drive file=$TEST_IMG,format=qcow2,unknown_opt=1234 +run_qemu -drive file=$TEST_IMG,format=qcow2,unknown_opt=foo + + +echo +echo === Enable and disable lazy refcounting on the command line, plus some invalid values === +echo + +run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=on +run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=off +run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts= +run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=42 +run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=foo + + +echo +echo === With version 2 images enabling lazy refcounts must fail === +echo + +_make_test_img -ocompat=0.10 $size + +run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=on +run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=off + +echo +echo === No medium === +echo + +run_qemu -drive if=floppy +run_qemu -drive if=ide,media=cdrom +run_qemu -drive if=scsi,media=cdrom + +run_qemu -drive if=ide +run_qemu -drive if=virtio +run_qemu -drive if=scsi + +run_qemu -drive if=none,id=disk -device ide-cd,drive=disk +run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-cd,drive=disk + +run_qemu -drive if=none,id=disk -device ide-drive,drive=disk +run_qemu -drive if=none,id=disk -device ide-hd,drive=disk +run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-disk,drive=disk +run_qemu -drive if=none,id=disk -device lsi53c895a -device scsi-hd,drive=disk + +echo +echo === Read-only === +echo + +run_qemu -drive file=$TEST_IMG,if=floppy,readonly=on +run_qemu -drive file=$TEST_IMG,if=ide,media=cdrom,readonly=on +run_qemu -drive file=$TEST_IMG,if=scsi,media=cdrom,readonly=on + +run_qemu -drive file=$TEST_IMG,if=ide,readonly=on +run_qemu -drive file=$TEST_IMG,if=virtio,readonly=on +run_qemu -drive file=$TEST_IMG,if=scsi,readonly=on + +run_qemu -drive file=$TEST_IMG,if=none,id=disk,readonly=on -device ide-cd,drive=disk +run_qemu -drive file=$TEST_IMG,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-cd,drive=disk + +run_qemu -drive file=$TEST_IMG,if=none,id=disk,readonly=on -device ide-drive,drive=disk +run_qemu -drive file=$TEST_IMG,if=none,id=disk,readonly=on -device ide-hd,drive=disk +run_qemu -drive file=$TEST_IMG,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-disk,drive=disk +run_qemu -drive file=$TEST_IMG,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-hd,drive=disk + +echo +echo === Cache modes === +echo + +# Cannot use the test image because cache=none might not work on the host FS +# Use cdrom so that we won't get errors about missing media + +run_qemu -drive media=cdrom,cache=none +run_qemu -drive media=cdrom,cache=directsync +run_qemu -drive media=cdrom,cache=writeback +run_qemu -drive media=cdrom,cache=writethrough +run_qemu -drive media=cdrom,cache=unsafe +run_qemu -drive media=cdrom,cache=invalid_value + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out new file mode 100644 index 0000000..da0d18b --- /dev/null +++ b/tests/qemu-iotests/051.out @@ -0,0 +1,162 @@ +QA output created by 051 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 + +=== Unknown option === + +Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt= +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt' +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=: could not open disk image TEST_DIR/t.qcow2: Invalid argument + +Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=on +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=on: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt' +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=on: could not open disk image TEST_DIR/t.qcow2: Invalid argument + +Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=1234 +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=1234: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt' +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=1234: could not open disk image TEST_DIR/t.qcow2: Invalid argument + +Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo: Block format 'qcow2' used by device 'ide0-hd0' doesn't support the option 'unknown_opt' +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo: could not open disk image TEST_DIR/t.qcow2: Invalid argument + + +=== Enable and disable lazy refcounting on the command line, plus some invalid values === + +Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=on +qququiquit + +Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=off +qququiquit + +Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts= +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=: Parameter 'lazy_refcounts' expects 'on' or 'off' +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=: could not open disk image TEST_DIR/t.qcow2: Invalid argument + +Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=42 +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=42: Parameter 'lazy_refcounts' expects 'on' or 'off' +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=42: could not open disk image TEST_DIR/t.qcow2: Invalid argument + +Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=foo +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=foo: Parameter 'lazy_refcounts' expects 'on' or 'off' +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=foo: could not open disk image TEST_DIR/t.qcow2: Invalid argument + + +=== With version 2 images enabling lazy refcounts must fail === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 +Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=on +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=on: Lazy refcounts require a qcow2 image with at least qemu 1.1 compatibility level +qemu: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=on: could not open disk image TEST_DIR/t.qcow2: Invalid argument + +Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=off +qququiquit + + +=== No medium === + +Testing: -drive if=floppy +qququiquit + +Testing: -drive if=ide,media=cdrom +qququiquit + +Testing: -drive if=scsi,media=cdrom +qququiquit + +Testing: -drive if=ide +qemu: Device needs media, but drive is empty +qemu: Initialization of device ide-hd failed + +Testing: -drive if=virtio +qemu: -drive if=virtio: Device needs media, but drive is empty +qemu: -drive if=virtio: Device 'virtio-blk-pci' could not be initialized + +Testing: -drive if=scsi +qemu: -drive if=scsi: Device needs media, but drive is empty +qemu: Initialization of device lsi53c895a failed + +Testing: -drive if=none,id=disk -device ide-cd,drive=disk +qququiquit + +Testing: -drive if=none,id=disk -device lsi53c895a -device scsi-cd,drive=disk +qququiquit + +Testing: -drive if=none,id=disk -device ide-drive,drive=disk +qemu: -device ide-drive,drive=disk: Device needs media, but drive is empty +qemu: -device ide-drive,drive=disk: Device 'ide-drive' could not be initialized + +Testing: -drive if=none,id=disk -device ide-hd,drive=disk +qemu: -device ide-hd,drive=disk: Device needs media, but drive is empty +qemu: -device ide-hd,drive=disk: Device 'ide-hd' could not be initialized + +Testing: -drive if=none,id=disk -device lsi53c895a -device scsi-disk,drive=disk +qemu: -device scsi-disk,drive=disk: Device needs media, but drive is empty +qemu: -device scsi-disk,drive=disk: Device 'scsi-disk' could not be initialized + +Testing: -drive if=none,id=disk -device lsi53c895a -device scsi-hd,drive=disk +qemu: -device scsi-hd,drive=disk: Device needs media, but drive is empty +qemu: -device scsi-hd,drive=disk: Device 'scsi-hd' could not be initialized + + +=== Read-only === + +Testing: -drive file=TEST_DIR/t.qcow2,if=floppy,readonly=on +qququiquit + +Testing: -drive file=TEST_DIR/t.qcow2,if=ide,media=cdrom,readonly=on +qququiquit + +Testing: -drive file=TEST_DIR/t.qcow2,if=scsi,media=cdrom,readonly=on +qququiquit + +Testing: -drive file=TEST_DIR/t.qcow2,if=ide,readonly=on +qemu: -drive file=TEST_DIR/t.qcow2,if=ide,readonly=on: readonly not supported by this bus type + +Testing: -drive file=TEST_DIR/t.qcow2,if=virtio,readonly=on +qququiquit + +Testing: -drive file=TEST_DIR/t.qcow2,if=scsi,readonly=on +qququiquit + +Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device ide-cd,drive=disk +qququiquit + +Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-cd,drive=disk +qququiquit + +Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device ide-drive,drive=disk +qemu: -device ide-drive,drive=disk: Can't use a read-only drive +qemu: -device ide-drive,drive=disk: Device 'ide-drive' could not be initialized + +Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device ide-hd,drive=disk +qemu: -device ide-hd,drive=disk: Can't use a read-only drive +qemu: -device ide-hd,drive=disk: Device 'ide-hd' could not be initialized + +Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-disk,drive=disk +qququiquit + +Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-hd,drive=disk +qququiquit + + +=== Cache modes === + +Testing: -drive media=cdrom,cache=none +qququiquit + +Testing: -drive media=cdrom,cache=directsync +qququiquit + +Testing: -drive media=cdrom,cache=writeback +qququiquit + +Testing: -drive media=cdrom,cache=writethrough +qququiquit + +Testing: -drive media=cdrom,cache=unsafe +qququiquit + +Testing: -drive media=cdrom,cache=invalid_value +qemu: -drive media=cdrom,cache=invalid_value: invalid cache option + +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 73c5966..324bacb 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -57,4 +57,5 @@ 048 img auto quick 049 rw auto 050 rw auto backing quick +051 rw auto 052 rw auto backing