btrfs/012: check free size of scratch device before copying files
authorSidong Yang <realwakka@gmail.com>
Sun, 23 May 2021 05:08:59 +0000 (05:08 +0000)
committerEryu Guan <guaneryu@gmail.com>
Sun, 23 May 2021 08:30:48 +0000 (16:30 +0800)
This test failed when scratch device don't have enough space for
copying files. This patch gets size of files by du command and
checks if there is enough space in the device.

Signed-off-by: Sidong Yang <realwakka@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/btrfs/012

index fd43da5..2d4cece 100755 (executable)
@@ -42,6 +42,8 @@ _require_command "$BTRFS_CONVERT_PROG" btrfs-convert
 _require_command "$MKFS_EXT4_PROG" mkfs.ext4
 _require_command "$E2FSCK_PROG" e2fsck
 
+_require_fs_space $SCRATCH_MNT $(du -s /lib/modules/`uname -r` | ${AWK_PROG} '{print $1}')
+
 rm -f $seqres.full
 
 BLOCK_SIZE=`_get_block_size $TEST_DIR`