Home | History | Annotate | Line # | Download | only in libcurses
debug_test revision 1.4
      1 #!/bin/sh
      2 #
      3 #
      4 BASEDIR="/usr/tests/lib/libcurses"
      5 CHECK_PATH="${BASEDIR}/check_files/"
      6 export CHECK_PATH
      7 INCLUDE_PATH="${BASEDIR}/tests/"
      8 export INCLUDE_PATH
      9 #
     10 CURSES_TRACE_FILE="/tmp/ctrace"
     11 SLAVE="${BASEDIR}/slave/slave"
     12 
     13 usage() {
     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 "    -g : Enable check file generation if the file does not exists"
     28 	echo "    -f : Forces check file generation if -g flag is set"
     29 	echo
     30 }
     31 
     32 # This is needed for getwin/putwin test case and /tmp can be used for any file
     33 # related tests.
     34 rm -rf /tmp/*
     35 
     36 #
     37 ARGS="-T ${BASEDIR} -I ${INCLUDE_PATH} -C ${CHECK_PATH}"
     38 #
     39 while getopts cf:L:s:vg opt
     40 do
     41     case "${opt}" in
     42 	c)
     43 	    if [ "X$CURSES_TRACE_MASK" = "X" ]; then
     44 		CURSES_TRACE_MASK=0x00000082
     45 	    fi
     46 	    export CURSES_TRACE_FILE
     47 	    export CURSES_TRACE_MASK
     48 	    ;;
     49 
     50 	F)
     51 	    CURSES_TRACE_FILE=${OPTARG}
     52 	    ;;
     53 
     54 	L)
     55 	    LD_LIBRARY_PATH=${OPTARG}:${LD_LIBRARY_PATH}
     56 	    ;;
     57 
     58 	s)
     59 	    SLAVE=${OPTARG}
     60 	    ;;
     61 
     62 	v)
     63 	    ARGS="-v ${ARGS}"
     64 	    ;;
     65 
     66 	g)
     67 	    ARGS="-g ${ARGS}"
     68 		;;
     69 
     70 	f)
     71 	ARGS="-f ${ARGS}"
     72 	;;
     73 
     74 	\?)
     75 	    usage
     76 	    exit 1
     77 	    ;;
     78     esac
     79 done
     80 #
     81 shift $((OPTIND - 1))
     82 #
     83 if [ -z "${1}" ]
     84 then
     85 	echo
     86 	echo "A test name needs to be specified."
     87 	echo
     88 	usage
     89 	echo
     90 	exit 1
     91 fi
     92 #
     93 exec ${BASEDIR}/director/director ${ARGS} -s ${SLAVE} "${INCLUDE_PATH}/$1"
     94