xref: /netbsd-src/tests/lib/libcurses/debug_test (revision 181254a7b1bdde6873432bffef2d2decc4b5c22f)
1#!/bin/sh
2#
3#
4BASEDIR="/usr/tests/lib/libcurses"
5CHECK_PATH="${BASEDIR}/check_files/"
6export CHECK_PATH
7INCLUDE_PATH="${BASEDIR}/tests/"
8export INCLUDE_PATH
9#
10CURSES_TRACE_FILE="/tmp/ctrace"
11SLAVE="${BASEDIR}/slave"
12
13usage() {
14	echo "Set up the environment to run the test frame.  Option flags:"
15	echo
16	echo "    -c : Set up curses tracing, assumes the curses lib has been built with"
17	echo "         debug enabled.  Default trace mask traces input, can be overridden"
18	echo "         by setting the trace mask in the environment before calling the"
19	echo "         The trace file output goes to /tmp/ctrace"
20	echo "         script."
21	echo "    -f : Specify the file name for curses tracing the default is"
22	echo "         ${CURSES_TRACE_FILE}"
23	echo "	  -L : Add the argument as a prefix to LD_LIBRARY_PATH to"
24	echo "	       use an alternate libcurses version"
25	echo "    -s : Specify the slave command.  Defaults to \"../slave/slave\""
26	echo "    -v : Enable verbose output"
27	echo
28}
29
30#
31ARGS=""
32#
33while getopts cf:L:s:v opt
34do
35    case "${opt}" in
36	c)
37	    if [ "X$CURSES_TRACE_MASK" = "X" ]; then
38		CURSES_TRACE_MASK=0x00000082
39	    fi
40	    export CURSES_TRACE_FILE
41	    export CURSES_TRACE_MASK
42	    ;;
43
44	f)
45	    CURSES_TRACE_FILE=${OPTARG}
46	    ;;
47
48	L)
49	    LD_LIBRARY_PATH=${OPTARG}:${LD_LIBRARY_PATH}
50	    ;;
51
52	s)
53	    SLAVE=${OPTARG}
54	    ;;
55
56	v)
57	    ARGS="-v"
58	    ;;
59
60	\?)
61	    usage
62	    exit 1
63	    ;;
64    esac
65done
66#
67shift $((OPTIND - 1))
68#
69if [ -z "${1}" ]
70then
71	echo
72	echo "A test name needs to be specified."
73	echo
74	usage
75	echo
76	exit 1
77fi
78#
79exec ${BASEDIR}/director ${ARGS} -s ${SLAVE} "${INCLUDE_PATH}/$1"
80