1*11a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 26f993f3fSNir Soffer# 36f993f3fSNir Soffer# Test creating raw image preallocation mode 46f993f3fSNir Soffer# 56f993f3fSNir Soffer# Copyright (C) 2017 Nir Soffer <nirsof@gmail.com> 66f993f3fSNir Soffer# 76f993f3fSNir Soffer# This program is free software; you can redistribute it and/or modify 86f993f3fSNir Soffer# it under the terms of the GNU General Public License as published by 96f993f3fSNir Soffer# the Free Software Foundation; either version 2 of the License, or 106f993f3fSNir Soffer# (at your option) any later version. 116f993f3fSNir Soffer# 126f993f3fSNir Soffer# This program is distributed in the hope that it will be useful, 136f993f3fSNir Soffer# but WITHOUT ANY WARRANTY; without even the implied warranty of 146f993f3fSNir Soffer# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 156f993f3fSNir Soffer# GNU General Public License for more details. 166f993f3fSNir Soffer# 176f993f3fSNir Soffer# You should have received a copy of the GNU General Public License 186f993f3fSNir Soffer# along with this program. If not, see <http://www.gnu.org/licenses/>. 196f993f3fSNir Soffer# 206f993f3fSNir Soffer 216f993f3fSNir Soffer# creator 226f993f3fSNir Sofferowner=nirsof@gmail.com 236f993f3fSNir Soffer 246f993f3fSNir Sofferseq=`basename $0` 256f993f3fSNir Sofferecho "QA output created by $seq" 266f993f3fSNir Soffer 276f993f3fSNir Sofferstatus=1 # failure is the default! 286f993f3fSNir Soffer 296f993f3fSNir Soffer_cleanup() 306f993f3fSNir Soffer{ 316f993f3fSNir Soffer _cleanup_test_img 326f993f3fSNir Soffer} 336f993f3fSNir Soffertrap "_cleanup; exit \$status" 0 1 2 3 15 346f993f3fSNir Soffer 356f993f3fSNir Soffer# get standard environment, filters and checks 366f993f3fSNir Soffer. ./common.rc 376f993f3fSNir Soffer. ./common.filter 386f993f3fSNir Soffer 396f993f3fSNir Soffer_supported_fmt raw 406f993f3fSNir Soffer_supported_proto file 416f993f3fSNir Soffer_supported_os Linux 426f993f3fSNir Soffer 436f993f3fSNir Soffersize=1m 446f993f3fSNir Soffer 456f993f3fSNir Sofferecho 466f993f3fSNir Sofferecho "== creating image with default preallocation ==" 476f993f3fSNir Soffer_make_test_img $size | _filter_imgfmt 486f993f3fSNir Sofferstat -c "size=%s, blocks=%b" $TEST_IMG 496f993f3fSNir Soffer 506f993f3fSNir Sofferfor mode in off full falloc; do 516f993f3fSNir Soffer echo 526f993f3fSNir Soffer echo "== creating image with preallocation $mode ==" 536f993f3fSNir Soffer IMGOPTS=preallocation=$mode _make_test_img $size | _filter_imgfmt 546f993f3fSNir Soffer stat -c "size=%s, blocks=%b" $TEST_IMG 556f993f3fSNir Sofferdone 566f993f3fSNir Soffer 576f993f3fSNir Soffer# success, all done 586f993f3fSNir Sofferecho "*** done" 596f993f3fSNir Sofferrm -f $seq.full 606f993f3fSNir Sofferstatus=0 61