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!
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.
73 (QEMU_OPTIONS
="" do_run_qemu
"$@" |
74 sed -ne '/^ dev: isa-fdc/,/^ dev:/{x;p}' ) 2>&1 |
75 _filter_win32 | _filter_qemu
80 echo "info block none0" |
81 QEMU_OPTIONS
="" do_run_qemu
-drive if=none
,file="$TEST_IMG" "$@" |
82 _filter_win32 | _filter_qemu |
grep "Cache mode"
90 TEST_IMG
="$TEST_IMG.2" _make_test_img
$size
91 TEST_IMG
="$TEST_IMG.3" _make_test_img
$size
93 # Default drive semantics:
95 # By default you get a single empty floppy drive. You can override it with
96 # -drive and using the same index, but if you use -drive to add a floppy to a
97 # different index, you get both of them. However, as soon as you use any
98 # '-device floppy', even to a different slot, the default drive is disabled.
108 echo === Using
-fda/-fdb options
===
110 check_floppy_qtree
-fda "$TEST_IMG"
111 check_floppy_qtree
-fdb "$TEST_IMG"
112 check_floppy_qtree
-fda "$TEST_IMG" -fdb "$TEST_IMG.2"
117 echo === Using
-drive options
===
119 check_floppy_qtree
-drive if=floppy
,file="$TEST_IMG"
120 check_floppy_qtree
-drive if=floppy
,file="$TEST_IMG",index
=1
121 check_floppy_qtree
-drive if=floppy
,file="$TEST_IMG" -drive if=floppy
,file="$TEST_IMG.2",index
=1
125 echo === Using
-drive if=none and
-global ===
127 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -global isa-fdc.driveA
=none0
128 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -global isa-fdc.driveB
=none0
129 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" \
130 -global isa-fdc.driveA
=none0
-global isa-fdc.driveB
=none1
134 echo === Using
-drive if=none and
-device ===
136 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -device floppy
,drive
=none0
137 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -device floppy
,drive
=none0
,unit
=1
138 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" \
139 -device floppy
,drive
=none0
-device floppy
,drive
=none1
,unit
=1
143 echo === Mixing
-fdX and
-global ===
146 check_floppy_qtree
-fda "$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -global isa-fdc.driveB
=none0
147 check_floppy_qtree
-fdb "$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -global isa-fdc.driveA
=none0
149 # Conflicting (-fdX wins)
150 check_floppy_qtree
-fda "$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -global isa-fdc.driveA
=none0
151 check_floppy_qtree
-fdb "$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -global isa-fdc.driveB
=none0
155 echo === Mixing
-fdX and
-device ===
158 check_floppy_qtree
-fda "$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -device floppy
,drive
=none0
159 check_floppy_qtree
-fda "$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -device floppy
,drive
=none0
,unit
=1
161 check_floppy_qtree
-fdb "$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -device floppy
,drive
=none0
162 check_floppy_qtree
-fdb "$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -device floppy
,drive
=none0
,unit
=0
165 check_floppy_qtree
-fda "$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -device floppy
,drive
=none0
,unit
=0
166 check_floppy_qtree
-fdb "$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -device floppy
,drive
=none0
,unit
=1
170 echo === Mixing
-drive and
-device ===
173 check_floppy_qtree
-drive if=floppy
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -device floppy
,drive
=none0
174 check_floppy_qtree
-drive if=floppy
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -device floppy
,drive
=none0
,unit
=1
177 check_floppy_qtree
-drive if=floppy
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" -device floppy
,drive
=none0
,unit
=0
181 echo === Mixing
-global and
-device ===
184 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" \
185 -global isa-fdc.driveA
=none0
-device floppy
,drive
=none1
186 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" \
187 -global isa-fdc.driveA
=none0
-device floppy
,drive
=none1
,unit
=1
189 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" \
190 -global isa-fdc.driveB
=none0
-device floppy
,drive
=none1
191 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" \
192 -global isa-fdc.driveB
=none0
-device floppy
,drive
=none1
,unit
=0
195 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" \
196 -global isa-fdc.driveA
=none0
-device floppy
,drive
=none1
,unit
=0
197 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG.2" \
198 -global isa-fdc.driveB
=none0
-device floppy
,drive
=none1
,unit
=1
202 echo === Too many floppy drives
===
205 check_floppy_qtree
-drive if=floppy
,file="$TEST_IMG" \
206 -drive if=none
,file="$TEST_IMG.2" \
207 -drive if=none
,file="$TEST_IMG.3" \
208 -global isa-fdc.driveB
=none0 \
209 -device floppy
,drive
=none1
213 echo === Creating an empty drive with anonymous BB
===
215 check_floppy_qtree
-device floppy
216 check_floppy_qtree
-device floppy
,drive-type
=120
217 check_floppy_qtree
-device floppy
,drive-type
=144
218 check_floppy_qtree
-device floppy
,drive-type
=288
222 echo === Try passing different drive size with image
===
224 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -device floppy
,drive
=none0
,drive-type
=120
225 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -device floppy
,drive
=none0
,drive-type
=288
229 echo === Try passing different block sizes
===
231 # Explicitly setting the default is okay
232 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -device floppy
,drive
=none0
,logical_block_size
=512
233 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -device floppy
,drive
=none0
,physical_block_size
=512
236 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -device floppy
,drive
=none0
,logical_block_size
=4096
237 check_floppy_qtree
-drive if=none
,file="$TEST_IMG" -device floppy
,drive
=none0
,physical_block_size
=1024
241 echo === Writethrough caching
===
243 check_cache_mode
-device floppy
,drive
=none0
244 check_cache_mode
-device floppy
,drive
=none0
,write-cache
=on
245 check_cache_mode
-device floppy
,drive
=none0
,write-cache
=off