NetBSD/tests/lib/libcurses/debug_test
blymn 84da1bf133 Add option to specify an alternate library location to allow testing
a development library version without installing it.
2019-05-19 22:34:23 +00:00

80 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
#
#
BASEDIR="/usr/tests/lib/libcurses"
CHECK_PATH="${BASEDIR}/check_files/"
export CHECK_PATH
INCLUDE_PATH="${BASEDIR}/tests/"
export INCLUDE_PATH
#
CURSES_TRACE_FILE="/tmp/ctrace"
SLAVE="${BASEDIR}/slave"
usage() {
echo "Set up the environment to run the test frame. Option flags:"
echo
echo " -c : Set up curses tracing, assumes the curses lib has been built with"
echo " debug enabled. Default trace mask traces input, can be overridden"
echo " by setting the trace mask in the environment before calling the"
echo " The trace file output goes to /tmp/ctrace"
echo " script."
echo " -f : Specify the file name for curses tracing the default is"
echo " ${CURSES_TRACE_FILE}"
echo " -L : Add the argument as a prefix to LD_LIBRARY_PATH to"
echo " use an alternate libcurses version"
echo " -s : Specify the slave command. Defaults to \"../slave/slave\""
echo " -v : Enable verbose output"
echo
}
#
ARGS=""
#
while getopts cf:L:s:v opt
do
case "${opt}" in
c)
if [ "X$CURSES_TRACE_MASK" = "X" ]; then
CURSES_TRACE_MASK=0x00000082
fi
export CURSES_TRACE_FILE
export CURSES_TRACE_MASK
;;
f)
CURSES_TRACE_FILE=${OPTARG}
;;
L)
LD_LIBRARY_PATH=${OPTARG}:${LD_LIBRARY_PATH}
;;
s)
SLAVE=${OPTARG}
;;
v)
ARGS="-v"
;;
\?)
usage
exit 1
;;
esac
done
#
shift $((OPTIND - 1))
#
if [ -z "${1}" ]
then
echo
echo "A test name needs to be specified."
echo
usage
echo
exit 1
fi
#
exec ${BASEDIR}/director ${ARGS} -s ${SLAVE} "${INCLUDE_PATH}/$1"