From f8114823504b4888a3308f078504c3fbf32b5d87 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Fri, 26 Jun 2020 12:19:06 +0200 Subject: [PATCH] bin/shtests wrapper: export INSTALLROOT when using other ksh When specifying another ksh to test using e.g. KSH=/bin/ksh to test the system's stock ksh, the pty command was not found because it resides in the arch/*/bin directory. The main shtests script bases its $PATH on $INSTALLROOT, but does not set INSTALLROOT itself if the shell to test is outside the installation hierarchy. Setting it would allow the pty.sh regresssion tests to run on a shell specified on the command line. bin/shtests: - Set and export INSTALLROOT to our default installation hierarchy if it wasn't already set on entry. --- bin/shtests | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/shtests b/bin/shtests index 03bf8ab6b..3755f18dc 100755 --- a/bin/shtests +++ b/bin/shtests @@ -27,11 +27,11 @@ mydir=$(dirname "$0") \ && mydir=$(CDPATH='' cd -P -- "$mydir/.." && printf '%sX' "$PWD") \ && mydir=${mydir%X} \ || exit +myarch=$("$mydir/bin/package" host type) || exit # Check if there is a ksh to test. case ${KSH+set} in -( '' ) myarch=$("$mydir/bin/package" host) || exit - KSH=$mydir/arch/$myarch/bin/ksh ;; +( '' ) KSH=$mydir/arch/$myarch/bin/ksh ;; esac if ! test -x "$KSH" || ! test -f "$KSH"; then printf '%s: shell not found: %s\n' "${0##*/}" "$KSH" >&2 @@ -47,7 +47,8 @@ KSH=$(CDPATH='' cd -P -- "$(dirname "$KSH")" \ # Run the test suite CDPATH='' cd -P -- "$mydir/src/cmd/ksh93/tests" || exit SHELL=$KSH -export SHELL +INSTALLROOT=${INSTALLROOT:-$mydir/arch/$myarch} +export SHELL INSTALLROOT unset -v KSH printf '#### Regression-testing %s ####\n' "$SHELL" exec "$SHELL" shtests "$@"