]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: always create sparse image files
authorRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 15 Dec 2015 16:46:58 +0000 (17:46 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 5 Jan 2016 11:21:56 +0000 (12:21 +0100)
This saves about 400M disk I/O and space.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests/functions.sh

index f6c4d33ee8ceae7ee7d03e72f978000d73c16a25..c7e0ded6156cde1eccce7b2c25dbdb2e6f82f11e 100644 (file)
@@ -464,7 +464,8 @@ function ts_image_init {
        local mib=${1:-"5"}     # size in MiBs
        local img=${2:-"$TS_OUTDIR/${TS_TESTNAME}.img"}
 
-       dd if=/dev/zero of="$img" bs=1M count=$mib &> /dev/null
+       rm -f $img
+       truncate -s "${mib}M" "$img"
        echo "$img"
        return 0
 }