cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0016-tests-add-use-system-commands.patch

069435
From 748fbfa9b1bb3b64b3fbc6b1e51d260d8376c791 Mon Sep 17 00:00:00 2001
069435
From: Karel Zak <kzak@redhat.com>
069435
Date: Mon, 4 Mar 2019 17:10:04 +0100
069435
Subject: [PATCH 16/19] tests: add --use-system-commands
069435
069435
This change allows to use commands from $PATH rather than from
069435
$top_builddir. There two basic use cases:
069435
069435
* check differences between installed and git version
069435
  run.sh --use-system-command --show-diff
069435
069435
* check system binaries by upstream tests (for example tests from
069435
  src.rpm package)
069435
069435
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1681062
069435
Upstream: http://github.com/karelzak/util-linux/commit/43b4a4d3c720a4e65fe9de884cd73e0b1b94fbe
069435
Signed-off-by: Karel Zak <kzak@redhat.com>
069435
---
069435
 tests/commands.sh  | 194 ++++++++++++++++++++++-----------------------
069435
 tests/functions.sh |  34 ++++++--
069435
 tests/run.sh       |  33 +++++---
069435
 3 files changed, 146 insertions(+), 115 deletions(-)
069435
069435
diff --git a/tests/commands.sh b/tests/commands.sh
069435
index 1be2d25b4..93100caf6 100644
069435
--- a/tests/commands.sh
069435
+++ b/tests/commands.sh
069435
@@ -2,105 +2,105 @@
069435
 TS_TESTUSER=${TS_TESTUSER:-"nobody"}
069435
 
069435
 # helpers
069435
-TS_HELPER_BYTESWAP="$top_builddir/test_byteswap"
069435
-TS_HELPER_CPUSET="$top_builddir/test_cpuset"
069435
-TS_HELPER_DMESG="$top_builddir/test_dmesg"
069435
-TS_HELPER_ISLOCAL="$top_builddir/test_islocal"
069435
-TS_HELPER_ISMOUNTED="$top_builddir/test_ismounted"
069435
-TS_HELPER_LIBFDISK_GPT="$top_builddir/test_fdisk_gpt"
069435
-TS_HELPER_LIBFDISK_MKPART="$top_builddir/sample-fdisk-mkpart"
069435
-TS_HELPER_LIBMOUNT_CONTEXT="$top_builddir/test_mount_context"
069435
-TS_HELPER_LIBFDISK_MKPART_FULLSPEC="$top_builddir/sample-fdisk-mkpart-fullspec"
069435
-TS_HELPER_LIBMOUNT_LOCK="$top_builddir/test_mount_lock"
069435
-TS_HELPER_LIBMOUNT_OPTSTR="$top_builddir/test_mount_optstr"
069435
-TS_HELPER_LIBMOUNT_TABDIFF="$top_builddir/test_mount_tab_diff"
069435
-TS_HELPER_LIBMOUNT_TAB="$top_builddir/test_mount_tab"
069435
-TS_HELPER_LIBMOUNT_UPDATE="$top_builddir/test_mount_tab_update"
069435
-TS_HELPER_LIBMOUNT_UTILS="$top_builddir/test_mount_utils"
069435
-TS_HELPER_LIBMOUNT_DEBUG="$top_builddir/test_mount_debug"
069435
-TS_HELPER_LIBSMARTCOLS_FROMFILE="$top_builddir/sample-scols-fromfile"
069435
-TS_HELPER_LIBSMARTCOLS_TITLE="$top_builddir/sample-scols-title"
069435
+TS_HELPER_BYTESWAP="${ts_helpersdir}test_byteswap"
069435
+TS_HELPER_CPUSET="${ts_helpersdir}test_cpuset"
069435
+TS_HELPER_DMESG="${ts_helpersdir}test_dmesg"
069435
+TS_HELPER_ISLOCAL="${ts_helpersdir}test_islocal"
069435
+TS_HELPER_ISMOUNTED="${ts_helpersdir}test_ismounted"
069435
+TS_HELPER_LIBFDISK_GPT="${ts_helpersdir}test_fdisk_gpt"
069435
+TS_HELPER_LIBFDISK_MKPART="${ts_helpersdir}sample-fdisk-mkpart"
069435
+TS_HELPER_LIBMOUNT_CONTEXT="${ts_helpersdir}test_mount_context"
069435
+TS_HELPER_LIBFDISK_MKPART_FULLSPEC="${ts_helpersdir}sample-fdisk-mkpart-fullspec"
069435
+TS_HELPER_LIBMOUNT_LOCK="${ts_helpersdir}test_mount_lock"
069435
+TS_HELPER_LIBMOUNT_OPTSTR="${ts_helpersdir}test_mount_optstr"
069435
+TS_HELPER_LIBMOUNT_TABDIFF="${ts_helpersdir}test_mount_tab_diff"
069435
+TS_HELPER_LIBMOUNT_TAB="${ts_helpersdir}test_mount_tab"
069435
+TS_HELPER_LIBMOUNT_UPDATE="${ts_helpersdir}test_mount_tab_update"
069435
+TS_HELPER_LIBMOUNT_UTILS="${ts_helpersdir}test_mount_utils"
069435
+TS_HELPER_LIBMOUNT_DEBUG="${ts_helpersdir}test_mount_debug"
069435
+TS_HELPER_LIBSMARTCOLS_FROMFILE="${ts_helpersdir}sample-scols-fromfile"
069435
+TS_HELPER_LIBSMARTCOLS_TITLE="${ts_helpersdir}sample-scols-title"
069435
 TS_HELPER_PYLIBMOUNT_CONTEXT="$top_srcdir/libmount/python/test_mount_context.py"
069435
 TS_HELPER_PYLIBMOUNT_TAB="$top_srcdir/libmount/python/test_mount_tab.py"
069435
 TS_HELPER_PYLIBMOUNT_UPDATE="$top_srcdir/libmount/python/test_mount_tab_update.py"
069435
-TS_HELPER_LOGGER="$top_builddir/test_logger"
069435
-TS_HELPER_LOGINDEFS="$top_builddir/test_logindefs"
069435
-TS_HELPER_MD5="$top_builddir/test_md5"
069435
-TS_HELPER_SHA1="$top_builddir/test_sha1"
069435
-TS_HELPER_MKFS_MINIX="$top_builddir/test_mkfs_minix"
069435
-TS_HELPER_MORE=${TS_HELPER_MORE-"$top_builddir/test_more"}
069435
-TS_HELPER_PARTITIONS="$top_builddir/sample-partitions"
069435
-TS_HELPER_PATHS="$top_builddir/test_pathnames"
069435
-TS_HELPER_SCRIPT="$top_builddir/test_script"
069435
-TS_HELPER_SIGRECEIVE="$top_builddir/test_sigreceive"
069435
-TS_HELPER_STRUTILS="$top_builddir/test_strutils"
069435
-TS_HELPER_SYSINFO="$top_builddir/test_sysinfo"
069435
-TS_HELPER_TIOCSTI="$top_builddir/test_tiocsti"
069435
-TS_HELPER_UUID_PARSER="$top_builddir/test_uuid_parser"
069435
-TS_HELPER_UUID_NAMESPACE="$top_builddir/test_uuid_namespace"
069435
-TS_HELPER_MBSENCODE="$top_builddir/test_mbsencode"
069435
-TS_HELPER_CAL="$top_builddir/test_cal"
069435
+TS_HELPER_LOGGER="${ts_helpersdir}test_logger"
069435
+TS_HELPER_LOGINDEFS="${ts_helpersdir}test_logindefs"
069435
+TS_HELPER_MD5="${ts_helpersdir}test_md5"
069435
+TS_HELPER_SHA1="${ts_helpersdir}test_sha1"
069435
+TS_HELPER_MKFS_MINIX="${ts_helpersdir}test_mkfs_minix"
069435
+TS_HELPER_MORE=${TS_HELPER_MORE-"${ts_helpersdir}test_more"}
069435
+TS_HELPER_PARTITIONS="${ts_helpersdir}sample-partitions"
069435
+TS_HELPER_PATHS="${ts_helpersdir}test_pathnames"
069435
+TS_HELPER_SCRIPT="${ts_helpersdir}test_script"
069435
+TS_HELPER_SIGRECEIVE="${ts_helpersdir}test_sigreceive"
069435
+TS_HELPER_STRUTILS="${ts_helpersdir}test_strutils"
069435
+TS_HELPER_SYSINFO="${ts_helpersdir}test_sysinfo"
069435
+TS_HELPER_TIOCSTI="${ts_helpersdir}test_tiocsti"
069435
+TS_HELPER_UUID_PARSER="${ts_helpersdir}test_uuid_parser"
069435
+TS_HELPER_UUID_NAMESPACE="${ts_helpersdir}test_uuid_namespace"
069435
+TS_HELPER_MBSENCODE="${ts_helpersdir}test_mbsencode"
069435
+TS_HELPER_CAL="${ts_helpersdir}test_cal"
069435
 
069435
 # paths to commands
069435
-TS_CMD_ADDPART=${TS_CMD_ADDPART:-"$top_builddir/addpart"}
069435
-TS_CMD_DELPART=${TS_CMD_DELPART:-"$top_builddir/delpart"}
069435
-TS_CMD_BLKDISCARD=${TS_CMD_BLKID-"$top_builddir/blkdiscard"}
069435
-TS_CMD_BLKID=${TS_CMD_BLKID-"$top_builddir/blkid"}
069435
-TS_CMD_CAL=${TS_CMD_CAL-"$top_builddir/cal"}
069435
-TS_CMD_COLCRT=${TS_CMD_COLCRT:-"$top_builddir/colcrt"}
069435
-TS_CMD_COLRM=${TS_CMD_COLRM:-"$top_builddir/colrm"}
069435
-TS_CMD_COL=${TS_CMD_COL:-"$top_builddir/col"}
069435
-TS_CMD_COLUMN=${TS_CMD_COLUMN:-"$top_builddir/column"}
069435
-TS_CMD_EJECT=${TS_CMD_EJECT-"$top_builddir/eject"}
069435
-TS_CMD_FALLOCATE=${TS_CMD_FALLOCATE-"$top_builddir/fallocate"}
069435
-TS_CMD_FDISK=${TS_CMD_FDISK-"$top_builddir/fdisk"}
069435
-TS_CMD_FLOCK=${TS_CMD_FLOCK-"$top_builddir/flock"}
069435
-TS_CMD_SFDISK=${TS_CMD_SFDISK-"$top_builddir/sfdisk"}
069435
-TS_CMD_FINCORE=${TS_CMD_FINCORE-"$top_builddir/fincore"}
069435
-TS_CMD_FINDMNT=${TS_CMD_FINDMNT-"$top_builddir/findmnt"}
069435
-TS_CMD_FSCKCRAMFS=${TS_CMD_FSCKCRAMFS:-"$top_builddir/fsck.cramfs"}
069435
-TS_CMD_FSCKMINIX=${TS_CMD_FSCKMINIX:-"$top_builddir/fsck.minix"}
069435
-TS_CMD_GETOPT=${TS_CMD_GETOPT-"$top_builddir/getopt"}
069435
-TS_CMD_HEXDUMP=${TS_CMD_HEXDUMP-"$top_builddir/hexdump"}
069435
-TS_CMD_HWCLOCK=${TS_CMD_HWCLOCK-"$top_builddir/hwclock"}
069435
-TS_CMD_IONICE=${TS_CMD_IONICE-"$top_builddir/ionice"}
069435
-TS_CMD_IPCMK=${TS_CMD_IPCMK-"$top_builddir/ipcmk"}
069435
-TS_CMD_IPCRM=${TS_CMD_IPCRM-"$top_builddir/ipcrm"}
069435
-TS_CMD_IPCS=${TS_CMD_IPCS:-"$top_builddir/ipcs"}
069435
-TS_CMD_ISOSIZE=${TS_CMD_ISOSIZE-"$top_builddir/isosize"}
069435
-TS_CMD_KILL=${TS_CMD_KILL-"$top_builddir/kill"}
069435
-TS_CMD_LAST=${TS_CMD_LAST-"$top_builddir/last"}
069435
-TS_CMD_LINE=${TS_CMD_LINE-"$top_builddir/line"}
069435
-TS_CMD_LOOK=${TS_CMD_LOOK-"$top_builddir/look"}
069435
-TS_CMD_LOSETUP=${TS_CMD_LOSETUP:-"$top_builddir/losetup"}
069435
-TS_CMD_LSBLK=${TS_CMD_LSBLK-"$top_builddir/lsblk"}
069435
-TS_CMD_LSCPU=${TS_CMD_LSCPU-"$top_builddir/lscpu"}
069435
-TS_CMD_LSMEM=${TS_CMD_LSMEM-"$top_builddir/lsmem"}
069435
-TS_CMD_LSNS=${TS_CMD_LSNS-"$top_builddir/lsns"}
069435
-TS_CMD_MCOOKIE=${TS_CMD_MCOOKIE-"$top_builddir/mcookie"}
069435
-TS_CMD_MKCRAMFS=${TS_CMD_MKCRAMFS:-"$top_builddir/mkfs.cramfs"}
069435
-TS_CMD_MKMINIX=${TS_CMD_MKMINIX:-"$top_builddir/mkfs.minix"}
069435
-TS_CMD_MKSWAP=${TS_CMD_MKSWAP:-"$top_builddir/mkswap"}
069435
-TS_CMD_MOUNT=${TS_CMD_MOUNT:-"$top_builddir/mount"}
069435
-TS_CMD_MOUNTPOINT=${TS_CMD_MOUNTPOINT:-"$top_builddir/mountpoint"}
069435
-TS_CMD_NAMEI=${TS_CMD_NAMEI-"$top_builddir/namei"}
069435
-TS_CMD_PARTX=${TS_CMD_PARTX-"$top_builddir/partx"}
069435
-TS_CMD_RENAME=${TS_CMD_RENAME-"$top_builddir/rename"}
069435
-TS_CMD_RUNUSER=${TS_CMD_RUNUSER-"$top_builddir/runuser"}
069435
-TS_CMD_REV=${TS_CMD_REV:-"$top_builddir/rev"}
069435
-TS_CMD_SCRIPT=${TS_CMD_SCRIPT-"$top_builddir/script"}
069435
-TS_CMD_SCRIPTREPLAY=${TS_CMD_SCRIPTREPLAY-"$top_builddir/scriptreplay"}
069435
-TS_CMD_SETARCH=${TS_CMD_SETARCH-"$top_builddir/setarch"}
069435
-TS_CMD_SETSID=${TS_CMD_SETSID-"$top_builddir/setsid"}
069435
-TS_CMD_SWAPLABEL=${TS_CMD_SWAPLABEL:-"$top_builddir/swaplabel"}
069435
-TS_CMD_SWAPOFF=${TS_CMD_SWAPOFF:-"$top_builddir/swapoff"}
069435
-TS_CMD_SWAPON=${TS_CMD_SWAPON:-"$top_builddir/swapon"}
069435
-TS_CMD_UL=${TS_CMD_UL-"$top_builddir/ul"}
069435
-TS_CMD_UMOUNT=${TS_CMD_UMOUNT:-"$top_builddir/umount"}
069435
-TS_CMD_UTMPDUMP=${TS_CMD_UTMPDUMP-"$top_builddir/utmpdump"}
069435
-TS_CMD_UUIDD=${TS_CMD_UUIDD-"$top_builddir/uuidd"}
069435
-TS_CMD_UUIDGEN=${TS_CMD_UUIDGEN-"$top_builddir/uuidgen"}
069435
-TS_CMD_UUIDPARSE=${TS_CMD_UUIDPARSE-"$top_builddir/uuidparse"}
069435
-TS_CMD_WHEREIS=${TS_CMD_WHEREIS-"$top_builddir/whereis"}
069435
-TS_CMD_WIPEFS=${TS_CMD_WIPEFS-"$top_builddir/wipefs"}
069435
-TS_CMD_CHRT=${TS_CMD_CHRT-"$top_builddir/chrt"}
069435
+TS_CMD_ADDPART=${TS_CMD_ADDPART:-"${ts_commandsdir}addpart"}
069435
+TS_CMD_DELPART=${TS_CMD_DELPART:-"${ts_commandsdir}delpart"}
069435
+TS_CMD_BLKDISCARD=${TS_CMD_BLKID-"${ts_commandsdir}blkdiscard"}
069435
+TS_CMD_BLKID=${TS_CMD_BLKID-"${ts_commandsdir}blkid"}
069435
+TS_CMD_CAL=${TS_CMD_CAL-"${ts_commandsdir}cal"}
069435
+TS_CMD_COLCRT=${TS_CMD_COLCRT:-"${ts_commandsdir}colcrt"}
069435
+TS_CMD_COLRM=${TS_CMD_COLRM:-"${ts_commandsdir}colrm"}
069435
+TS_CMD_COL=${TS_CMD_COL:-"${ts_commandsdir}col"}
069435
+TS_CMD_COLUMN=${TS_CMD_COLUMN:-"${ts_commandsdir}column"}
069435
+TS_CMD_EJECT=${TS_CMD_EJECT-"${ts_commandsdir}eject"}
069435
+TS_CMD_FALLOCATE=${TS_CMD_FALLOCATE-"${ts_commandsdir}fallocate"}
069435
+TS_CMD_FDISK=${TS_CMD_FDISK-"${ts_commandsdir}fdisk"}
069435
+TS_CMD_FLOCK=${TS_CMD_FLOCK-"${ts_commandsdir}flock"}
069435
+TS_CMD_SFDISK=${TS_CMD_SFDISK-"${ts_commandsdir}sfdisk"}
069435
+TS_CMD_FINCORE=${TS_CMD_FINCORE-"${ts_commandsdir}fincore"}
069435
+TS_CMD_FINDMNT=${TS_CMD_FINDMNT-"${ts_commandsdir}findmnt"}
069435
+TS_CMD_FSCKCRAMFS=${TS_CMD_FSCKCRAMFS:-"${ts_commandsdir}fsck.cramfs"}
069435
+TS_CMD_FSCKMINIX=${TS_CMD_FSCKMINIX:-"${ts_commandsdir}fsck.minix"}
069435
+TS_CMD_GETOPT=${TS_CMD_GETOPT-"${ts_commandsdir}getopt"}
069435
+TS_CMD_HEXDUMP=${TS_CMD_HEXDUMP-"${ts_commandsdir}hexdump"}
069435
+TS_CMD_HWCLOCK=${TS_CMD_HWCLOCK-"${ts_commandsdir}hwclock"}
069435
+TS_CMD_IONICE=${TS_CMD_IONICE-"${ts_commandsdir}ionice"}
069435
+TS_CMD_IPCMK=${TS_CMD_IPCMK-"${ts_commandsdir}ipcmk"}
069435
+TS_CMD_IPCRM=${TS_CMD_IPCRM-"${ts_commandsdir}ipcrm"}
069435
+TS_CMD_IPCS=${TS_CMD_IPCS:-"${ts_commandsdir}ipcs"}
069435
+TS_CMD_ISOSIZE=${TS_CMD_ISOSIZE-"${ts_commandsdir}isosize"}
069435
+TS_CMD_KILL=${TS_CMD_KILL-"${ts_commandsdir}kill"}
069435
+TS_CMD_LAST=${TS_CMD_LAST-"${ts_commandsdir}last"}
069435
+TS_CMD_LINE=${TS_CMD_LINE-"${ts_commandsdir}line"}
069435
+TS_CMD_LOOK=${TS_CMD_LOOK-"${ts_commandsdir}look"}
069435
+TS_CMD_LOSETUP=${TS_CMD_LOSETUP:-"${ts_commandsdir}losetup"}
069435
+TS_CMD_LSBLK=${TS_CMD_LSBLK-"${ts_commandsdir}lsblk"}
069435
+TS_CMD_LSCPU=${TS_CMD_LSCPU-"${ts_commandsdir}lscpu"}
069435
+TS_CMD_LSMEM=${TS_CMD_LSMEM-"${ts_commandsdir}lsmem"}
069435
+TS_CMD_LSNS=${TS_CMD_LSNS-"${ts_commandsdir}lsns"}
069435
+TS_CMD_MCOOKIE=${TS_CMD_MCOOKIE-"${ts_commandsdir}mcookie"}
069435
+TS_CMD_MKCRAMFS=${TS_CMD_MKCRAMFS:-"${ts_commandsdir}mkfs.cramfs"}
069435
+TS_CMD_MKMINIX=${TS_CMD_MKMINIX:-"${ts_commandsdir}mkfs.minix"}
069435
+TS_CMD_MKSWAP=${TS_CMD_MKSWAP:-"${ts_commandsdir}mkswap"}
069435
+TS_CMD_MOUNT=${TS_CMD_MOUNT:-"${ts_commandsdir}mount"}
069435
+TS_CMD_MOUNTPOINT=${TS_CMD_MOUNTPOINT:-"${ts_commandsdir}mountpoint"}
069435
+TS_CMD_NAMEI=${TS_CMD_NAMEI-"${ts_commandsdir}namei"}
069435
+TS_CMD_PARTX=${TS_CMD_PARTX-"${ts_commandsdir}partx"}
069435
+TS_CMD_RENAME=${TS_CMD_RENAME-"${ts_commandsdir}rename"}
069435
+TS_CMD_RUNUSER=${TS_CMD_RUNUSER-"${ts_commandsdir}runuser"}
069435
+TS_CMD_REV=${TS_CMD_REV:-"${ts_commandsdir}rev"}
069435
+TS_CMD_SCRIPT=${TS_CMD_SCRIPT-"${ts_commandsdir}script"}
069435
+TS_CMD_SCRIPTREPLAY=${TS_CMD_SCRIPTREPLAY-"${ts_commandsdir}scriptreplay"}
069435
+TS_CMD_SETARCH=${TS_CMD_SETARCH-"${ts_commandsdir}setarch"}
069435
+TS_CMD_SETSID=${TS_CMD_SETSID-"${ts_commandsdir}setsid"}
069435
+TS_CMD_SWAPLABEL=${TS_CMD_SWAPLABEL:-"${ts_commandsdir}swaplabel"}
069435
+TS_CMD_SWAPOFF=${TS_CMD_SWAPOFF:-"${ts_commandsdir}swapoff"}
069435
+TS_CMD_SWAPON=${TS_CMD_SWAPON:-"${ts_commandsdir}swapon"}
069435
+TS_CMD_UL=${TS_CMD_UL-"${ts_commandsdir}ul"}
069435
+TS_CMD_UMOUNT=${TS_CMD_UMOUNT:-"${ts_commandsdir}umount"}
069435
+TS_CMD_UTMPDUMP=${TS_CMD_UTMPDUMP-"${ts_commandsdir}utmpdump"}
069435
+TS_CMD_UUIDD=${TS_CMD_UUIDD-"${ts_commandsdir}uuidd"}
069435
+TS_CMD_UUIDGEN=${TS_CMD_UUIDGEN-"${ts_commandsdir}uuidgen"}
069435
+TS_CMD_UUIDPARSE=${TS_CMD_UUIDPARSE-"${ts_commandsdir}uuidparse"}
069435
+TS_CMD_WHEREIS=${TS_CMD_WHEREIS-"${ts_commandsdir}whereis"}
069435
+TS_CMD_WIPEFS=${TS_CMD_WIPEFS-"${ts_commandsdir}wipefs"}
069435
+TS_CMD_CHRT=${TS_CMD_CHRT-"${ts_commandsdir}chrt"}
069435
diff --git a/tests/functions.sh b/tests/functions.sh
069435
index 2fb0ddb5f..ab607c4ce 100644
069435
--- a/tests/functions.sh
069435
+++ b/tests/functions.sh
069435
@@ -75,9 +75,19 @@ function ts_report {
069435
 }
069435
 
069435
 function ts_check_test_command {
069435
-	if [ ! -x "$1" ]; then
069435
-		ts_skip "${1##*/} not found"
069435
-	fi
069435
+	case "$1" in
069435
+	*/*)
069435
+		# paths
069435
+		if [ ! -x "$1" ]; then
069435
+			ts_skip "${1##*/} not found"
069435
+		fi
069435
+		;;
069435
+	*)
069435
+		# just command names (e.g. --use-system-commands)
069435
+		local cmd=$1
069435
+		type "$cmd" >/dev/null 2>&1 || ts_skip "missing in PATH: $cmd"
069435
+		;;
069435
+	esac
069435
 }
069435
 
069435
 function ts_check_prog {
069435
@@ -254,8 +264,20 @@ function ts_init_env {
069435
 	top_srcdir=$(ts_abspath $top_srcdir)
069435
 	top_builddir=$(ts_abspath $top_builddir)
069435
 
069435
-	# some ul commands search other ul commands in $PATH
069435
-	export PATH="$top_builddir:$PATH"
069435
+	# We use helpser always from build tree
069435
+	ts_helpersdir="${top_builddir}/"
069435
+
069435
+	TS_USE_SYSTEM_COMMANDS=$(ts_has_option "use-system-commands" "$*")
069435
+	if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
069435
+		# Don't define anything, just follow current PATH
069435
+		ts_commandsdir=""
069435
+	else
069435
+		# The default is to use commands from build tree
069435
+		ts_commandsdir="${top_builddir}/"
069435
+
069435
+		# some ul commands search other ul commands in $PATH
069435
+		export PATH="$ts_commandsdir:$PATH"
069435
+	fi
069435
 
069435
 	TS_SCRIPT="$mydir/$(basename $0)"
069435
 	TS_SUBDIR=$(dirname $TS_SCRIPT)
069435
@@ -319,6 +341,8 @@ function ts_init_env {
069435
 	if [ "$TS_VERBOSE" == "yes" ]; then
069435
 		echo
069435
 		echo "     script: $TS_SCRIPT"
069435
+		echo "   commands: $ts_commandsdir"
069435
+		echo "    helpers: $ts_helpersdir"
069435
 		echo "    sub dir: $TS_SUBDIR"
069435
 		echo "    top dir: $TS_TOPDIR"
069435
 		echo "       self: $TS_SELF"
069435
diff --git a/tests/run.sh b/tests/run.sh
069435
index f40c9f801..28f8ee25a 100755
069435
--- a/tests/run.sh
069435
+++ b/tests/run.sh
069435
@@ -20,6 +20,7 @@ TS_TOPDIR=$(cd ${0%/*} && pwd)
069435
 SUBTESTS=
069435
 EXCLUDETESTS=
069435
 OPTS=
069435
+SYSCOMMANDS=
069435
 
069435
 top_srcdir=
069435
 top_builddir=
069435
@@ -68,6 +69,11 @@ while [ -n "$1" ]; do
069435
 		# these options are simply forwarded to the test scripts
069435
 		OPTS="$OPTS $1"
069435
 		;;
069435
+	--use-system-commands)
069435
+		OPTS="$OPTS $1"
069435
+		SYSCOMMANDS="yes"
069435
+		;;
069435
+
069435
 	--nonroot)
069435
 		if [ $(id -ru) -eq 0 ]; then
069435
 			echo "Ignore util-linux test suite [non-root UID expected]."
069435
@@ -98,18 +104,19 @@ while [ -n "$1" ]; do
069435
 		echo "Usage: "
069435
 		echo "  $(basename $0) [options] [<component> ...]"
069435
 		echo "Options:"
069435
-		echo "  --force              execute demanding tests"
069435
-		echo "  --fake               do not run, setup tests only"
069435
-		echo "  --memcheck-valgrind  run with valgrind"
069435
-		echo "  --memcheck-asan      enable ASAN (requires ./configure --enable-asan)"
069435
-		echo "  --nolocks            don't use flock to lock resources"
069435
-		echo "  --verbose            verbose mode"
069435
-		echo "  --show-diff          show diff from failed tests"
069435
-		echo "  --nonroot            ignore test suite if user is root"
069435
-		echo "  --srcdir=<path>      autotools top source directory"
069435
-		echo "  --builddir=<path>    autotools top build directory"
069435
-		echo "  --parallel=<num>     number of parallel test jobs, default: num cpus"
069435
-		echo "  --exclude=<list>     exclude tests by list '<utilname>/<testname> ..'"
069435
+		echo "  --force               execute demanding tests"
069435
+		echo "  --fake                do not run, setup tests only"
069435
+		echo "  --memcheck-valgrind   run with valgrind"
069435
+		echo "  --memcheck-asan       enable ASAN (requires ./configure --enable-asan)"
069435
+		echo "  --nolocks             don't use flock to lock resources"
069435
+		echo "  --verbose             verbose mode"
069435
+		echo "  --show-diff           show diff from failed tests"
069435
+		echo "  --nonroot             ignore test suite if user is root"
069435
+		echo "  --use-system-commands use PATH rather than builddir"
069435
+		echo "  --srcdir=<path>       autotools top source directory"
069435
+		echo "  --builddir=<path>     autotools top build directory"
069435
+		echo "  --parallel=<num>      number of parallel test jobs, default: num cpus"
069435
+		echo "  --exclude=<list>      exclude tests by list '<utilname>/<testname> ..'"
069435
 		echo
069435
 		exit 1
069435
 		;;
069435
@@ -148,7 +155,7 @@ if [ -n "$SUBTESTS" ]; then
069435
 		fi
069435
 	done
069435
 else
069435
-	if [ ! -f "$top_builddir/test_ttyutils" ]; then
069435
+	if [ -z "$SYSCOMMANDS" -a ! -f "$top_builddir/test_ttyutils" ]; then
069435
 		echo "Tests not compiled! Run 'make check' to fix the problem."
069435
 		exit 1
069435
 	fi
069435
-- 
069435
2.20.1
069435