|
|
7711c0 |
From 64dfcbf0230040e118a00ac921ba2b39d99bb094 Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Date: Fri, 23 Nov 2018 10:41:53 +0100
|
|
|
7711c0 |
Subject: [PATCH 12/34] qemu-iotests: Test auto-read-only with -drive and
|
|
|
7711c0 |
-blockdev
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Message-id: <20181123104154.13541-12-kwolf@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 83119
|
|
|
7711c0 |
O-Subject: [RHEL-7.7/7.6.z qemu-kvm-rhev PATCH v2 11/12] qemu-iotests: Test auto-read-only with -drive and -blockdev
|
|
|
7711c0 |
Bugzilla: 1623986
|
|
|
7711c0 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit 36f808fa15f85a894c2f6cce9df46d27e8f0f129)
|
|
|
7711c0 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
tests/qemu-iotests/232 | 147 +++++++++++++++++++++++++++++++++++++++++++++
|
|
|
7711c0 |
tests/qemu-iotests/232.out | 59 ++++++++++++++++++
|
|
|
7711c0 |
tests/qemu-iotests/group | 1 +
|
|
|
7711c0 |
3 files changed, 207 insertions(+)
|
|
|
7711c0 |
create mode 100755 tests/qemu-iotests/232
|
|
|
7711c0 |
create mode 100644 tests/qemu-iotests/232.out
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232
|
|
|
7711c0 |
new file mode 100755
|
|
|
7711c0 |
index 0000000..bc2972d
|
|
|
7711c0 |
--- /dev/null
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/232
|
|
|
7711c0 |
@@ -0,0 +1,147 @@
|
|
|
7711c0 |
+#!/bin/bash
|
|
|
7711c0 |
+#
|
|
|
7711c0 |
+# Test for auto-read-only
|
|
|
7711c0 |
+#
|
|
|
7711c0 |
+# Copyright (C) 2018 Red Hat, Inc.
|
|
|
7711c0 |
+#
|
|
|
7711c0 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
7711c0 |
+# it under the terms of the GNU General Public License as published by
|
|
|
7711c0 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
7711c0 |
+# (at your option) any later version.
|
|
|
7711c0 |
+#
|
|
|
7711c0 |
+# This program is distributed in the hope that it will be useful,
|
|
|
7711c0 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
7711c0 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
7711c0 |
+# GNU General Public License for more details.
|
|
|
7711c0 |
+#
|
|
|
7711c0 |
+# You should have received a copy of the GNU General Public License
|
|
|
7711c0 |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
7711c0 |
+#
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+# creator
|
|
|
7711c0 |
+owner=kwolf@redhat.com
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+seq=`basename $0`
|
|
|
7711c0 |
+echo "QA output created by $seq"
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+here=`pwd`
|
|
|
7711c0 |
+status=1 # failure is the default!
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+_cleanup()
|
|
|
7711c0 |
+{
|
|
|
7711c0 |
+ _cleanup_test_img
|
|
|
7711c0 |
+ rm -f $TEST_IMG.snap
|
|
|
7711c0 |
+}
|
|
|
7711c0 |
+trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+# get standard environment, filters and checks
|
|
|
7711c0 |
+. ./common.rc
|
|
|
7711c0 |
+. ./common.filter
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+_supported_fmt generic
|
|
|
7711c0 |
+_supported_proto file
|
|
|
7711c0 |
+_supported_os Linux
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+function do_run_qemu()
|
|
|
7711c0 |
+{
|
|
|
7711c0 |
+ echo Testing: "$@"
|
|
|
7711c0 |
+ (
|
|
|
7711c0 |
+ if ! test -t 0; then
|
|
|
7711c0 |
+ while read cmd; do
|
|
|
7711c0 |
+ echo $cmd
|
|
|
7711c0 |
+ done
|
|
|
7711c0 |
+ fi
|
|
|
7711c0 |
+ echo quit
|
|
|
7711c0 |
+ ) | $QEMU -nographic -monitor stdio -nodefaults "$@"
|
|
|
7711c0 |
+ echo
|
|
|
7711c0 |
+}
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+function run_qemu()
|
|
|
7711c0 |
+{
|
|
|
7711c0 |
+ do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp |
|
|
|
7711c0 |
+ _filter_generated_node_ids | _filter_imgfmt
|
|
|
7711c0 |
+}
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+function run_qemu_info_block()
|
|
|
7711c0 |
+{
|
|
|
7711c0 |
+ echo "info block -n" | run_qemu "$@" | grep -e "(file" -e "QEMU_PROG"
|
|
|
7711c0 |
+}
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+size=128M
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+_make_test_img $size
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+echo "=== -drive with read-write image: read-only/auto-read-only combinations ==="
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+echo "=== -drive with read-only image: read-only/auto-read-only combinations ==="
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+chmod a-w $TEST_IMG
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+echo "=== -blockdev with read-write image: read-only/auto-read-only combinations ==="
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+chmod a+w $TEST_IMG
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+echo "=== -blockdev with read-only image: read-only/auto-read-only combinations ==="
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+chmod a-w $TEST_IMG
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off
|
|
|
7711c0 |
+echo
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=off
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=on
|
|
|
7711c0 |
+run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+# success, all done
|
|
|
7711c0 |
+echo "*** done"
|
|
|
7711c0 |
+rm -f $seq.full
|
|
|
7711c0 |
+status=0
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/232.out b/tests/qemu-iotests/232.out
|
|
|
7711c0 |
new file mode 100644
|
|
|
7711c0 |
index 0000000..dcb683a
|
|
|
7711c0 |
--- /dev/null
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/232.out
|
|
|
7711c0 |
@@ -0,0 +1,59 @@
|
|
|
7711c0 |
+QA output created by 232
|
|
|
7711c0 |
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+=== -drive with read-write image: read-only/auto-read-only combinations ===
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+=== -drive with read-only image: read-only/auto-read-only combinations ===
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+QEMU_PROG: -drive driver=file,file=TEST_DIR/t.IMGFMT,if=none,read-only=off,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+QEMU_PROG: -drive driver=file,file=TEST_DIR/t.IMGFMT,if=none,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+=== -blockdev with read-write image: read-only/auto-read-only combinations ===
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+=== -blockdev with read-only image: read-only/auto-read-only combinations ===
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,read-only=off,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
|
7711c0 |
+node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
7711c0 |
+QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
|
7711c0 |
+*** done
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
|
|
|
7711c0 |
index 06a7107..fcbf3f3 100644
|
|
|
7711c0 |
--- a/tests/qemu-iotests/group
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/group
|
|
|
7711c0 |
@@ -225,3 +225,4 @@
|
|
|
7711c0 |
227 auto quick
|
|
|
7711c0 |
229 auto quick
|
|
|
7711c0 |
231 auto quick
|
|
|
7711c0 |
+232 auto quick
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|