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