pci: acpi: wire up AcpiDevAmlIf interface to generic bridge
[qemu.git] / tests / qemu-iotests / 232
blobb30faaa21806d31e65d511980386100bd9da87de
1 #!/usr/bin/env bash
2 # group: quick
4 # Test for auto-read-only
6 # Copyright (C) 2018 Red Hat, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 # creator
23 owner=kwolf@redhat.com
25 seq=`basename $0`
26 echo "QA output created by $seq"
28 status=1 # failure is the default!
30 _cleanup()
32 _cleanup_test_img
33 for img in "$TEST_IMG".[01234]; do
34 _rm_test_img "$img"
35 done
37 trap "_cleanup; exit \$status" 0 1 2 3 15
39 # get standard environment, filters and checks
40 . ./common.rc
41 . ./common.filter
43 _supported_fmt generic
44 _supported_proto file
45 _supported_os Linux
47 do_run_qemu()
49 echo Testing: "$@"
51 if ! test -t 0; then
52 while read cmd; do
53 echo $cmd
54 done
56 echo quit
57 ) | $QEMU -nographic -monitor stdio -nodefaults "$@"
58 echo
61 run_qemu()
63 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp |
64 _filter_generated_node_ids | _filter_imgfmt
67 run_qemu_info_block()
69 echo "info block -n" | run_qemu "$@" | grep -e "(file" -e "QEMU_PROG"
72 size=128M
74 _make_test_img $size
76 if [ -n "$TEST_IMG_FILE" ]; then
77 TEST_IMG=$TEST_IMG_FILE
80 chmod a-w $TEST_IMG
81 (echo test > $TEST_IMG) 2>/dev/null && \
82 _notrun "Readonly attribute is ignored, probably you run this test as" \
83 "root, which is unsupported."
84 chmod a+w $TEST_IMG
86 echo
87 echo "=== -drive with read-write image: read-only/auto-read-only combinations ==="
88 echo
90 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=off
91 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=on
92 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on
93 echo
94 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=off
95 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=on
96 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off
97 echo
98 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=off
99 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=on
100 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none
102 echo
103 echo "=== -drive with read-only image: read-only/auto-read-only combinations ==="
104 echo
106 chmod a-w $TEST_IMG
108 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=off
109 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on,auto-read-only=on
110 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=on
111 echo
112 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=off
113 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off,auto-read-only=on
114 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,read-only=off
115 echo
116 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=off
117 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none,auto-read-only=on
118 run_qemu_info_block -drive driver=file,file="$TEST_IMG",if=none
120 echo
121 echo "=== -blockdev with read-write image: read-only/auto-read-only combinations ==="
122 echo
124 chmod a+w $TEST_IMG
126 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=off
127 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=on
128 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on
129 echo
130 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=off
131 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=on
132 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off
133 echo
134 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=off
135 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=on
136 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0
138 echo
139 echo "=== -blockdev with read-only image: read-only/auto-read-only combinations ==="
140 echo
142 chmod a-w $TEST_IMG
144 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=off
145 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on,auto-read-only=on
146 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=on
147 echo
148 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=off
149 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off,auto-read-only=on
150 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,read-only=off
151 echo
152 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=off
153 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=on
154 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0
156 # success, all done
157 echo "*** done"
158 rm -f $seq.full
159 status=0