xref: /openbmc/qemu/tests/qemu-iotests/175 (revision 6f993f3fca4763a6b494ff587d4400b6e8a5ef31)
1*6f993f3fSNir Soffer#!/bin/bash
2*6f993f3fSNir Soffer#
3*6f993f3fSNir Soffer# Test creating raw image preallocation mode
4*6f993f3fSNir Soffer#
5*6f993f3fSNir Soffer# Copyright (C) 2017 Nir Soffer <nirsof@gmail.com>
6*6f993f3fSNir Soffer#
7*6f993f3fSNir Soffer# This program is free software; you can redistribute it and/or modify
8*6f993f3fSNir Soffer# it under the terms of the GNU General Public License as published by
9*6f993f3fSNir Soffer# the Free Software Foundation; either version 2 of the License, or
10*6f993f3fSNir Soffer# (at your option) any later version.
11*6f993f3fSNir Soffer#
12*6f993f3fSNir Soffer# This program is distributed in the hope that it will be useful,
13*6f993f3fSNir Soffer# but WITHOUT ANY WARRANTY; without even the implied warranty of
14*6f993f3fSNir Soffer# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*6f993f3fSNir Soffer# GNU General Public License for more details.
16*6f993f3fSNir Soffer#
17*6f993f3fSNir Soffer# You should have received a copy of the GNU General Public License
18*6f993f3fSNir Soffer# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19*6f993f3fSNir Soffer#
20*6f993f3fSNir Soffer
21*6f993f3fSNir Soffer# creator
22*6f993f3fSNir Sofferowner=nirsof@gmail.com
23*6f993f3fSNir Soffer
24*6f993f3fSNir Sofferseq=`basename $0`
25*6f993f3fSNir Sofferecho "QA output created by $seq"
26*6f993f3fSNir Soffer
27*6f993f3fSNir Sofferhere=`pwd`
28*6f993f3fSNir Sofferstatus=1	# failure is the default!
29*6f993f3fSNir Soffer
30*6f993f3fSNir Soffer_cleanup()
31*6f993f3fSNir Soffer{
32*6f993f3fSNir Soffer	_cleanup_test_img
33*6f993f3fSNir Soffer}
34*6f993f3fSNir Soffertrap "_cleanup; exit \$status" 0 1 2 3 15
35*6f993f3fSNir Soffer
36*6f993f3fSNir Soffer# get standard environment, filters and checks
37*6f993f3fSNir Soffer. ./common.rc
38*6f993f3fSNir Soffer. ./common.filter
39*6f993f3fSNir Soffer
40*6f993f3fSNir Soffer_supported_fmt raw
41*6f993f3fSNir Soffer_supported_proto file
42*6f993f3fSNir Soffer_supported_os Linux
43*6f993f3fSNir Soffer
44*6f993f3fSNir Soffersize=1m
45*6f993f3fSNir Soffer
46*6f993f3fSNir Sofferecho
47*6f993f3fSNir Sofferecho "== creating image with default preallocation =="
48*6f993f3fSNir Soffer_make_test_img $size | _filter_imgfmt
49*6f993f3fSNir Sofferstat -c "size=%s, blocks=%b" $TEST_IMG
50*6f993f3fSNir Soffer
51*6f993f3fSNir Sofferfor mode in off full falloc; do
52*6f993f3fSNir Soffer    echo
53*6f993f3fSNir Soffer    echo "== creating image with preallocation $mode =="
54*6f993f3fSNir Soffer    IMGOPTS=preallocation=$mode _make_test_img $size | _filter_imgfmt
55*6f993f3fSNir Soffer    stat -c "size=%s, blocks=%b" $TEST_IMG
56*6f993f3fSNir Sofferdone
57*6f993f3fSNir Soffer
58*6f993f3fSNir Soffer# success, all done
59*6f993f3fSNir Sofferecho "*** done"
60*6f993f3fSNir Sofferrm -f $seq.full
61*6f993f3fSNir Sofferstatus=0
62