debug_test revision 1.2
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 "    -s : Specify the slave command.  Defaults to \"../slave/slave\""
24	echo "    -v : Enable verbose output"
25	echo
26}
27
28#
29ARGS=""
30#
31while getopts cf:s:v opt
32do
33    case "${opt}" in
34	c)
35	    if [ "X$CURSES_TRACE_MASK" = "X" ]; then
36		CURSES_TRACE_MASK=0x00000082
37	    fi
38	    export CURSES_TRACE_FILE
39	    export CURSES_TRACE_MASK
40	    ;;
41
42	f)
43	    CURSES_TRACE_FILE=${OPTARG}
44	    ;;
45
46	s)
47	    SLAVE=${OPTARG}
48	    ;;
49
50	v)
51	    ARGS="-v"
52	    ;;
53
54	\?)
55	    usage
56	    exit 1
57	    ;;
58    esac
59done
60#
61shift $((OPTIND - 1))
62#
63if [ -z "${1}" ]
64then
65	echo
66	echo "A test name needs to be specified."
67	echo
68	usage
69	echo
70	exit 1
71fi
72#
73exec ${BASEDIR}/director ${ARGS} -s ${SLAVE} "${INCLUDE_PATH}/$1"
74