[PATCH 2/3] ext4: 032: fail nicely if the test partition is not big enough for the test

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxxxx>
---
 tests/ext4/032 | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/ext4/032 b/tests/ext4/032
index 8534ddd6..7d8c6da7 100755
--- a/tests/ext4/032
+++ b/tests/ext4/032
@@ -35,12 +35,21 @@ ext4_online_resize()
 	local original_size=$1
 	local final_size=$2
 	local check_if_supported=${3:-0}
+	local avail=`df -P $SCRATCH_DIR | awk 'END {print $4}'`
+	local requested=$(($final_size * $BLK_SIZ))
+
+	if [ $avail -lt $requested ]; then
+		echo "+++ not enough space on $SCRATCH_DIR: " \
+		     "requested $requested only $avail left" | \
+			tee -a $seqres.full
+		_notrun "incomplete test due to storage space constraint"
+	fi
 
 	## Start with a clean image file.
 	echo "" > ${IMG_FILE}
 	echo "+++ truncate image file to $final_size" | \
 		tee -a $seqres.full
-	$XFS_IO_PROG -f -c "truncate $(($final_size * $BLK_SIZ))" ${IMG_FILE}
+	$XFS_IO_PROG -f -c "truncate $requested" ${IMG_FILE}
 	LOOP_DEVICE=`_create_loop_device $IMG_FILE`
 
 	echo "+++ create fs on image file $original_size" | \
-- 
2.18.1




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux