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