QA updates - make builds on older versions of headers work, reenable rt on bruce.
[xfstests-dev.git] / common.rc
index 1c875945e8ded80547295b18d4cebc86954714eb..d6682d2648627b6e0ae67fc65207d541986e0f7f 100644 (file)
--- a/common.rc
+++ b/common.rc
@@ -1,6 +1,6 @@
 ##/bin/sh
 #-----------------------------------------------------------------------
-#  Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+#  Copyright (c) 2000-2005 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
 #  Mountain View, CA 94043, USA, or: http://www.sgi.com
 #-----------------------------------------------------------------------
 
+dd()
+{
+   if [ "$HOSTOS" == "Linux" ]
+   then        
+       command dd --help | grep noxfer > /dev/null 2>&1
+       
+       if [ "$?" -eq 0 ]
+           then
+               command dd status=noxfer $@
+           else
+               command dd $@
+       fi
+   else
+       command dd $@
+   fi
+}
+
 _mount_opts()
 {
     case $FSTYP in
@@ -671,6 +688,7 @@ _check_xfs_filesystem()
                extra_rt_options="-r$3"
         extra_mount_options=$extra_mount_options" -ortdev=$3"
     fi
+    extra_mount_options=$extra_mount_options" $MOUNT_OPTIONS"
 
     [ "$FSTYP" != xfs ] && return 0
     testoption=""
@@ -1067,7 +1085,6 @@ _descend()
 #
 _populate_fs()
 {
-
     here=`pwd`
     dirs=5          # ndirs in each subdir till leaves
     size=0          # sizeof files in K
@@ -1088,7 +1105,6 @@ _populate_fs()
         esac
     done
 
-
     _descend $root $depth
     wait
 
@@ -1105,13 +1121,28 @@ _test_inode_flag()
     file=$2
 
     if which $XFS_IO_PROG >/dev/null; then
-        if $XFS_IO_PROG -r -c 'lsattr -v' "$file" | fgrep -q "$flag" ; then
+        if $XFS_IO_PROG -r -c 'lsattr -v' "$file" | grep -q "$flag" ; then
            return 0
         fi
     fi
     return 1
 }
 
+# query the given files extsize allocator hint in bytes (if any)
+#
+_test_inode_extsz()
+{
+    file=$1
+    blocks=""
+
+    if which $XFS_IO_PROG >/dev/null; then
+       blocks=`$XFS_IO_PROG -r -c 'stat' "$file" | \
+               awk '/^xattr.extsize =/ { print $3 }'`
+    fi
+    [ -z "$blocks" ] && blocks="0"
+    echo $blocks
+}
+
 
 ################################################################################
 
@@ -1141,9 +1172,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