initialize extra_mount_options as blank string in _check_xfs_filesystem to prevent...
[xfstests-dev.git] / common.rc
index 83e1e17feaacecb2d7ee0831e9cb05a9181406ae..6be40f6d547f35405ad08fcf2a602a919c86aa95 100644 (file)
--- a/common.rc
+++ b/common.rc
@@ -1,6 +1,6 @@
 ##/bin/sh
 #-----------------------------------------------------------------------
-#  Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
+#  Copyright (c) 2000-2006 Silicon Graphics, Inc.  All Rights Reserved.
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
 #  the Free Software Foundation; either version 2 of the License, or
@@ -79,10 +79,13 @@ _mkfs_opts()
 
 
 # we need common.config
-if ! . ./common.config
+if [ "$iam" != "check" ]
 then
-    echo "$iam: failed to source common.config"
-    exit 1
+    if ! . ./common.config
+        then
+        echo "$iam: failed to source common.config"
+        exit 1
+    fi
 fi
 
 # make sure we have a standard umask
@@ -98,7 +101,7 @@ _scratch_options()
     type=$1
     SCRATCH_OPTIONS=""
 
-    if [ $FSTYP != "xfs" ]; then
+    if [ "$FSTYP" != "xfs" ]; then
         return
     fi
 
@@ -124,7 +127,7 @@ _test_options()
     type=$1
     TEST_OPTIONS=""
 
-    if [ $FSTYP != "xfs" ]; then
+    if [ "$FSTYP" != "xfs" ]; then
         return
     fi
 
@@ -620,6 +623,15 @@ _require_nonexternal()
        _notrun "External device testing in progress, skipped this test"
 }
 
+# check for the fsgqa user on the machine
+#
+_require_user()
+{
+    qa_user=fsgqa
+    cat /etc/passwd | grep -q $qa_user
+    [ "$?" == "0" ] || _notrun "$qa_user user not defined."
+}
+
 # check that a FS is mounted as XFS. if so, return mount point
 #
 _xfs_mounted()
@@ -632,7 +644,7 @@ _xfs_mounted()
 
     device=$1
 
-    if _mount | grep $device | $AWK_PROG '
+    if _mount | grep "$device " | $AWK_PROG '
         /type xfs/  { print $3 ; exit 0 }
         END         { exit 1 }
     '
@@ -678,6 +690,7 @@ _check_xfs_filesystem()
        exit 1
     fi
 
+    extra_mount_options=""
     device=$1
     if [ "$2" != "none" ]; then
                extra_log_options="-l$2"
@@ -822,6 +835,10 @@ _check_udf_filesystem()
 
 _check_test_fs()
 {
+    if [ "$FSTYP" != "xfs" ]; then
+        return
+    fi
+
     TEST_LOG="none"
     TEST_RT="none"
     [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_LOGDEV" ] && \
@@ -1172,9 +1189,9 @@ then
         fi
     fi
 
-    if [ "`_fs_type $TEST_DEV`" != "xfs" ]
+    if [ "`_fs_type $TEST_DEV`" != "$FSTYP" ]
     then
-        echo "common.rc: Error: \$TEST_DEV ($TEST_DEV) is not a MOUNTED XFS filesystem"
+        echo "common.rc: Error: \$TEST_DEV ($TEST_DEV) is not a MOUNTED $FSTYP filesystem"
         $DF_PROG $TEST_DEV
         exit 1
     fi