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"
28 status
=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
44 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
45 _notrun
"Requires a PC machine"
48 function do_run_qemu
()
57 ) |
$QEMU -nographic -monitor stdio
-serial none
"$@"
61 function check_floppy_qtree
()
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.
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"
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.
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"
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
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
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
139 echo === Mixing
-fdX and
-global ===
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
151 echo === Mixing
-fdX and
-device ===
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
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
166 echo === Mixing
-drive and
-device ===
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
173 check_floppy_qtree
-drive if=floppy
,file="$TEST_IMG" -drive if=none
,file="$TEST_IMG" -device floppy
,drive
=none0
,unit
=0
177 echo === Mixing
-global and
-device ===
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
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
198 echo === Too many floppy drives
===
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
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
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
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
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
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