xfstests: use value of FSTYP if defined externally
authorDavid Sterba <dsterba@suse.cz>
Fri, 24 Jan 2014 01:05:01 +0000 (12:05 +1100)
committerDave Chinner <david@fromorbit.com>
Fri, 24 Jan 2014 01:05:01 +0000 (12:05 +1100)
The initial value of FSTYP is unconditionally set to 'xfs' and the
filesystem type is taken from the TEST_DEV. This could lead to confusion
if the device hasn't been formatted yet, eg. an empty image in VM, or
a different test setup took place before.

Now one can specify the desired FSTYP in advance and be safe. If unset,
the fallback to TEST_DEV type continues to work.

Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
README
check

diff --git a/README b/README
index a49ca7c3ff157dd982af74cc3848ddabca01a569..295d67f56246b9823376ea3bff61de7d7c318156 100644 (file)
--- a/README
+++ b/README
@@ -65,6 +65,9 @@ Preparing system for tests (IRIX and Linux):
                environment variable set to "yes" will enable their use.
              - setenv DIFF_LENGTH "number of diff lines to print from a failed test",
                by default 10, set to 0 to print the full diff
                environment variable set to "yes" will enable their use.
              - setenv DIFF_LENGTH "number of diff lines to print from a failed test",
                by default 10, set to 0 to print the full diff
+             - setenv FSTYP "the filesystem you want to test", the filesystem
+               type is devised from the TEST_DEV device, but you may want to
+               override it; if unset, the default is 'xfs'
         - or add a case to the switch in common/config assigning
           these variables based on the hostname of your test
           machine
         - or add a case to the switch in common/config assigning
           these variables based on the hostname of your test
           machine
diff --git a/check b/check
index e8d39438a33d06366c19dfab8af96162efea6fa8..268417c258eca9f1ce15dc8f11f70bf4eef21dde 100755 (executable)
--- a/check
+++ b/check
@@ -33,7 +33,6 @@ showme=false
 have_test_arg=false
 randomize=false
 here=`pwd`
 have_test_arg=false
 randomize=false
 here=`pwd`
-FSTYP=xfs
 xfile=""
 
 # start the initialisation work now
 xfile=""
 
 # start the initialisation work now
@@ -57,10 +56,12 @@ then
     exit 1
 fi
 
     exit 1
 fi
 
-# Autodetect fs type based on what's on $TEST_DEV
-if [ "$HOSTOS" == "Linux" ]; then
+# Autodetect fs type based on what's on $TEST_DEV unless it's been set
+# externally
+if [ -z "$FSTYP" -a "$HOSTOS" == "Linux" ]; then
     FSTYP=`blkid -c /dev/null -s TYPE -o value $TEST_DEV`
 fi
     FSTYP=`blkid -c /dev/null -s TYPE -o value $TEST_DEV`
 fi
+FSTYP=${FSTYP:=xfs}
 export FSTYP
 
 SUPPORTED_TESTS="[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]"
 export FSTYP
 
 SUPPORTED_TESTS="[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]"