vga: build virtio-gpu as module
[qemu/ar7.git] / tests / qemu-iotests / 172
blob3abfa72948f6783d3835979773e397d1a5d884ac
1 #!/usr/bin/env bash
3 # Test floppy configuration
5 # Copyright (C) 2016 Red Hat, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # creator
22 owner=kwolf@redhat.com
24 seq=`basename $0`
25 echo "QA output created by $seq"
27 status=1 # failure is the default!
29 _cleanup()
31 _cleanup_test_img
32 _rm_test_img "$TEST_IMG.2"
33 _rm_test_img "$TEST_IMG.3"
35 trap "_cleanup; exit \$status" 0 1 2 3 15
37 # get standard environment, filters and checks
38 . ./common.rc
39 . ./common.filter
41 _supported_fmt qcow2
42 _supported_proto file
43 _supported_os Linux
45 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
46 _notrun "Requires a PC machine"
49 do_run_qemu()
52 if ! test -t 0; then
53 while read cmd; do
54 echo $cmd
55 done
57 echo quit
58 ) | $QEMU -accel qtest -nographic -monitor stdio -serial none "$@"
59 echo
62 check_floppy_qtree()
64 echo
65 echo Testing: "$@" | _filter_testdir
67 # QEMU_OPTIONS contains -nodefaults, we don't want that here because the
68 # defaults are part of what should be checked here.
70 # Apply the sed filter to stdout only, but keep the stderr output and
71 # filter the qemu program name in it.
72 printf "info qtree\ninfo block\n" |
73 (QEMU_OPTIONS="" do_run_qemu "$@" |
74 _filter_testdir |_filter_generated_node_ids | _filter_hmp |
75 sed -ne '/^ dev: isa-fdc/,/^ dev:/{x;p};/^[a-z][^ ]* (NODE_NAME):* /,/^(qemu)$/{p}') 2>&1 |
76 _filter_win32 | _filter_qemu
79 check_cache_mode()
81 echo "info block none0" |
82 QEMU_OPTIONS="" do_run_qemu -drive if=none,file="$TEST_IMG" "$@" |
83 _filter_win32 | _filter_qemu | grep "Cache mode"
87 size=720k
89 _make_test_img $size
91 TEST_IMG="$TEST_IMG.2" _make_test_img $size
92 TEST_IMG="$TEST_IMG.3" _make_test_img $size
94 # Default drive semantics:
96 # By default you get a single empty floppy drive. You can override it with
97 # -drive and using the same index, but if you use -drive to add a floppy to a
98 # different index, you get both of them. However, as soon as you use any
99 # '-device floppy', even to a different slot, the default drive is disabled.
101 echo
102 echo
103 echo === Default ===
105 check_floppy_qtree
107 echo
108 echo
109 echo === Using -fda/-fdb options ===
111 check_floppy_qtree -fda "$TEST_IMG"
112 check_floppy_qtree -fdb "$TEST_IMG"
113 check_floppy_qtree -fda "$TEST_IMG" -fdb "$TEST_IMG.2"
114 check_floppy_qtree -fdb ""
117 echo
118 echo
119 echo === Using -drive options ===
121 check_floppy_qtree -drive if=floppy,file="$TEST_IMG"
122 check_floppy_qtree -drive if=floppy,file="$TEST_IMG",index=1
123 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=floppy,file="$TEST_IMG.2",index=1
125 echo
126 echo
127 echo === Using -drive if=none and -global ===
129 check_floppy_qtree -drive if=none,file="$TEST_IMG" -global isa-fdc.driveA=none0
130 check_floppy_qtree -drive if=none,file="$TEST_IMG" -global isa-fdc.driveB=none0
131 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
132 -global isa-fdc.driveA=none0 -global isa-fdc.driveB=none1
134 echo
135 echo
136 echo === Using -drive if=none and -device ===
138 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0
139 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,unit=1
140 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
141 -device floppy,drive=none0 -device floppy,drive=none1,unit=1
143 echo
144 echo
145 echo === Mixing -fdX and -global ===
147 # Working
148 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveB=none0
149 check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveA=none0
151 # Conflicting
152 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveA=none0
153 check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveB=none0
154 # Conflicting, -fdX wins
155 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global floppy.drive=none0
157 echo
158 echo
159 echo === Mixing -fdX and -device ===
161 # Working
162 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0
163 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=1
165 check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0
166 check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=0
168 # Conflicting
169 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=0
170 check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=1
172 echo
173 echo
174 echo === Mixing -drive and -device ===
176 # Working
177 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0
178 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=1
180 # Conflicting
181 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=0
183 echo
184 echo
185 echo === Mixing -global and -device ===
187 # Working
188 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
189 -global isa-fdc.driveA=none0 -device floppy,drive=none1
190 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
191 -global isa-fdc.driveA=none0 -device floppy,drive=none1,unit=1
193 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
194 -global isa-fdc.driveB=none0 -device floppy,drive=none1
195 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
196 -global isa-fdc.driveB=none0 -device floppy,drive=none1,unit=0
197 check_floppy_qtree -drive if=none,file="$TEST_IMG" \
198 -global floppy.drive=none0 -device floppy,unit=0
200 # Conflicting
201 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
202 -global isa-fdc.driveA=none0 -device floppy,drive=none1,unit=0
203 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
204 -global isa-fdc.driveB=none0 -device floppy,drive=none1,unit=1
205 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
206 -global floppy.drive=none0 -device floppy,drive=none1,unit=0
208 echo
209 echo
210 echo === Attempt to use drive twice ===
212 # if=none
213 check_floppy_qtree -drive if=none -device floppy,drive=none0 -device floppy -device floppy,drive=none0
214 check_floppy_qtree -drive if=none -global floppy.drive=none0 -device floppy -device floppy
215 # if=floppy
216 check_floppy_qtree -fda "" -device floppy,drive=floppy0
217 check_floppy_qtree -fda "" -global floppy.drive=floppy0
218 # default if=floppy (not found, because it's created later)
219 check_floppy_qtree -device floppy,drive=floppy0
221 echo
222 echo
223 echo === Too many floppy drives ===
225 # Working
226 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" \
227 -drive if=none,file="$TEST_IMG.2" \
228 -drive if=none,file="$TEST_IMG.3" \
229 -global isa-fdc.driveB=none0 \
230 -device floppy,drive=none1
232 echo
233 echo
234 echo === Creating an empty drive with anonymous BB ===
236 check_floppy_qtree -device floppy
237 check_floppy_qtree -device floppy,drive-type=120
238 check_floppy_qtree -device floppy,drive-type=144
239 check_floppy_qtree -device floppy,drive-type=288
241 echo
242 echo
243 echo === Try passing different drive size with image ===
245 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,drive-type=120
246 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,drive-type=288
248 echo
249 echo
250 echo === Try passing different block sizes ===
252 # Explicitly setting the default is okay
253 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,logical_block_size=512
254 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,physical_block_size=512
256 # Changing it is not
257 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,logical_block_size=4096
258 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,physical_block_size=1024
260 echo
261 echo
262 echo === Writethrough caching ===
264 check_cache_mode -device floppy,drive=none0
265 check_cache_mode -device floppy,drive=none0,write-cache=on
266 check_cache_mode -device floppy,drive=none0,write-cache=off
268 # success, all done
269 echo "*** done"
270 rm -f $seq.full
271 status=0