fixed dmapi mount filter to work on irix
[xfstests-dev.git] / common.rc
index d3c2a0c08c57647f1459e70f79ae7959ca3fe13e..7f13c27ca36fccf8049fe15361f7dcfa051a8674 100644 (file)
--- a/common.rc
+++ b/common.rc
@@ -93,7 +93,7 @@ umask 022
 
 _mount()
 {
-    $MOUNT_PROG $*
+    $MOUNT_PROG `_mount_ops_filter $*`
 }
 
 _scratch_options()
@@ -147,9 +147,30 @@ _test_options()
        TEST_OPTIONS="$TEST_OPTIONS ${log_opt}logdev=$TEST_LOGDEV"
 }
 
+_mount_ops_filter()
+{
+    params="$*"
+    
+    #get mount point to handle dmapi mtpt option correctly
+    last_index=`expr $# - 1`
+    [ $last_index -gt 0 ] && shift $last_index
+    FS_ESCAPED=$1
+    
+    # irix is fussy about how it is fed its mount options
+    # - multiple -o's are not allowed
+    # - no spaces between comma delimitered options
+    # the sed script replaces all -o's (except the first) with a comma
+    # not required for linux, but won't hurt
+    
+    echo $params | sed -e 's/[[:space:]]*-o[[:space:]]*/UnIqUe/1; s/[[:space:]]*-o[[:space:]]*/,/g; s/UnIqUe/ -o /1' \
+        | $PERL_PROG -ne "s#mtpt=[^,|^\n|^\s]*#mtpt=$FS_ESCAPED\1\2#; print;"
+
+}
+
 _scratch_mount_options()
 {
     _scratch_options mount
+
     echo $SCRATCH_OPTIONS $MOUNT_OPTIONS $* $SCRATCH_DEV $SCRATCH_MNT
 }
 
@@ -161,7 +182,7 @@ _scratch_mount()
 _test_mount()
 {
     _test_options mount
-    _mount -t $FSTYP $TEST_OPTIONS $MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
+    _mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $* $TEST_DEV $TEST_DIR
 }
 
 _scratch_mkfs_options()
@@ -623,6 +644,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()
@@ -681,6 +711,7 @@ _check_xfs_filesystem()
        exit 1
     fi
 
+    extra_mount_options=""
     device=$1
     if [ "$2" != "none" ]; then
                extra_log_options="-l$2"