]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
tests: fix resize test tmpfs max-file-size checking
authorAndreas Dilger <andreas.dilger@intel.com>
Mon, 14 Apr 2014 16:48:16 +0000 (12:48 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 14 Apr 2014 17:51:24 +0000 (13:51 -0400)
Old distros may not have the "truncate" tool, so use "dd" instead.

If tmpfs cannot handle a 2GB temp file (e.g. old RHEL5 and SLES 11
kernels) then skip the test instead of failing it.  If this fails,
try to report better error messages instead of failing silently.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
tests/r_1024_small_bg/script
tests/r_64bit_big_expand/script
tests/r_bigalloc_big_expand/script
tests/r_ext4_big_expand/script
tests/r_ext4_small_bg/script
tests/scripts/resize_test

index fafcf914cc8a7f17d53726dc610a467994b3a16e..2038cb96d88c27b7222864b46e84552b040cd163 100644 (file)
@@ -10,13 +10,17 @@ 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
+       ln $LOG $test_name.failed
 fi
 
 unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK
index 51f36e987204947feccb5684e18ba9680264025a..6716f3c65d48f0c5a731eda24bd8fa032cee64fe 100644 (file)
@@ -20,7 +20,7 @@ elif [ $RC -eq 111 ]; then
        touch $test_name.ok
 else
        echo "$test_name: $test_description: failed"
-       touch $test_name.failed
+       ln $LOG $test_name.failed
 fi
 
 unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK
index 56c8c15d1d9157c176b8ed6489c16689e3ccf66f..511733b6ab9516cff8f82baa6a2a8c69318294de 100644 (file)
@@ -20,7 +20,7 @@ elif [ $RC -eq 111 ]; then
        touch $test_name.ok
 else
        echo "$test_name: $test_description: failed"
-       touch $test_name.failed
+       ln $LOG $test_name.failed
 fi
 
 unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK
index a4f8fe63424fadb06444cdeae8b85154c9cb3e2d..b4a6f6e32164b8d8f60d05818b607e0703808cbd 100644 (file)
@@ -20,7 +20,7 @@ elif [ $RC -eq 111 ]; then
        touch $test_name.ok
 else
        echo "$test_name: $test_description: failed"
-       touch $test_name.failed
+       ln $LOG $test_name.failed
 fi
 
 unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK
index 553cbd8a883fd785ce6194d22943ee1cdb3a5ea0..cdc6e4a3e8a7058cd3b31bd959c5748460cb0b26 100644 (file)
@@ -10,13 +10,17 @@ 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
+       ln $LOG $test_name.failed
 fi
 
 unset FEATURES SIZE_1 SIZE_2 LOG E2FSCK
index 6a8b0e9707dd3d556616479c8e84426340ac5d4e..b09731c19acc63f0f45f7ee73f4c7c388255737b 100755 (executable)
@@ -1,25 +1,36 @@
 #!/bin/sh
 
+# old distros are missing "truncate", emulate it with "dd"
+truncate()
+{
+       [ "$1" = "-s" ] && size=$2 && shift 2
+
+       dd if=/dev/zero of=$1 bs=1 count=0 seek=$size >> $LOG 2>&1
+}
+
 resize_test () {
 
+echo $test_description starting > $LOG
 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
+       echo "using $TMPFILE" >> $LOG
 else
        rm $TMPFILE
        export TMPFILE=$(TMPDIR=. mktemp -t $test_name.XXXXXX.tmp)
        touch $TMPFILE
-       if ! truncate -s $SIZE_2 $TMPFILE 2> /dev/null; then
+       echo "using $TMPFILE" >> $LOG
+       if ! truncate -s $SIZE_2 $TMPFILE >> $LOG 2>&1; then
                rm $TMPFILE
                return 111
        fi
 fi
+> $TMPFILE
 
-echo $MKE2FS $FEATURES -qF $TMPFILE $SIZE_1 > $LOG
+echo $MKE2FS $FEATURES -qF $TMPFILE $SIZE_1 >> $LOG
 $MKE2FS $FEATURES -qF $TMPFILE $SIZE_1 >> $LOG
 
 OUT_TMP=$(mktemp -t csum-tmp.XXXXXX)