41 lines
1.2 KiB
Bash
Executable File
41 lines
1.2 KiB
Bash
Executable File
#! /bin/sh
|
|
# Wrapper script to run the ksh93 regression tests without requiring nmake.
|
|
# By Martijn Dekker <martijn@inlv.org> 2020-05-14
|
|
# Public domain. http://creativecommons.org/publicdomain/zero/1.0/
|
|
#
|
|
# The manual: bin/shtests --man
|
|
# Brief help: bin/shtests --help
|
|
#
|
|
# By default, this runs your compiled arch/*/bin/ksh.
|
|
# To use another ksh, run: KSH=path/to/ksh bin/shtests
|
|
|
|
# Find root dir of ksh source
|
|
mydir=$(dirname "$0") \
|
|
&& mydir=$(CDPATH='' cd -P -- "$mydir/.." && printf '%sX' "$PWD") \
|
|
&& mydir=${mydir%X} \
|
|
|| 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 ;;
|
|
esac
|
|
if ! test -x "$KSH" || ! test -f "$KSH"; then
|
|
printf '%s: shell not found: %s\n' "${0##*/}" "$KSH" >&2
|
|
printf 'Specify a shell like: KSH=path/to/ksh bin/shtests\n' >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Ensure absolute path to ksh
|
|
KSH=$(CDPATH='' cd -P -- "$(dirname "$KSH")" \
|
|
&& printf '%s/%sX' "$PWD" "${KSH##*/}") \
|
|
&& KSH=${KSH%X}
|
|
|
|
# Run the test suite
|
|
CDPATH='' cd -P -- "$mydir/src/cmd/ksh93/tests" || exit
|
|
SHELL=$KSH
|
|
export SHELL
|
|
unset -v KSH
|
|
printf '#### Regression-testing %s ####\n' "$SHELL"
|
|
exec "$SHELL" shtests "$@"
|