xref: /openbmc/qemu/tests/qemu-iotests/268 (revision f2208fdc5ba2f4d0cbc023e2530b5e3e110d71c2)
1*f2208fdcSAlberto Garcia#!/usr/bin/env bash
2*f2208fdcSAlberto Garcia#
3*f2208fdcSAlberto Garcia# Test write request with required alignment larger than the cluster size
4*f2208fdcSAlberto Garcia#
5*f2208fdcSAlberto Garcia# Copyright (C) 2019 Igalia, S.L.
6*f2208fdcSAlberto Garcia# Author: Alberto Garcia <berto@igalia.com>
7*f2208fdcSAlberto Garcia#
8*f2208fdcSAlberto Garcia# This program is free software; you can redistribute it and/or modify
9*f2208fdcSAlberto Garcia# it under the terms of the GNU General Public License as published by
10*f2208fdcSAlberto Garcia# the Free Software Foundation; either version 2 of the License, or
11*f2208fdcSAlberto Garcia# (at your option) any later version.
12*f2208fdcSAlberto Garcia#
13*f2208fdcSAlberto Garcia# This program is distributed in the hope that it will be useful,
14*f2208fdcSAlberto Garcia# but WITHOUT ANY WARRANTY; without even the implied warranty of
15*f2208fdcSAlberto Garcia# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*f2208fdcSAlberto Garcia# GNU General Public License for more details.
17*f2208fdcSAlberto Garcia#
18*f2208fdcSAlberto Garcia# You should have received a copy of the GNU General Public License
19*f2208fdcSAlberto Garcia# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20*f2208fdcSAlberto Garcia#
21*f2208fdcSAlberto Garcia
22*f2208fdcSAlberto Garcia# creator
23*f2208fdcSAlberto Garciaowner=berto@igalia.com
24*f2208fdcSAlberto Garcia
25*f2208fdcSAlberto Garciaseq=`basename $0`
26*f2208fdcSAlberto Garciaecho "QA output created by $seq"
27*f2208fdcSAlberto Garcia
28*f2208fdcSAlberto Garciastatus=1	# failure is the default!
29*f2208fdcSAlberto Garcia
30*f2208fdcSAlberto Garcia_cleanup()
31*f2208fdcSAlberto Garcia{
32*f2208fdcSAlberto Garcia    _cleanup_test_img
33*f2208fdcSAlberto Garcia}
34*f2208fdcSAlberto Garciatrap "_cleanup; exit \$status" 0 1 2 3 15
35*f2208fdcSAlberto Garcia
36*f2208fdcSAlberto Garcia# get standard environment, filters and checks
37*f2208fdcSAlberto Garcia. ./common.rc
38*f2208fdcSAlberto Garcia. ./common.filter
39*f2208fdcSAlberto Garcia
40*f2208fdcSAlberto Garcia_supported_fmt qcow2
41*f2208fdcSAlberto Garcia_supported_proto file
42*f2208fdcSAlberto Garcia
43*f2208fdcSAlberto Garciaecho
44*f2208fdcSAlberto Garciaecho "== Required alignment larger than cluster size =="
45*f2208fdcSAlberto Garcia
46*f2208fdcSAlberto GarciaCLUSTER_SIZE=2k _make_test_img 1M
47*f2208fdcSAlberto Garcia# Since commit c8bb23cbdb writing to an unallocated cluster fills the
48*f2208fdcSAlberto Garcia# empty COW areas with bdrv_write_zeroes(flags=BDRV_REQ_NO_FALLBACK)
49*f2208fdcSAlberto Garcia$QEMU_IO -c "open -o driver=$IMGFMT,file.align=4k blkdebug::$TEST_IMG" \
50*f2208fdcSAlberto Garcia         -c "write 0 512" | _filter_qemu_io
51*f2208fdcSAlberto Garcia
52*f2208fdcSAlberto Garcia# success, all done
53*f2208fdcSAlberto Garciaecho "*** done"
54*f2208fdcSAlberto Garciarm -f $seq.full
55*f2208fdcSAlberto Garciastatus=0
56