fstests: _require_chattr() must get an input arg
[xfstests-dev.git] / common / rc
index edfba5d2535d4aae3454a9e57246f0c2f8a2587b..ae3add319ae7d8bdf52ce9def89f5803ac54cbfe 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1496,7 +1496,7 @@ _require_scratch_nocheck()
 {
     case "$FSTYP" in
        glusterfs)
-               echo $SCRATCH_DEV | grep -q "\w:\w" > /dev/null 2>&1
+               echo $SCRATCH_DEV | egrep -q ":/?" > /dev/null 2>&1
                if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
                        _notrun "this test requires a valid \$SCRATCH_DEV"
                fi
@@ -1584,7 +1584,7 @@ _require_test()
 {
     case "$FSTYP" in
        glusterfs)
-               echo $TEST_DEV | grep -q "\w:\w" > /dev/null 2>&1
+               echo $TEST_DEV | egrep -q ":/?" > /dev/null 2>&1
                if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
                        _notrun "this test requires a valid \$TEST_DEV"
                fi
@@ -3134,18 +3134,21 @@ _require_test_lsattr()
 
 _require_chattr()
 {
-    attribute=$1
-
-    touch $TEST_DIR/syscalltest
-    chattr "+$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1
-    status=$?
-    chattr "-$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1
-    if [ "$status" -ne 0 ]; then
-      _notrun "file system doesn't support chattr +$attribute"
-    fi
-    cat $TEST_DIR/syscalltest.out >> $seqres.full
+       if [ -z "$1" ]; then
+               echo "Usage: _require_chattr <attr>"
+               exit 1
+       fi
+       local attribute=$1
 
-    rm -f $TEST_DIR/syscalltest.out
+       touch $TEST_DIR/syscalltest
+       chattr "+$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1
+       status=$?
+       chattr "-$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1
+       if [ "$status" -ne 0 ]; then
+               _notrun "file system doesn't support chattr +$attribute"
+       fi
+       cat $TEST_DIR/syscalltest.out >> $seqres.full
+       rm -f $TEST_DIR/syscalltest.out
 }
 
 _get_total_inode()