]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfstests: Allow to recheck options in common/rc
authorLukas Czerner <lczerner@redhat.com>
Thu, 11 Jul 2013 10:37:59 +0000 (10:37 +0000)
committerRich Johnston <rjohnston@sgi.com>
Fri, 16 Aug 2013 14:27:25 +0000 (09:27 -0500)
Move configuration checks into separate function to allow us to recheck
the options without the need to reinclude the whole source file which is
ugly. We still run the check on include.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
common/rc

index a761833caacaac84c5a03e75d65442ceda19499b..ae80b127e8355feb82f3fdab2604d7d577fcc235 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2139,46 +2139,48 @@ run_check()
        "$@" >> $seqres.full 2>&1 || _fail "failed: '$@'"
 }
 
-################################################################################
-
-if [ "$iam" != new ]
-then
-    # make some further configuration checks here
-
-    if [ "$TEST_DEV" = ""  ]
-    then
-        echo "common/rc: Error: \$TEST_DEV is not set"
-        exit 1
-    fi
-
-    # if $TEST_DEV is not mounted, mount it now as XFS
-    if [ -z "`_fs_type $TEST_DEV`" ]
-    then
-        # $TEST_DEV is not mounted
-        if ! _test_mount
-        then
-            echo "common/rc: retrying test device mount with external set"
-            [ "$USE_EXTERNAL" != "yes" ] && export USE_EXTERNAL=yes
-            if ! _test_mount
-            then
-                echo "common/rc: could not mount $TEST_DEV on $TEST_DIR"
-                exit 1
-            fi
-        fi
-    fi
+init_rc()
+{
+       if [ "$iam" == new ]
+       then
+               return
+       fi
+       # make some further configuration checks here
+       if [ "$TEST_DEV" = ""  ]
+       then
+               echo "common/rc: Error: \$TEST_DEV is not set"
+               exit 1
+       fi
 
-    if [ "`_fs_type $TEST_DEV`" != "$FSTYP" ]
-    then
-        echo "common/rc: Error: \$TEST_DEV ($TEST_DEV) is not a MOUNTED $FSTYP filesystem"
-        $DF_PROG $TEST_DEV
-        exit 1
-    fi
+       # if $TEST_DEV is not mounted, mount it now as XFS
+       if [ -z "`_fs_type $TEST_DEV`" ]
+       then
+               # $TEST_DEV is not mounted
+               if ! _test_mount
+               then
+                       echo "common/rc: retrying test device mount with external set"
+                       [ "$USE_EXTERNAL" != "yes" ] && export USE_EXTERNAL=yes
+                       if ! _test_mount
+                       then
+                               echo "common/rc: could not mount $TEST_DEV on $TEST_DIR"
+                               exit 1
+                       fi
+               fi
+       fi
 
-    # Figure out if we need to add -F ("foreign", deprecated) option to xfs_io
-    xfs_io -c stat $TEST_DIR 2>&1 | grep -q "is not on an XFS filesystem" && \
+       if [ "`_fs_type $TEST_DEV`" != "$FSTYP" ]
+       then
+               echo "common/rc: Error: \$TEST_DEV ($TEST_DEV) is not a MOUNTED $FSTYP filesystem"
+               $DF_PROG $TEST_DEV
+               exit 1
+       fi
+       # Figure out if we need to add -F ("foreign", deprecated) option to xfs_io
+       xfs_io -c stat $TEST_DIR 2>&1 | grep -q "is not on an XFS filesystem" && \
        export XFS_IO_PROG="$XFS_IO_PROG -F"
+}
 
-fi
+init_rc
 
+################################################################################
 # make sure this script returns success
 /bin/true