Blob Blame History Raw
From 748fbfa9b1bb3b64b3fbc6b1e51d260d8376c791 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 4 Mar 2019 17:10:04 +0100
Subject: [PATCH 16/19] tests: add --use-system-commands

This change allows to use commands from $PATH rather than from
$top_builddir. There two basic use cases:

* check differences between installed and git version
  run.sh --use-system-command --show-diff

* check system binaries by upstream tests (for example tests from
  src.rpm package)

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1681062
Upstream: http://github.com/karelzak/util-linux/commit/43b4a4d3c720a4e65fe9de884cd73e0b1b94fbe
Signed-off-by: Karel Zak <kzak@redhat.com>
---
 tests/commands.sh  | 194 ++++++++++++++++++++++-----------------------
 tests/functions.sh |  34 ++++++--
 tests/run.sh       |  33 +++++---
 3 files changed, 146 insertions(+), 115 deletions(-)

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