disas/ppc: Fix indefinite articles in comments
[qemu/ar7.git] / tests / qemu-iotests / 172
blob1b7d3a194d94108dc1ef91c23aa2e75c50e20c1d
1 #!/bin/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 here=`pwd`
28 status=1 # failure is the default!
30 _cleanup()
32 _cleanup_test_img
34 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
37 . ./common.rc
38 . ./common.filter
40 _supported_fmt qcow2
41 _supported_proto file
42 _supported_os Linux
44 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
45 _notrun "Requires a PC machine"
48 function do_run_qemu()
51 if ! test -t 0; then
52 while read cmd; do
53 echo $cmd
54 done
56 echo quit
57 ) | $QEMU -nographic -monitor stdio -serial none "$@"
58 echo
61 function check_floppy_qtree()
63 echo
64 echo Testing: "$@" | _filter_testdir
66 # QEMU_OPTIONS contains -nodefaults, we don't want that here because the
67 # defaults are part of what should be checked here.
69 # Apply the sed filter to stdout only, but keep the stderr output and
70 # filter the qemu program name in it.
71 echo "info qtree" |
72 (QEMU_OPTIONS="" do_run_qemu "$@" |
73 sed -ne '/^ dev: isa-fdc/,/^ dev:/{x;p}' ) 2>&1 |
74 _filter_win32 | _filter_qemu
77 function check_cache_mode()
79 echo "info block none0" |
80 QEMU_OPTIONS="" do_run_qemu -drive if=none,file="$TEST_IMG" "$@" |
81 _filter_win32 | _filter_qemu | grep "Cache mode"
85 size=720k
87 _make_test_img $size
89 # Default drive semantics:
91 # By default you get a single empty floppy drive. You can override it with
92 # -drive and using the same index, but if you use -drive to add a floppy to a
93 # different index, you get both of them. However, as soon as you use any
94 # '-device floppy', even to a different slot, the default drive is disabled.
96 echo
97 echo
98 echo === Default ===
100 check_floppy_qtree
102 echo
103 echo
104 echo === Using -fda/-fdb options ===
106 check_floppy_qtree -fda "$TEST_IMG"
107 check_floppy_qtree -fdb "$TEST_IMG"
108 check_floppy_qtree -fda "$TEST_IMG" -fdb "$TEST_IMG"
111 echo
112 echo
113 echo === Using -drive options ===
115 check_floppy_qtree -drive if=floppy,file="$TEST_IMG"
116 check_floppy_qtree -drive if=floppy,file="$TEST_IMG",index=1
117 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=floppy,file="$TEST_IMG",index=1
119 echo
120 echo
121 echo === Using -drive if=none and -global ===
123 check_floppy_qtree -drive if=none,file="$TEST_IMG" -global isa-fdc.driveA=none0
124 check_floppy_qtree -drive if=none,file="$TEST_IMG" -global isa-fdc.driveB=none0
125 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG" \
126 -global isa-fdc.driveA=none0 -global isa-fdc.driveB=none1
128 echo
129 echo
130 echo === Using -drive if=none and -device ===
132 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0
133 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,unit=1
134 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG" \
135 -device floppy,drive=none0 -device floppy,drive=none1,unit=1
137 echo
138 echo
139 echo === Mixing -fdX and -global ===
141 # Working
142 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG" -global isa-fdc.driveB=none0
143 check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG" -global isa-fdc.driveA=none0
145 # Conflicting (-fdX wins)
146 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG" -global isa-fdc.driveA=none0
147 check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG" -global isa-fdc.driveB=none0
149 echo
150 echo
151 echo === Mixing -fdX and -device ===
153 # Working
154 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG" -device floppy,drive=none0
155 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,unit=1
157 check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG" -device floppy,drive=none0
158 check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,unit=0
160 # Conflicting
161 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,unit=0
162 check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,unit=1
164 echo
165 echo
166 echo === Mixing -drive and -device ===
168 # Working
169 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=none,file="$TEST_IMG" -device floppy,drive=none0
170 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,unit=1
172 # Conflicting
173 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,unit=0
175 echo
176 echo
177 echo === Mixing -global and -device ===
179 # Working
180 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG" \
181 -global isa-fdc.driveA=none0 -device floppy,drive=none1
182 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG" \
183 -global isa-fdc.driveA=none0 -device floppy,drive=none1,unit=1
185 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG" \
186 -global isa-fdc.driveB=none0 -device floppy,drive=none1
187 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG" \
188 -global isa-fdc.driveB=none0 -device floppy,drive=none1,unit=0
190 # Conflicting
191 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG" \
192 -global isa-fdc.driveA=none0 -device floppy,drive=none1,unit=0
193 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG" \
194 -global isa-fdc.driveB=none0 -device floppy,drive=none1,unit=1
196 echo
197 echo
198 echo === Too many floppy drives ===
200 # Working
201 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" \
202 -drive if=none,file="$TEST_IMG" \
203 -drive if=none,file="$TEST_IMG" \
204 -global isa-fdc.driveB=none0 \
205 -device floppy,drive=none1
207 echo
208 echo
209 echo === Creating an empty drive with anonymous BB ===
211 check_floppy_qtree -device floppy
212 check_floppy_qtree -device floppy,drive-type=120
213 check_floppy_qtree -device floppy,drive-type=144
214 check_floppy_qtree -device floppy,drive-type=288
216 echo
217 echo
218 echo === Try passing different drive size with image ===
220 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,drive-type=120
221 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,drive-type=288
223 echo
224 echo
225 echo === Try passing different block sizes ===
227 # Explicitly setting the default is okay
228 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,logical_block_size=512
229 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,physical_block_size=512
231 # Changing it is not
232 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,logical_block_size=4096
233 check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,physical_block_size=1024
235 echo
236 echo
237 echo === Writethrough caching ===
239 check_cache_mode -device floppy,drive=none0
240 check_cache_mode -device floppy,drive=none0,write-cache=on
241 check_cache_mode -device floppy,drive=none0,write-cache=off
243 # success, all done
244 echo "*** done"
245 rm -f $seq.full
246 status=0