dcavalca / rpms / util-linux

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