Blame SOURCES/kvm-iotests-add-test-226-for-file-driver-types.patch

357786
From 60808b0c672add535f7381785faa6e5609fb20ce Mon Sep 17 00:00:00 2001
357786
From: Kevin Wolf <kwolf@redhat.com>
357786
Date: Fri, 13 Jul 2018 14:50:02 +0200
357786
Subject: [PATCH 44/89] iotests: add test 226 for file driver types
357786
357786
RH-Author: Kevin Wolf <kwolf@redhat.com>
357786
Message-id: <20180713145002.20953-3-kwolf@redhat.com>
357786
Patchwork-id: 81351
357786
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 2/2] iotests: add test 226 for file driver types
357786
Bugzilla: 1525829
357786
RH-Acked-by: John Snow <jsnow@redhat.com>
357786
RH-Acked-by: Max Reitz <mreitz@redhat.com>
357786
RH-Acked-by: Fam Zheng <famz@redhat.com>
357786
357786
From: John Snow <jsnow@redhat.com>
357786
357786
Test that we're rejecting what we ought to for file,
357786
host_driver and host_cdrom drivers. Test that we're
357786
seeing the deprecated message for block and chardevs
357786
on the file driver.
357786
357786
Signed-off-by: John Snow <jsnow@redhat.com>
357786
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
357786
(cherry picked from commit 2d4cb49ddaa219ed3f5a985ecf8b188aeb2b3d6b)
357786
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 tests/qemu-iotests/226     | 66 ++++++++++++++++++++++++++++++++++++++++++++++
357786
 tests/qemu-iotests/226.out | 26 ++++++++++++++++++
357786
 tests/qemu-iotests/group   |  1 +
357786
 3 files changed, 93 insertions(+)
357786
 create mode 100755 tests/qemu-iotests/226
357786
 create mode 100644 tests/qemu-iotests/226.out
357786
357786
diff --git a/tests/qemu-iotests/226 b/tests/qemu-iotests/226
357786
new file mode 100755
357786
index 0000000..460aea2
357786
--- /dev/null
357786
+++ b/tests/qemu-iotests/226
357786
@@ -0,0 +1,66 @@
357786
+#!/bin/bash
357786
+#
357786
+# This test covers expected filetypes for the file, host_cdrom and
357786
+# host_device drivers.
357786
+#
357786
+# Copyright (C) 2018 Red Hat, Inc.
357786
+#
357786
+# This program is free software; you can redistribute it and/or modify
357786
+# it under the terms of the GNU General Public License as published by
357786
+# the Free Software Foundation; either version 2 of the License, or
357786
+# (at your option) any later version.
357786
+#
357786
+# This program is distributed in the hope that it will be useful,
357786
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
357786
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
357786
+# GNU General Public License for more details.
357786
+#
357786
+# You should have received a copy of the GNU General Public License
357786
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
357786
+#
357786
+
357786
+# creator
357786
+owner=jsnow@redhat.com
357786
+
357786
+seq=`basename $0`
357786
+echo "QA output created by $seq"
357786
+
357786
+here=`pwd`
357786
+status=1    # failure is the default!
357786
+
357786
+_cleanup()
357786
+{
357786
+    rmdir "$TEST_IMG"
357786
+}
357786
+trap "_cleanup; exit \$status" 0 1 2 3 15
357786
+
357786
+# get standard environment, filters and checks
357786
+. ./common.rc
357786
+. ./common.filter
357786
+. ./common.pattern
357786
+
357786
+# Generic format, but tests file-protocol specific error handling
357786
+_supported_fmt generic
357786
+_supported_proto file
357786
+_supported_os Linux
357786
+
357786
+# Create something decidedly not a file, blockdev or chardev...
357786
+mkdir "$TEST_IMG"
357786
+
357786
+for PROTO in "file" "host_device" "host_cdrom"; do
357786
+    echo
357786
+    echo "=== Testing with driver:$PROTO ==="
357786
+    echo
357786
+    echo "== Testing RO =="
357786
+    $QEMU_IO -c "open -r -o driver=$PROTO,filename=$TEST_IMG" 2>&1 | _filter_imgfmt | _filter_testdir
357786
+    $QEMU_IO -c "open -r -o driver=$PROTO,filename=/dev/null" 2>&1 | _filter_imgfmt
357786
+    echo "== Testing RW =="
357786
+    $QEMU_IO -c "open -o driver=$PROTO,filename=$TEST_IMG" 2>&1 | _filter_imgfmt | _filter_testdir
357786
+    $QEMU_IO -c "open -o driver=$PROTO,filename=/dev/null" 2>&1 | _filter_imgfmt
357786
+done
357786
+
357786
+# success, all done
357786
+echo
357786
+echo "*** done"
357786
+rm -f $seq.full
357786
+status=0
357786
diff --git a/tests/qemu-iotests/226.out b/tests/qemu-iotests/226.out
357786
new file mode 100644
357786
index 0000000..8c0d060
357786
--- /dev/null
357786
+++ b/tests/qemu-iotests/226.out
357786
@@ -0,0 +1,26 @@
357786
+QA output created by 226
357786
+
357786
+=== Testing with driver:file ===
357786
+
357786
+== Testing RO ==
357786
+can't open: A regular file was expected by the 'file' driver, but something else was given
357786
+warning: Opening a character device as a file using the 'file' driver is deprecated
357786
+== Testing RW ==
357786
+can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory
357786
+warning: Opening a character device as a file using the 'file' driver is deprecated
357786
+
357786
+=== Testing with driver:host_device ===
357786
+
357786
+== Testing RO ==
357786
+can't open: 'host_device' driver expects either a character or block device
357786
+== Testing RW ==
357786
+can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory
357786
+
357786
+=== Testing with driver:host_cdrom ===
357786
+
357786
+== Testing RO ==
357786
+can't open: 'host_cdrom' driver expects either a character or block device
357786
+== Testing RW ==
357786
+can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory
357786
+
357786
+*** done
357786
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
357786
index 5c55adc..11498fd 100644
357786
--- a/tests/qemu-iotests/group
357786
+++ b/tests/qemu-iotests/group
357786
@@ -218,3 +218,4 @@
357786
 217 rw auto quick
357786
 218 rw auto quick
357786
 219 rw auto
357786
+226 auto quick
357786
-- 
357786
1.8.3.1
357786