Merge tag 'v9.0.0-rc3'
[qemu/ar7.git] / tests / qemu-iotests / tests / detect-zeroes-registered-buf
blob5eaf34e5a6b3e32ba19f493529b744fc1b945fc4
1 #!/usr/bin/env bash
2 # group: rw auto quick
4 # Check that detect-zeroes=unmap works on writes with registered I/O buffers.
5 # This is a regression test for
6 # https://gitlab.com/qemu-project/qemu/-/issues/1404 where I/O requests failed
7 # unexpectedly.
9 # Copyright Red Hat
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 # creator
26 owner=stefanha@redhat.com
28 seq=`basename $0`
29 echo "QA output created by $seq"
31 status=1 # failure is the default!
33 _cleanup()
35 _cleanup_test_img
37 trap "_cleanup; exit \$status" 0 1 2 3 15
39 IMGOPTSSYNTAX=true
41 # get standard environment, filters and checks
42 cd ..
43 . ./common.rc
44 . ./common.filter
46 _supported_fmt qcow2
47 _supported_proto generic
49 size=128M
50 _make_test_img $size
51 IMGSPEC="$TEST_IMG,discard=unmap,detect-zeroes=unmap"
53 echo
54 echo "== writing zero buffer to image =="
55 QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS_NO_FMT" $QEMU_IO -c "write -r -P 0 0 4k" --image-opts "$IMGSPEC" | _filter_qemu_io
57 # success, all done
58 echo "*** done"
59 rm -f $seq.full
60 status=0