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/>.
22 owner
=kwolf@redhat.com
25 echo "QA output created by $seq"
27 status
=1 # failure is the default!
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
45 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
46 _notrun
"Requires a PC machine"
58 ) |
$QEMU -accel qtest
-nographic -monitor stdio
-serial none
"$@"
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
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"
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.
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 ""
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
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
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
145 echo === Mixing
-fdX and
-global ===
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
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
159 echo === Mixing
-fdX and
-device ===
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
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
174 echo === Mixing
-drive and
-device ===
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
181 check_floppy_qtree
-drive if=floppy
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -device floppy
,drive
=none0
,unit
=0
185 echo === Mixing
-global and
-device ===
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
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
210 echo === Attempt to use drive twice
===
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
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
223 echo === Too many floppy drives
===
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
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
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
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
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
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