NetBSD/tests/lib/libcurses/debug_test

99 lines
2.1 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"
#
# Force localisation to UTF-8 to be consistent with atf runs
#
export LC_ALL=en_US.UTF-8
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 " -g : Enable check file generation if the file does not exists"
echo " -f : Forces check file generation if -g flag is set"
echo
}
# This is needed for getwin/putwin test case and /tmp can be used for any file
# related tests.
#rm -rf /tmp/*
#
#ARGS="-T ${BASEDIR} -I ${INCLUDE_PATH} -C ${CHECK_PATH}"
ARGS="-T ${BASEDIR} -C ${CHECK_PATH}"
#
while getopts cf:F:L:s:vg 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 ${ARGS}"
;;
g)
ARGS="-g ${ARGS}"
;;
f)
ARGS="-f ${ARGS}"
;;
\?)
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"