Don't hardcode paths to many binaries.

Stop hardcoding paths to getfattr, setfattr, attr, quota, xfs_quota,
killall, indent and xfs_copy binaries.

Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>

- new
Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Arkadiusz Miśkiewicz
2010-09-09 19:02:17 +02:00
committed by Christoph Hellwig
parent 9e75fba07d
commit 903b50fad9
15 changed files with 39 additions and 30 deletions
+5 -5
View File
@@ -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"
[ -n $ATTR_PROG ] || _notrun "attr is not installed"
[ -n $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
+2 -2
View File
@@ -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"
[ -n $ATTR_PROG ] || _notrun "attr is not installed"
[ -n $GETFATTR_PROG ] || _notrun "getfattr is not installed"
_require_scratch
+3 -3
View File
@@ -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"
+5 -5
View File
@@ -130,7 +130,7 @@ _supported_fs xfs
_supported_os Linux
[ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
[ -x /usr/sbin/xfs_copy ] || _notrun "xfs_copy binary not yet installed"
[ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
_require_scratch
_require_loop
@@ -145,12 +145,12 @@ umount $SCRATCH_MNT 2>/dev/null
echo
echo === copying scratch device to single target
xfs_copy $SCRATCH_DEV $imgs.image | _filter_copy '#' $imgs.image '#' '#'
$XFS_COPY_PROG $SCRATCH_DEV $imgs.image | _filter_copy '#' $imgs.image '#' '#'
_verify_copy $imgs.image $SCRATCH_DEV $SCRATCH_MNT
echo
echo === copying scratch device to single target, duplicate UUID
xfs_copy -d $SCRATCH_DEV $imgs.image | _filter_copy '#' $imgs.image '#' '#'
$XFS_COPY_PROG -d $SCRATCH_DEV $imgs.image | _filter_copy '#' $imgs.image '#' '#'
_verify_copy $imgs.image $SCRATCH_DEV $SCRATCH_MNT
echo
@@ -163,7 +163,7 @@ mount -t xfs -o loop $imgs.source $imgs.source_dir
loop2=`mount | grep $imgs.source | grep -o -e 'loop=.*[^),]' | grep -o -e '/.*$'`
cp -a $here $imgs.source_dir
mount -t xfs -o remount,ro $imgs.source $imgs.source_dir
xfs_copy $imgs.source $imgs.image | _filter_copy '#' $imgs.image '#' '#'
$XFS_COPY_PROG $imgs.source $imgs.image | _filter_copy '#' $imgs.image '#' '#'
_verify_copy $imgs.image $imgs.source $imgs.source_dir
# HACK WARNING:
@@ -174,7 +174,7 @@ losetup -d $loop2 > /dev/null 2>&1
echo
echo === copying scratch device to multiple targets
xfs_copy -L$imgs.log -b $SCRATCH_DEV $imgs.image1 $imgs.image2 \
$XFS_COPY_PROG -L$imgs.log -b $SCRATCH_DEV $imgs.image1 $imgs.image2 \
| _filter_copy '#' $imgs.image1 '#' $imgs.image2
_verify_copy $imgs.image1 $SCRATCH_DEV $SCRATCH_MNT
_verify_copy $imgs.image2 $SCRATCH_DEV $SCRATCH_MNT
+1 -1
View File
@@ -71,7 +71,7 @@ _print_logstate
# curious if FS consistent at start
if false; then
if /usr/sbin/xfs_check $SCRATCH_DEV; then
if $XFS_CHECK_PROG $SCRATCH_DEV; then
echo "*** checked ok ***"
fi
fi
+1 -1
View File
@@ -47,7 +47,7 @@ _supported_fs xfs
_supported_os IRIX Linux
_require_realtime
_require_scratch
_require_command /usr/sbin/xfs_io
_require_command $XFS_IO_PROG xfs_io
_filter_realtime_flag()
{
+1 -1
View File
@@ -78,7 +78,7 @@ _filter_noymlinks_flag()
# real QA test starts here
_supported_os Linux IRIX
_supported_fs xfs
_require_command /usr/sbin/xfs_io
_require_command $XFS_IO_PROG xfs_io
_require_scratch
_create_scratch
+1 -1
View File
@@ -40,7 +40,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
# real QA test starts here
_supported_fs xfs
_supported_os Linux
_require_command /usr/bin/indent
_require_command $INDENT_PROG "indent"
# filter out known changes to xfs type sizes
_type_size_filter()
+2 -3
View File
@@ -27,7 +27,6 @@ owner=dgc@sgi.com
seq=`basename $0`
echo "QA output created by $seq"
killall="/usr/bin/killall"
here=`pwd`
tmp=/tmp/$$
rm -f $seq.full
@@ -36,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
killall -r -q -TERM fsstress 2> /dev/null
$KILLALL_PROG -r -q -TERM fsstress 2> /dev/null
sync # ensures all fsstress processes died
_cleanup_testdir
}
@@ -58,7 +57,7 @@ workout()
_supported_fs xfs
_supported_os Linux
[ -x $killall ] || _notrun "$killall executable not found"
[ -n "$KILLALL_PROG" ] || _notrun "killall executable not found"
_setup_testdir
_require_scratch
+2 -2
View File
@@ -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
}
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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
}
+8
View File
@@ -150,6 +150,14 @@ 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`"
export QUOTA_PROG="`set_prog_path quota`"
export XFS_QUOTA_PROG="`set_prog_path xfs_quota`"
export KILLALL_PROG="`set_prog_path killall`"
export INDENT_PROG="`set_prog_path indent`"
export XFS_COPY_PROG="`set_prog_path xfs_copy`"
# Generate a comparable xfsprogs version number in the form of
# major * 10000 + minor * 100 + release
+2 -2
View File
@@ -26,7 +26,7 @@
#
_require_quota()
{
[ -x /usr/bin/quota ] || _notrun "Quota user tools not installed"
[ -n $QUOTA_PROG ] || _notrun "Quota user tools not installed"
if [ $FSTYP = "xfs" ]; then
[ -f /proc/fs/xfs/xqmstat ] || _notrun "Installed kernel does not support XFS quota"
elif [ $FSTYP != "gfs2" ]; then
@@ -42,7 +42,7 @@ _require_xfs_quota()
{
src/feature -q $TEST_DEV
[ $? -ne 0 ] && _notrun "Installed kernel does not support XFS quota"
[ -x /usr/sbin/xfs_quota ] || _notrun "XFS quota user tools not installed"
[ -n $XFS_QUOTA_PROG ] || _notrun "XFS quota user tools not installed"
}
#
+3 -1
View File
@@ -779,10 +779,12 @@ _require_realtime()
}
# this test requires that a specified command (executable) exists
# $1 - command, $2 - name for error message
#
_require_command()
{
[ -x "$1" ] || _notrun "$1 utility required, skipped this test"
[ -n "$1" ] && _cmd="$1" || _cmd="$2"
[ -n "$1" -a -x "$1" ] || _notrun "$_cmd utility required, skipped this test"
}
# this test requires that external log/realtime devices are not in use