summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh34
1 files changed, 29 insertions, 5 deletions
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"