Home | History | Annotate | Line # | Download | only in libcurses
debug_test revision 1.5
      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"
     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 ARGS="-T ${BASEDIR} -C ${CHECK_PATH}"
     39 #
     40 while getopts cf:L:s:vg opt
     41 do
     42     case "${opt}" in
     43 	c)
     44 	    if [ "X$CURSES_TRACE_MASK" = "X" ]; then
     45 		CURSES_TRACE_MASK=0x00000082
     46 	    fi
     47 	    export CURSES_TRACE_FILE
     48 	    export CURSES_TRACE_MASK
     49 	    ;;
     50 
     51 	F)
     52 	    CURSES_TRACE_FILE=${OPTARG}
     53 	    ;;
     54 
     55 	L)
     56 	    LD_LIBRARY_PATH=${OPTARG}:${LD_LIBRARY_PATH}
     57 	    ;;
     58 
     59 	s)
     60 	    SLAVE=${OPTARG}
     61 	    ;;
     62 
     63 	v)
     64 	    ARGS="-v ${ARGS}"
     65 	    ;;
     66 
     67 	g)
     68 	    ARGS="-g ${ARGS}"
     69 		;;
     70 
     71 	f)
     72 	ARGS="-f ${ARGS}"
     73 	;;
     74 
     75 	\?)
     76 	    usage
     77 	    exit 1
     78 	    ;;
     79     esac
     80 done
     81 #
     82 shift $((OPTIND - 1))
     83 #
     84 if [ -z "${1}" ]
     85 then
     86 	echo
     87 	echo "A test name needs to be specified."
     88 	echo
     89 	usage
     90 	echo
     91 	exit 1
     92 fi
     93 #
     94 exec ${BASEDIR}/director ${ARGS} -s ${SLAVE} "${INCLUDE_PATH}/$1"
     95