]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
tests: check backing filesystem can handle large file
authorAndreas Dilger <adilger@dilger.ca>
Tue, 3 Dec 2013 05:11:55 +0000 (00:11 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 3 Dec 2013 05:11:55 +0000 (00:11 -0500)
The new resize tests create 2TB test files, but tmpfs in kernels
before 3.1 have a max file size of 256GB.  Ext3 may also have
a size limit for smaller blocksize filesystems.

Fix the resize_test script to verify that $TMPFILE can be resized
to the final test size, and if that fails try creating the file on
the local filesystem instead of in $TMPDIR.  If that cannot hold
the large filesystem, skip the test.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Tested-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
tests/r_64bit_big_expand/script
tests/r_bigalloc_big_expand/script
tests/r_ext4_big_expand/script
tests/scripts/resize_test

index 3b34a62b0c60583e16ce83c6eff01d54a8adec31..51f36e987204947feccb5684e18ba9680264025a 100644 (file)
@@ -10,10 +10,14 @@ E2FSCK=../e2fsck/e2fsck
 
 . $cmd_dir/scripts/resize_test
 
-if resize_test
-then
+resize_test
+RC=$?
+if [ $RC -eq 0 ]; then
        echo "$test_name: $test_description: ok"
        touch $test_name.ok
+elif [ $RC -eq 111 ]; then
+       echo "$test_name: $test_description: skipped"
+       touch $test_name.ok
 else
        echo "$test_name: $test_description: failed"
        touch $test_name.failed
index 2b9cc633f405be80c85759223174fb43b155628e..56c8c15d1d9157c176b8ed6489c16689e3ccf66f 100644 (file)
@@ -10,10 +10,14 @@ RESIZE2FS_OPTS=-f
 
 . $cmd_dir/scripts/resize_test
 
-if resize_test
-then
+resize_test
+RC=$?
+if [ $RC -eq 0 ]; then
        echo "$test_name: $test_description: ok"
        touch $test_name.ok
+elif [ $RC -eq 111 ]; then
+       echo "$test_name: $test_description: skipped"
+       touch $test_name.ok
 else
        echo "$test_name: $test_description: failed"
        touch $test_name.failed
index fb31d7a8f3ba5031d7d01880eca70d850ad3b61c..a4f8fe63424fadb06444cdeae8b85154c9cb3e2d 100644 (file)
@@ -10,10 +10,14 @@ E2FSCK=../e2fsck/e2fsck
 
 . $cmd_dir/scripts/resize_test
 
-if resize_test
-then
+resize_test
+RC=$?
+if [ $RC -eq 0 ]; then
        echo "$test_name: $test_description: ok"
        touch $test_name.ok
+elif [ $RC -eq 111 ]; then
+       echo "$test_name: $test_description: skipped"
+       touch $test_name.ok
 else
        echo "$test_name: $test_description: failed"
        touch $test_name.failed
index 964150ed1ff05c76c80063b6235eacf9747177da..30532a517e2c7d1957bae81464ca162e0b0522a7 100755 (executable)
@@ -4,6 +4,21 @@ resize_test () {
 
 rm -f $TMPFILE
 touch $TMPFILE
+
+# Verify that the $TMP filesystem handles $SIZE_2 sparse files.
+# If that fails, try the local filesystem instead.
+if truncate -s $SIZE_2 $TMPFILE 2> /dev/null; then
+        > $TMPFILE
+else
+       rm $TMPFILE
+       export TMPFILE=$(TMPDIR=. mktemp -t $test_name.XXXXXX.tmp)
+       touch $TMPFILE
+       if ! truncate -s $SIZE_2 $TMPFILE 2> /dev/null; then
+               rm $TMPFILE
+               return 111
+       fi
+fi
+
 echo $MKE2FS $FEATURES -qF $TMPFILE $SIZE_1 > $LOG
 $MKE2FS $FEATURES -qF $TMPFILE $SIZE_1 >> $LOG