Skip to contentSkip to conversation

fstests: get rid of set_prog_path

PATCH In review Jan Kara 3 participants 5 messages May 29, 2018 – Jun 6, 2018

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

PATCH 1/2 fstests: get rid of set_prog_path

From: Dave Chinner <[email protected]>

It's just a one line wrapper that adds complexity, remove it. Move the couple of calls in tests to common/config, but leave the xfsdump setup in place and just convert it.

---
 common/config   | 169 +++++++++++++++++++++++++++-----------------------------
 common/dump     |   6 +-
 tests/btrfs/085 |   2 -
 tests/xfs/446   |   1 -
 4 files changed, 85 insertions(+), 93 deletions(-)
common/config +82 -87
index 02c378a96fa2..ccfb066ebe95 100644
@@ -88,17 +88,11 @@ export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
 
 export RECREATE_TEST_DEV=false
 
-# $1 = prog to look for
-set_prog_path()
-{
-	type -P $1
-}
-
 # Handle mkfs.$fstyp which does (or does not) require -f to overwrite
 set_mkfs_prog_path_with_opts()
 {
 	local fstyp=$1
-	local p=`set_prog_path mkfs.$fstyp`
+	local p=$(type -P mkfs.$fstyp)
 
 	# Note: mkfs.f2fs doesn't support the --help option yet, but it doesn't
 	# matter since it also prints the help when an invalid option is given.
@@ -117,105 +111,105 @@ _fatal()
     exit 1
 }
 
-export MKFS_PROG="`set_prog_path mkfs`"
+export MKFS_PROG="$(type -P mkfs)"
 [ "$MKFS_PROG" = "" ] && _fatal "mkfs not found"
 
-export MOUNT_PROG="`set_prog_path mount`"
+export MOUNT_PROG="$(type -P mount)"
 [ "$MOUNT_PROG" = "" ] && _fatal "mount not found"
 
-export UMOUNT_PROG="`set_prog_path umount`"
+export UMOUNT_PROG="$(type -P umount)"
 [ "$UMOUNT_PROG" = "" ] && _fatal "umount not found"
 
 export FSSTRESS_PROG="./ltp/fsstress"
 [ ! -x $FSSTRESS_PROG ] && _fatal "fsstress not found or executable"
 
-export PERL_PROG="`set_prog_path perl`"
+export PERL_PROG="$(type -P perl)"
 [ "$PERL_PROG" = "" ] && _fatal "perl not found"
 
-export AWK_PROG="`set_prog_path awk`"
+export AWK_PROG="$(type -P awk)"
 [ "$AWK_PROG" = "" ] && _fatal "awk not found"
 
-export SED_PROG="`set_prog_path sed`"
+export SED_PROG="$(type -P sed)"
 [ "$SED_PROG" = "" ] && _fatal "sed not found"
 
-export BC_PROG="`set_prog_path bc`"
+export BC_PROG="$(type -P bc)"
 [ "$BC_PROG" = "" ] && _fatal "bc not found"
 
 export PS_ALL_FLAGS="-ef"
 
-export DF_PROG="`set_prog_path df`"
+export DF_PROG="$(type -P df)"
 [ "$DF_PROG" = "" ] && _fatal "df not found"
 [ "$HOSTOS" = "Linux" ] && export DF_PROG="$DF_PROG -T -P"
 
-export XFS_IO_PROG="`set_prog_path xfs_io`"
+export XFS_IO_PROG="$(type -P xfs_io)"
 [ "$XFS_IO_PROG" = "" ] && _fatal "xfs_io not found"
 
-export XFS_LOGPRINT_PROG="`set_prog_path xfs_logprint`"
-export XFS_REPAIR_PROG="`set_prog_path xfs_repair`"
-export XFS_DB_PROG="`set_prog_path xfs_db`"
-export XFS_GROWFS_PROG=`set_prog_path xfs_growfs`
-export XFS_SPACEMAN_PROG="`set_prog_path xfs_spaceman`"
-export XFS_SCRUB_PROG="`set_prog_path xfs_scrub`"
-export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`"
-export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`"
-export __XFSDUMP_PROG="`set_prog_path xfsdump`"
+export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
+export XFS_REPAIR_PROG="$(type -P xfs_repair)"
+export XFS_DB_PROG="$(type -P xfs_db)"
+export XFS_GROWFS_PROG=$(type -P xfs_growfs)
+export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
+export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
+export XFS_PARALLEL_REPAIR_PROG="$(type -P xfs_prepair)"
+export XFS_PARALLEL_REPAIR64_PROG="$(type -P xfs_prepair64)"
+export __XFSDUMP_PROG="$(type -P xfsdump)"
 if [ -n "$__XFSDUMP_PROG" ]; then
 	export XFSDUMP_PROG="$__XFSDUMP_PROG -e"
 else
 	export XFSDUMP_PROG=""
 fi
-export XFSRESTORE_PROG="`set_prog_path xfsrestore`"
-export XFSINVUTIL_PROG="`set_prog_path xfsinvutil`"
-export GETFATTR_PROG="`set_prog_path getfattr`"
-export SETFATTR_PROG="`set_prog_path setfattr`"
-export CHACL_PROG="`set_prog_path chacl`"
-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`"
-export FSTRIM_PROG="`set_prog_path fstrim`"
-export DUMPE2FS_PROG="`set_prog_path dumpe2fs`"
-export FIO_PROG="`set_prog_path fio`"
-export FILEFRAG_PROG="`set_prog_path filefrag`"
-export E4DEFRAG_PROG="`set_prog_path e4defrag`"
-export LOGGER_PROG="`set_prog_path logger`"
-export DBENCH_PROG="`set_prog_path dbench`"
-export DMSETUP_PROG="`set_prog_path dmsetup`"
-export WIPEFS_PROG="`set_prog_path wipefs`"
-export DUMP_PROG="`set_prog_path dump`"
-export RESTORE_PROG="`set_prog_path restore`"
-export LVM_PROG="`set_prog_path lvm`"
-export CHATTR_PROG="`set_prog_path chattr`"
-export DEBUGFS_PROG="`set_prog_path debugfs`"
-export UUIDGEN_PROG="`set_prog_path uuidgen`"
-export GETRICHACL_PROG="`set_prog_path getrichacl`"
-export SETRICHACL_PROG="`set_prog_path setrichacl`"
-export KEYCTL_PROG="`set_prog_path keyctl`"
-export XZ_PROG="`set_prog_path xz`"
-export FLOCK_PROG="`set_prog_path flock`"
-export LDD_PROG="`set_prog_path ldd`"
-export TIMEOUT_PROG="`set_prog_path timeout`"
-export MAN_PROG="`set_prog_path man`"
-export NFS4_SETFACL_PROG="`set_prog_path nfs4_setfacl`"
-export NFS4_GETFACL_PROG="`set_prog_path nfs4_getfacl`"
-export UBIUPDATEVOL_PROG="`set_prog_path ubiupdatevol`"
-export THIN_CHECK_PROG="$(set_prog_path thin_check)"
-export PYTHON2_PROG="`set_prog_path python2`"
-export SQLITE3_PROG="`set_prog_path sqlite3`"
-export TIMEOUT_PROG="`set_prog_path timeout`"
-export SETCAP_PROG="`set_prog_path setcap`"
-export GETCAP_PROG="`set_prog_path getcap`"
+export XFSRESTORE_PROG="$(type -P xfsrestore)"
+export XFSINVUTIL_PROG="$(type -P xfsinvutil)"
+export GETFATTR_PROG="$(type -P getfattr)"
+export SETFATTR_PROG="$(type -P setfattr)"
+export CHACL_PROG="$(type -P chacl)"
+export ATTR_PROG="$(type -P attr)"
+export QUOTA_PROG="$(type -P quota)"
+export XFS_QUOTA_PROG="$(type -P xfs_quota)"
+export KILLALL_PROG="$(type -P killall)"
+export INDENT_PROG="$(type -P indent)"
+export XFS_COPY_PROG="$(type -P xfs_copy)"
+export FSTRIM_PROG="$(type -P fstrim)"
+export DUMPE2FS_PROG="$(type -P dumpe2fs)"
+export FIO_PROG="$(type -P fio)"
+export FILEFRAG_PROG="$(type -P filefrag)"
+export E4DEFRAG_PROG="$(type -P e4defrag)"
+export LOGGER_PROG="$(type -P logger)"
+export DBENCH_PROG="$(type -P dbench)"
+export DMSETUP_PROG="$(type -P dmsetup)"
+export WIPEFS_PROG="$(type -P wipefs)"
+export DUMP_PROG="$(type -P dump)"
+export RESTORE_PROG="$(type -P restore)"
+export LVM_PROG="$(type -P lvm)"
+export CHATTR_PROG="$(type -P chattr)"
+export DEBUGFS_PROG="$(type -P debugfs)"
+export UUIDGEN_PROG="$(type -P uuidgen)"
+export GETRICHACL_PROG="$(type -P getrichacl)"
+export SETRICHACL_PROG="$(type -P setrichacl)"
+export KEYCTL_PROG="$(type -P keyctl)"
+export XZ_PROG="$(type -P xz)"
+export FLOCK_PROG="$(type -P flock)"
+export LDD_PROG="$(type -P ldd)"
+export TIMEOUT_PROG="$(type -P timeout)"
+export MAN_PROG="$(type -P man)"
+export NFS4_SETFACL_PROG="$(type -P nfs4_setfacl)"
+export NFS4_GETFACL_PROG="$(type -P nfs4_getfacl)"
+export UBIUPDATEVOL_PROG="$(type -P ubiupdatevol)"
+export THIN_CHECK_PROG="$(type -P thin_check)"
+export PYTHON2_PROG="$(type -P python2)"
+export SQLITE3_PROG="$(type -P sqlite3)"
+export TIMEOUT_PROG="$(type -P timeout)"
+export SETCAP_PROG="$(type -P setcap)"
+export GETCAP_PROG="$(type -P getcap)"
 
 # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled.
 # newer systems have udevadm command but older systems like RHEL5 don't.
 # But if neither one is available, just set it to "sleep 1" to wait for lv to
 # be settled
-UDEV_SETTLE_PROG="`set_prog_path udevadm`"
+UDEV_SETTLE_PROG="$(type -P udevadm)"
 if [ "$UDEV_SETTLE_PROG" == "" ]; then
 	# try udevsettle command
-	UDEV_SETTLE_PROG="`set_prog_path udevsettle`"
+	UDEV_SETTLE_PROG="$(type -P udevsettle)"
 else
 	# udevadm is available, add 'settle' as subcommand
 	UDEV_SETTLE_PROG="$UDEV_SETTLE_PROG settle"
@@ -228,23 +222,24 @@ export UDEV_SETTLE_PROG
 
 case "$HOSTOS" in
     Linux)
-        export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
-        export MKFS_EXT4_PROG="`set_prog_path mkfs.ext4`"
-        export MKFS_UDF_PROG="`set_prog_path mkudffs`"
-        export MKFS_BTRFS_PROG="`set_mkfs_prog_path_with_opts btrfs`"
-        export MKFS_F2FS_PROG="`set_mkfs_prog_path_with_opts f2fs`"
-        export DUMP_F2FS_PROG="`set_prog_path dump.f2fs`"
-        export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
-        export BTRFS_SHOW_SUPER_PROG="`set_prog_path btrfs-show-super`"
-	export BTRFS_CONVERT_PROG="`set_prog_path btrfs-convert`"
-        export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
-        export MKFS_NFS_PROG="false"
-        export MKFS_CIFS_PROG="false"
-        export MKFS_OVERLAY_PROG="false"
-        export MKFS_REISER4_PROG="`set_prog_path mkfs.reiser4`"
-	export E2FSCK_PROG="`set_prog_path e2fsck`"
-	export TUNE2FS_PROG="`set_prog_path tune2fs`"
-	export FSCK_OVERLAY_PROG="`set_prog_path fsck.overlay`"
+	export MKFS_XFS_PROG=$(type -P mkfs.xfs)
+	export MKFS_EXT4_PROG=$(type -P mkfs.ext4)
+	export MKFS_UDF_PROG=$(type -P mkudffs)
+	export MKFS_BTRFS_PROG=$(type -P btrfs)
+	export MKFS_F2FS_PROG=$(type -P f2fs)
+	export DUMP_F2FS_PROG=$(type -P dump.f2fs)
+	export BTRFS_UTIL_PROG=$(type -P btrfs)
+	export BTRFS_SHOW_SUPER_PROG=$(type -P btrfs-show-super)
+	export BTRFS_CONVERT_PROG=$(type -P btrfs-convert)
+	export BTRFS_DEBUG_TREE_PROG=$(type -P btrfs-debug-tree)
+	export XFS_FSR_PROG=$(type -P xfs_fsr)
+	export MKFS_NFS_PROG="false"
+	export MKFS_CIFS_PROG="false"
+	export MKFS_OVERLAY_PROG="false"
+	export MKFS_REISER4_PROG=$(type -P mkfs.reiser4)
+	export E2FSCK_PROG=$(type -P e2fsck)
+	export TUNE2FS_PROG=$(type -P tune2fs)
+	export FSCK_OVERLAY_PROG=$(type -P fsck.overlay)
         ;;
 esac
 
common/dump +3 -3
index 7b9c10a25414..8a0ba1096d6a 100644
@@ -29,10 +29,10 @@ if [ -n "$DEBUGDUMP" ]; then
 
 	# Use dump/restore in qa directory (copy them here) for debugging
 	export PATH="$here:$PATH"
-	export __XFSDUMP_PROG="`set_prog_path xfsdump`"
+	export __XFSDUMP_PROG=$(type -P xfsdump)
 	export XFSDUMP_PROG="$__XFSDUMP_PROG -e"
-	export XFSRESTORE_PROG="`set_prog_path xfsrestore`"
-	export XFSINVUTIL_PROG="`set_prog_path xfsinvutil`"
+	export XFSRESTORE_PROG=$(type -P xfsrestore)
+	export XFSINVUTIL_PROG=$(type -P xfsinvutil)
 	[ -x $here/xfsdump ]    && echo "Using xfstests' xfsdump for debug"
 	[ -x $here/xfsrestore ] && echo "Using xfstests' xfsrestore for debug"
 	[ -x $here/xfsinvutil ] && echo "Using xfstests' xfsinvutil for debug"
tests/btrfs/085 +0 -2
index 804899724cba..a1edc28341da 100755
@@ -55,8 +55,6 @@ _supported_fs btrfs
 _supported_os Linux
 _require_scratch
 _require_dm_target flakey
-
-BTRFS_DEBUG_TREE_PROG="`set_prog_path btrfs-debug-tree`"
 _require_command "$BTRFS_DEBUG_TREE_PROG" btrfs-debug-tree
 
 rm -f $seqres.full
tests/xfs/446 +0 -1
index 752c6a7de827..ac74723f471f 100755
@@ -37,7 +37,6 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs xfs
 _supported_os Linux
-export CHECKBASHISMS_PROG="`set_prog_path checkbashisms`"
 _require_command "$CHECKBASHISMS_PROG" checkbashisms
 
 test -z "$WORKAREA" && _notrun "Can't find xfsprogs source"
Signature · 1 line
2.13.6
author
#1 lore raw

PATCH 2/2 Make ./new work for non-root user

Currently 'new' script sources common/config which tries to find mkfs and fails if not found (which is likely for non-root user). This is inconvenient as development usually does not happen as root. In fact the vast majority of setup in common/config and common/rc is not necessary for 'new'. Split out the necessary bits into new common/config-base and use it in 'new'. Cleanup common/rc and common/config now that they're only used from 'check' and 'setup'.

---
 check             | 15 ++++-----------
 common/config     |  7 ++-----
 common/rc         | 27 ++-------------------------
 common/test_names | 12 ++++++++++++
 new               |  5 ++++-
 5 files changed, 24 insertions(+), 42 deletions(-)
 create mode 100644 common/test_names
check +4 -11
index f6fb352bcbb9..a8cb7289b320 100755
@@ -331,10 +331,10 @@ while [ $# -gt 0 ]; do
 	shift
 done
 
-# we need common/config, source it after processing args, overlay needs FSTYP
-# set before sourcing common/config
-if ! . ./common/config; then
-	echo "$iam: failed to source common/config"
+# we need common/rc, that also sources common/config. We need to source it
+# after processing args, overlay needs FSTYP set before sourcing common/config
+if ! . ./common/rc; then
+	echo "check: failed to source common/rc"
 	exit 1
 fi
 
@@ -374,13 +374,6 @@ elif [ -z "$GROUP_LIST" ]; then
 	GROUP_LIST="auto"
 fi
 
-# we need common/rc
-if ! . ./common/rc
-then
-    echo "check: failed to source common/rc"
-    exit 1
-fi
-
 if [ `id -u` -ne 0 ]
 then
     echo "check: QA must be run as root"
common/config +2 -5
index ccfb066ebe95..51380231aed3 100644
@@ -47,6 +47,8 @@
 #   validity or mountedness.
 #
 
+. common/test_names
+
 # all tests should use a common language setting to prevent golden
 # output mismatches.
 export LANG=C
@@ -268,11 +270,6 @@ fi
 rm -f /tmp/crc_check.img
 export XFS_MKFS_HAS_NO_META_SUPPORT
 
-# new doesn't need config file parsed, we can stop here
-if [ "$iam" == "new" ]; then
-	return 0
-fi
-
 _mount_opts()
 {
 	case $FSTYP in
common/rc +2 -25
index 52b128982e98..9273ff75c9dc 100644
@@ -20,18 +20,9 @@
 #  Mountain View, CA 94043, USA, or: http://www.sgi.com
 #-----------------------------------------------------------------------
 
-BC=$(which bc 2> /dev/null) || BC=
+. common/config
 
-# Valid test names start with 3 digits "NNN":
-#  "[0-9]\{3\}"
-# followed by an optional "-":
-#  "-\?"
-# followed by an optional combination of alphanumeric and "-" chars:
-#  "[[:alnum:]-]*"
-# e.g. 999-the-mark-of-fstests
-#
-VALID_TEST_ID="[0-9]\{3\}"
-VALID_TEST_NAME="$VALID_TEST_ID-\?[[:alnum:]-]*"
+BC=$(which bc 2> /dev/null) || BC=
 
 # Some tests are not relevant or functional when testing XFS realtime
 # subvolumes along with the rtinherit=1 mkfs option.  In these cases,
@@ -110,16 +101,6 @@ _ls_l()
 	ls -l $* | sed "s/\(^[-rwxdlbcpsStT]*\)\. /\1 /" | grep -v 'lost+found'
 }
 
-# we need common/config
-if [ "$iam" != "check" ]
-then
-    if ! . ./common/config
-        then
-        echo "$iam: failed to source common/config"
-        exit 1
-    fi
-fi
-
 _dump_err()
 {
     _err_msg="$*"
@@ -3574,10 +3555,6 @@ _disable_dmesg_check()
 
 init_rc()
 {
-	if [ "$iam" == new ]
-	then
-		return
-	fi
 	# make some further configuration checks here
 	if [ "$TEST_DEV" = ""  ]
 	then
common/test_names new file +12 -0
new file mode 100644
index 000000000000..98af40cdbd85
@@ -0,0 +1,12 @@
+##/bin/bash
+
+# Valid test names start with 3 digits "NNN":
+#  "[0-9]\{3\}"
+# followed by an optional "-":
+#  "-\?"
+# followed by an optional combination of alphanumeric and "-" chars:
+#  "[[:alnum:]-]*"
+# e.g. 999-the-mark-of-fstests
+#
+VALID_TEST_ID="[0-9]\{3\}"
+VALID_TEST_NAME="$VALID_TEST_ID-\?[[:alnum:]-]*"
new +4 -1
index 4eacccd3bf8b..112a63d5b9f8 100755
@@ -23,7 +23,7 @@
 
 # generic initialization
 iam=new
-. ./common/rc
+. ./common/test_names
 
 trap "rm -f /tmp/$$.; exit" 0 1 2 3 15
 
@@ -81,6 +81,9 @@ line=0
 eof=1
 [ -f "$tdir/group" ] || usage
 
+export AWK_PROG="$(type -P awk)"
+[ "$AWK_PROG" = "" ] && { echo "awk not found"; exit; }
+
 for found in `cat $tdir/group | tr - ' ' | $AWK_PROG '{ print $1 }'`
 do
     line=$((line+1))
Signature · 1 line
2.13.6
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] Make ./new work for non-root user

Quoted 9 lines · Jan Kara

Currently 'new' script sources common/config which tries to find mkfs and fails if not found (which is likely for non-root user). This is inconvenient as development usually does not happen as root. In fact the vast majority of setup in common/config and common/rc is not necessary for 'new'. Split out the necessary bits into new common/config-base and use it in 'new'. Cleanup common/rc and common/config now that they're only used from 'check' and 'setup'.

Looks good!

Signature · 2 lines
Dave Chinner
[email protected]
#3 lore raw
In reply to Jan Kara
Quoted 208 lines · Jan Kara

From: Dave Chinner <[email protected]>

It's just a one line wrapper that adds complexity, remove it. Move the couple of calls in tests to common/config, but leave the xfsdump setup in place and just convert it.

---
 common/config   | 169 +++++++++++++++++++++++++++-----------------------------
 common/dump     |   6 +-
 tests/btrfs/085 |   2 -
 tests/xfs/446   |   1 -
 4 files changed, 85 insertions(+), 93 deletions(-)
common/config +64 -70
index 02c378a96fa2..ccfb066ebe95 100644
@@ -88,17 +88,11 @@ export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
 
 export RECREATE_TEST_DEV=false
 
-# $1 = prog to look for
-set_prog_path()
-{
-	type -P $1
-}
-
 # Handle mkfs.$fstyp which does (or does not) require -f to overwrite
 set_mkfs_prog_path_with_opts()
 {
 	local fstyp=$1
-	local p=`set_prog_path mkfs.$fstyp`
+	local p=$(type -P mkfs.$fstyp)
 
 	# Note: mkfs.f2fs doesn't support the --help option yet, but it doesn't
 	# matter since it also prints the help when an invalid option is given.
@@ -117,105 +111,105 @@ _fatal()
     exit 1
 }
 
-export MKFS_PROG="`set_prog_path mkfs`"
+export MKFS_PROG="$(type -P mkfs)"
 [ "$MKFS_PROG" = "" ] && _fatal "mkfs not found"
 
-export MOUNT_PROG="`set_prog_path mount`"
+export MOUNT_PROG="$(type -P mount)"
 [ "$MOUNT_PROG" = "" ] && _fatal "mount not found"
 
-export UMOUNT_PROG="`set_prog_path umount`"
+export UMOUNT_PROG="$(type -P umount)"
 [ "$UMOUNT_PROG" = "" ] && _fatal "umount not found"
 
 export FSSTRESS_PROG="./ltp/fsstress"
 [ ! -x $FSSTRESS_PROG ] && _fatal "fsstress not found or executable"
 
-export PERL_PROG="`set_prog_path perl`"
+export PERL_PROG="$(type -P perl)"
 [ "$PERL_PROG" = "" ] && _fatal "perl not found"
 
-export AWK_PROG="`set_prog_path awk`"
+export AWK_PROG="$(type -P awk)"
 [ "$AWK_PROG" = "" ] && _fatal "awk not found"
 
-export SED_PROG="`set_prog_path sed`"
+export SED_PROG="$(type -P sed)"
 [ "$SED_PROG" = "" ] && _fatal "sed not found"
 
-export BC_PROG="`set_prog_path bc`"
+export BC_PROG="$(type -P bc)"
 [ "$BC_PROG" = "" ] && _fatal "bc not found"
 
 export PS_ALL_FLAGS="-ef"
 
-export DF_PROG="`set_prog_path df`"
+export DF_PROG="$(type -P df)"
 [ "$DF_PROG" = "" ] && _fatal "df not found"
 [ "$HOSTOS" = "Linux" ] && export DF_PROG="$DF_PROG -T -P"
 
-export XFS_IO_PROG="`set_prog_path xfs_io`"
+export XFS_IO_PROG="$(type -P xfs_io)"
 [ "$XFS_IO_PROG" = "" ] && _fatal "xfs_io not found"
 
-export XFS_LOGPRINT_PROG="`set_prog_path xfs_logprint`"
-export XFS_REPAIR_PROG="`set_prog_path xfs_repair`"
-export XFS_DB_PROG="`set_prog_path xfs_db`"
-export XFS_GROWFS_PROG=`set_prog_path xfs_growfs`
-export XFS_SPACEMAN_PROG="`set_prog_path xfs_spaceman`"
-export XFS_SCRUB_PROG="`set_prog_path xfs_scrub`"
-export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`"
-export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`"
-export __XFSDUMP_PROG="`set_prog_path xfsdump`"
+export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
+export XFS_REPAIR_PROG="$(type -P xfs_repair)"
+export XFS_DB_PROG="$(type -P xfs_db)"
+export XFS_GROWFS_PROG=$(type -P xfs_growfs)
+export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
+export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
+export XFS_PARALLEL_REPAIR_PROG="$(type -P xfs_prepair)"
+export XFS_PARALLEL_REPAIR64_PROG="$(type -P xfs_prepair64)"
+export __XFSDUMP_PROG="$(type -P xfsdump)"
 if [ -n "$__XFSDUMP_PROG" ]; then
 	export XFSDUMP_PROG="$__XFSDUMP_PROG -e"
 else
 	export XFSDUMP_PROG=""
 fi
-export XFSRESTORE_PROG="`set_prog_path xfsrestore`"
-export XFSINVUTIL_PROG="`set_prog_path xfsinvutil`"
-export GETFATTR_PROG="`set_prog_path getfattr`"
-export SETFATTR_PROG="`set_prog_path setfattr`"
-export CHACL_PROG="`set_prog_path chacl`"
-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`"
-export FSTRIM_PROG="`set_prog_path fstrim`"
-export DUMPE2FS_PROG="`set_prog_path dumpe2fs`"
-export FIO_PROG="`set_prog_path fio`"
-export FILEFRAG_PROG="`set_prog_path filefrag`"
-export E4DEFRAG_PROG="`set_prog_path e4defrag`"
-export LOGGER_PROG="`set_prog_path logger`"
-export DBENCH_PROG="`set_prog_path dbench`"
-export DMSETUP_PROG="`set_prog_path dmsetup`"
-export WIPEFS_PROG="`set_prog_path wipefs`"
-export DUMP_PROG="`set_prog_path dump`"
-export RESTORE_PROG="`set_prog_path restore`"
-export LVM_PROG="`set_prog_path lvm`"
-export CHATTR_PROG="`set_prog_path chattr`"
-export DEBUGFS_PROG="`set_prog_path debugfs`"
-export UUIDGEN_PROG="`set_prog_path uuidgen`"
-export GETRICHACL_PROG="`set_prog_path getrichacl`"
-export SETRICHACL_PROG="`set_prog_path setrichacl`"
-export KEYCTL_PROG="`set_prog_path keyctl`"
-export XZ_PROG="`set_prog_path xz`"
-export FLOCK_PROG="`set_prog_path flock`"
-export LDD_PROG="`set_prog_path ldd`"
-export TIMEOUT_PROG="`set_prog_path timeout`"
-export MAN_PROG="`set_prog_path man`"
-export NFS4_SETFACL_PROG="`set_prog_path nfs4_setfacl`"
-export NFS4_GETFACL_PROG="`set_prog_path nfs4_getfacl`"
-export UBIUPDATEVOL_PROG="`set_prog_path ubiupdatevol`"
-export THIN_CHECK_PROG="$(set_prog_path thin_check)"
-export PYTHON2_PROG="`set_prog_path python2`"
-export SQLITE3_PROG="`set_prog_path sqlite3`"
-export TIMEOUT_PROG="`set_prog_path timeout`"
-export SETCAP_PROG="`set_prog_path setcap`"
-export GETCAP_PROG="`set_prog_path getcap`"
+export XFSRESTORE_PROG="$(type -P xfsrestore)"
+export XFSINVUTIL_PROG="$(type -P xfsinvutil)"
+export GETFATTR_PROG="$(type -P getfattr)"
+export SETFATTR_PROG="$(type -P setfattr)"
+export CHACL_PROG="$(type -P chacl)"
+export ATTR_PROG="$(type -P attr)"
+export QUOTA_PROG="$(type -P quota)"
+export XFS_QUOTA_PROG="$(type -P xfs_quota)"
+export KILLALL_PROG="$(type -P killall)"
+export INDENT_PROG="$(type -P indent)"
+export XFS_COPY_PROG="$(type -P xfs_copy)"
+export FSTRIM_PROG="$(type -P fstrim)"
+export DUMPE2FS_PROG="$(type -P dumpe2fs)"
+export FIO_PROG="$(type -P fio)"
+export FILEFRAG_PROG="$(type -P filefrag)"
+export E4DEFRAG_PROG="$(type -P e4defrag)"
+export LOGGER_PROG="$(type -P logger)"
+export DBENCH_PROG="$(type -P dbench)"
+export DMSETUP_PROG="$(type -P dmsetup)"
+export WIPEFS_PROG="$(type -P wipefs)"
+export DUMP_PROG="$(type -P dump)"
+export RESTORE_PROG="$(type -P restore)"
+export LVM_PROG="$(type -P lvm)"
+export CHATTR_PROG="$(type -P chattr)"
+export DEBUGFS_PROG="$(type -P debugfs)"
+export UUIDGEN_PROG="$(type -P uuidgen)"
+export GETRICHACL_PROG="$(type -P getrichacl)"
+export SETRICHACL_PROG="$(type -P setrichacl)"
+export KEYCTL_PROG="$(type -P keyctl)"
+export XZ_PROG="$(type -P xz)"
+export FLOCK_PROG="$(type -P flock)"
+export LDD_PROG="$(type -P ldd)"
+export TIMEOUT_PROG="$(type -P timeout)"
+export MAN_PROG="$(type -P man)"
+export NFS4_SETFACL_PROG="$(type -P nfs4_setfacl)"
+export NFS4_GETFACL_PROG="$(type -P nfs4_getfacl)"
+export UBIUPDATEVOL_PROG="$(type -P ubiupdatevol)"
+export THIN_CHECK_PROG="$(type -P thin_check)"
+export PYTHON2_PROG="$(type -P python2)"
+export SQLITE3_PROG="$(type -P sqlite3)"
+export TIMEOUT_PROG="$(type -P timeout)"
+export SETCAP_PROG="$(type -P setcap)"
+export GETCAP_PROG="$(type -P getcap)"
 
 # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled.
 # newer systems have udevadm command but older systems like RHEL5 don't.
 # But if neither one is available, just set it to "sleep 1" to wait for lv to
 # be settled
-UDEV_SETTLE_PROG="`set_prog_path udevadm`"
+UDEV_SETTLE_PROG="$(type -P udevadm)"
 if [ "$UDEV_SETTLE_PROG" == "" ]; then
 	# try udevsettle command
-	UDEV_SETTLE_PROG="`set_prog_path udevsettle`"
+	UDEV_SETTLE_PROG="$(type -P udevsettle)"
 else
 	# udevadm is available, add 'settle' as subcommand
 	UDEV_SETTLE_PROG="$UDEV_SETTLE_PROG settle"

common/config export UDEV_SETTLE_PROG · line 235

Quoted 8 lines
common/config +0 -5
@@ -228,23 +222,24 @@ export UDEV_SETTLE_PROG
 
 case "$HOSTOS" in
     Linux)
-        export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
-        export MKFS_EXT4_PROG="`set_prog_path mkfs.ext4`"
-        export MKFS_UDF_PROG="`set_prog_path mkudffs`"
-        export MKFS_BTRFS_PROG="`set_mkfs_prog_path_with_opts btrfs`"
-        export MKFS_F2FS_PROG="`set_mkfs_prog_path_with_opts f2fs`"

We should keep above two setups, set_mkfs_prog_path_with_opts does extra work than set_prog_path.

Quoted 69 lines
common/config +18 -12
-        export DUMP_F2FS_PROG="`set_prog_path dump.f2fs`"
-        export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
-        export BTRFS_SHOW_SUPER_PROG="`set_prog_path btrfs-show-super`"
-	export BTRFS_CONVERT_PROG="`set_prog_path btrfs-convert`"
-        export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
-        export MKFS_NFS_PROG="false"
-        export MKFS_CIFS_PROG="false"
-        export MKFS_OVERLAY_PROG="false"
-        export MKFS_REISER4_PROG="`set_prog_path mkfs.reiser4`"
-	export E2FSCK_PROG="`set_prog_path e2fsck`"
-	export TUNE2FS_PROG="`set_prog_path tune2fs`"
-	export FSCK_OVERLAY_PROG="`set_prog_path fsck.overlay`"
+	export MKFS_XFS_PROG=$(type -P mkfs.xfs)
+	export MKFS_EXT4_PROG=$(type -P mkfs.ext4)
+	export MKFS_UDF_PROG=$(type -P mkudffs)
+	export MKFS_BTRFS_PROG=$(type -P btrfs)
+	export MKFS_F2FS_PROG=$(type -P f2fs)
+	export DUMP_F2FS_PROG=$(type -P dump.f2fs)
+	export BTRFS_UTIL_PROG=$(type -P btrfs)
+	export BTRFS_SHOW_SUPER_PROG=$(type -P btrfs-show-super)
+	export BTRFS_CONVERT_PROG=$(type -P btrfs-convert)
+	export BTRFS_DEBUG_TREE_PROG=$(type -P btrfs-debug-tree)
+	export XFS_FSR_PROG=$(type -P xfs_fsr)
+	export MKFS_NFS_PROG="false"
+	export MKFS_CIFS_PROG="false"
+	export MKFS_OVERLAY_PROG="false"
+	export MKFS_REISER4_PROG=$(type -P mkfs.reiser4)
+	export E2FSCK_PROG=$(type -P e2fsck)
+	export TUNE2FS_PROG=$(type -P tune2fs)
+	export FSCK_OVERLAY_PROG=$(type -P fsck.overlay)
         ;;
 esac
 
common/dump +3 -3
index 7b9c10a25414..8a0ba1096d6a 100644
@@ -29,10 +29,10 @@ if [ -n "$DEBUGDUMP" ]; then
 
 	# Use dump/restore in qa directory (copy them here) for debugging
 	export PATH="$here:$PATH"
-	export __XFSDUMP_PROG="`set_prog_path xfsdump`"
+	export __XFSDUMP_PROG=$(type -P xfsdump)
 	export XFSDUMP_PROG="$__XFSDUMP_PROG -e"
-	export XFSRESTORE_PROG="`set_prog_path xfsrestore`"
-	export XFSINVUTIL_PROG="`set_prog_path xfsinvutil`"
+	export XFSRESTORE_PROG=$(type -P xfsrestore)
+	export XFSINVUTIL_PROG=$(type -P xfsinvutil)
 	[ -x $here/xfsdump ]    && echo "Using xfstests' xfsdump for debug"
 	[ -x $here/xfsrestore ] && echo "Using xfstests' xfsrestore for debug"
 	[ -x $here/xfsinvutil ] && echo "Using xfstests' xfsinvutil for debug"
tests/btrfs/085 +0 -2
index 804899724cba..a1edc28341da 100755
@@ -55,8 +55,6 @@ _supported_fs btrfs
 _supported_os Linux
 _require_scratch
 _require_dm_target flakey
-
-BTRFS_DEBUG_TREE_PROG="`set_prog_path btrfs-debug-tree`"
 _require_command "$BTRFS_DEBUG_TREE_PROG" btrfs-debug-tree
 
 rm -f $seqres.full
tests/xfs/446 +0 -0
index 752c6a7de827..ac74723f471f 100755

tests/xfs/446 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 · line 40

Quoted 4 lines
tests/xfs/446 +0 -1
@@ -37,7 +37,6 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs xfs
 _supported_os Linux
-export CHECKBASHISMS_PROG="`set_prog_path checkbashisms`"

This is removed but not added in common/config file.

I fixed both issues on commit.

Thanks,
Eryu

Quoted 10 lines
tests/xfs/446 +0 -0
 _require_command "$CHECKBASHISMS_PROG" checkbashisms
 
 test -z "$WORKAREA" && _notrun "Can't find xfsprogs source"
Signature · 6 lines
2.13.6

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#4 lore raw
Quoted 22 lines · Eryu Guan

common/config export UDEV_SETTLE_PROG · line 235

Quoted 5 lines · Jan Kara
common/config +0 -5
-        export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
-        export MKFS_EXT4_PROG="`set_prog_path mkfs.ext4`"
-        export MKFS_UDF_PROG="`set_prog_path mkudffs`"
-        export MKFS_BTRFS_PROG="`set_mkfs_prog_path_with_opts btrfs`"
-        export MKFS_F2FS_PROG="`set_mkfs_prog_path_with_opts f2fs`"

We should keep above two setups, set_mkfs_prog_path_with_opts does extra work than set_prog_path.

tests/xfs/446 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 · line 40

Quoted 9 lines
tests/xfs/446 +0 -1
index 752c6a7de827..ac74723f471f 100755
@@ -37,7 +37,6 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs xfs
 _supported_os Linux
-export CHECKBASHISMS_PROG="`set_prog_path checkbashisms`"

This is removed but not added in common/config file.

Quoted 1 line

I fixed both issues on commit.

Good spottings. Thanks for fixing them up!

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR