xfs
[Top] [All Lists]

[PATCH] [xfstests]: Don't hardcode getfattr/setfattr/attr paths.

To: xfs@xxxxxxxxxxx
Subject: [PATCH] [xfstests]: Don't hardcode getfattr/setfattr/attr paths.
From: Arkadiusz Miśkiewicz <arekm@xxxxxxxx>
Date: Thu, 9 Sep 2010 16:57:58 +0200
Cc: Arkadiusz Miśkiewicz <arekm@xxxxxxxx>
Stop hardcoding paths to getfattr, setfattr and attr binaries.

Signed-off-by: Arkadiusz Miśkiewicz <arekm@xxxxxxxx>
---
 020           |   10 +++++-----
 021           |    4 ++--
 062           |    6 +++---
 186           |    4 ++--
 187           |    4 ++--
 227           |    2 +-
 common.config |    3 +++
 7 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/020 b/020
index 0118e61..f5f2db8 100755
--- a/020
+++ b/020
@@ -49,7 +49,7 @@ _filter()
 
 _attr()
 {
-    attr $* 2>$tmp.err >$tmp.out
+    $ATTR_PROG $* 2>$tmp.err >$tmp.out
     exit=$?
     _filter $tmp.out
     _filter $tmp.err 1>&2
@@ -58,7 +58,7 @@ _attr()
 
 _getfattr()
 {
-    getfattr $* 2>$tmp.err >$tmp.out
+    $GETFATTR_PROG $* 2>$tmp.err >$tmp.out
     exit=$?
     _filter $tmp.out
     _filter $tmp.err 1>&2
@@ -82,8 +82,8 @@ _attr_list()
 _supported_fs xfs udf
 _supported_os Linux
 
-[ -x /usr/bin/attr ] || _notrun "attr is not installed"
-[ -x /usr/bin/getfattr ] || _notrun "getfattr is not installed"
+[ -x $ATTR_PROG ] || _notrun "attr is not installed"
+[ -x $GETFATTR_PROG ] || _notrun "getfattr is not installed"
 
 _setup_testdir
 
@@ -145,7 +145,7 @@ echo "*** remove lots of attributes"
 v=0
 while [ $v -lt 1000 ]
 do
-    if ! attr -r "attribute_$v" $testfile >>$seq.full
+    if ! $ATTR_PROG -r "attribute_$v" $testfile >>$seq.full
     then
         echo "!!! failed to remove \"attribute_$v\""
         exit 1
diff --git a/021 b/021
index 18284eb..2c76cc1 100755
--- a/021
+++ b/021
@@ -76,8 +76,8 @@ _getfattr()
 _supported_fs xfs
 _supported_os Linux
 
-[ -x /usr/bin/attr ] || _notrun "attr is not installed"
-[ -x /usr/bin/getfattr ] || _notrun "getfattr is not installed"
+[ -x $ATTR_PROG ] || _notrun "attr is not installed"
+[ -x $GETFATTR_PROG ] || _notrun "getfattr is not installed"
 
 _require_scratch
 
diff --git a/062 b/062
index 76ad513..2bae6a3 100755
--- a/062
+++ b/062
@@ -93,12 +93,12 @@ _linux_attr_calls()
 
 getfattr()
 {
-    /usr/bin/getfattr --absolute-names -dh $@ 2>&1 | _filter_scratch
+    $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch
 }
 
 setfattr()
 {
-    /usr/bin/setfattr $@ 2>&1 | _filter_scratch
+    $SETFATTR_PROG $@ 2>&1 | _filter_scratch
 }
 
 _create_test_bed()
@@ -219,7 +219,7 @@ echo; echo
 _backup()
 {
        # NB: no filtering of scratch here... (need to restore too)
-       /usr/bin/getfattr --absolute-names -dh -R -m '.' $SCRATCH_MNT >$1
+       $GETFATTR_PROG --absolute-names -dh -R -m '.' $SCRATCH_MNT >$1
        echo BACKUP $1 >>$seq.full
        cat $1 >> $seq.full
        [ ! -s $1 ] && echo "warning: $1 (backup file) is empty"
diff --git a/186 b/186
index 643f4b1..80c406d 100755
--- a/186
+++ b/186
@@ -64,7 +64,7 @@ _create_eas()
        start_num=$1
        end_num=$2
        for i in `seq $start_num $end_num`; do
-               setfattr -n user.$i -v 0xbabe $fork_dir
+               $SETFATTR_PROG -n user.$i -v 0xbabe $fork_dir
        done
 }
 
@@ -73,7 +73,7 @@ _rmv_eas()
        start_num=$1
        end_num=$2
        for i in `seq $start_num $end_num`; do
-               setfattr -x user.$i $fork_dir
+               $SETFATTR_PROG -x user.$i $fork_dir
        done
 }
 
diff --git a/187 b/187
index 6a489d0..ad28051 100755
--- a/187
+++ b/187
@@ -106,8 +106,8 @@ echo ""
 _scratch_mount -o noattr2
 cd $SCRATCH_MNT
 touch testfile
-setfattr -n user.test -v 0xbabe testfile
-getfattr testfile
+$SETFATTR_PROG -n user.test -v 0xbabe testfile
+$GETFATTR_PROG testfile
 cd $here
 $UMOUNT_PROG $SCRATCH_MNT
 $XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
diff --git a/227 b/227
index ac6189c..cb7fa70 100644
--- a/227
+++ b/227
@@ -87,7 +87,7 @@ fragment_freespace()
 create_attrs()
 {
        for foo in `seq 0 1 $1`; do
-               setfattr -n user.$foo -v 0xbabe $2
+               $SETFATTR_PROG -n user.$foo -v 0xbabe $2
        done
 }
 
diff --git a/common.config b/common.config
index 04bdcf6..256f144 100644
--- a/common.config
+++ b/common.config
@@ -150,6 +150,9 @@ export XFSDUMP_PROG="`set_prog_path xfsdump`"
 export XFSRESTORE_PROG="`set_prog_path xfsrestore`"
 export XFSINVUTIL_PROG="`set_prog_path xfsinvutil`"
 export DBENCH_PROG="`set_prog_path dbench`"
+export GETFATTR_PROG="`set_prog_path getfattr`"
+export SETFATTR_PROG="`set_prog_path setfattr`"
+export ATTR_PROG="`set_prog_path attr`"
 
 # Generate a comparable xfsprogs version number in the form of
 # major * 10000 + minor * 100 + release
-- 
1.7.2.2

<Prev in Thread] Current Thread [Next in Thread>