Home | History | Annotate | Line # | Download | only in libcurses
debug_test revision 1.6
      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 # Force localisation to UTF-8 to be consistent with atf runs
     14 #
     15 export LC_ALL=en_US.UTF-8
     16 
     17 usage() {
     18 	echo "Set up the environment to run the test frame.  Option flags:"
     19 	echo
     20 	echo "    -c : Set up curses tracing, assumes the curses lib has been built with"
     21 	echo "         debug enabled.  Default trace mask traces input, can be overridden"
     22 	echo "         by setting the trace mask in the environment before calling the"
     23 	echo "         The trace file output goes to /tmp/ctrace"
     24 	echo "         script."
     25 	echo "    -F : Specify the file name for curses tracing the default is"
     26 	echo "         ${CURSES_TRACE_FILE}"
     27 	echo "	  -L : Add the argument as a prefix to LD_LIBRARY_PATH to"
     28 	echo "	       use an alternate libcurses version"
     29 	echo "    -s : Specify the slave command.  Defaults to \"../slave/slave\""
     30 	echo "    -v : Enable verbose output"
     31 	echo "    -g : Enable check file generation if the file does not exists"
     32 	echo "    -f : Forces check file generation if -g flag is set"
     33 	echo
     34 }
     35 
     36 # This is needed for getwin/putwin test case and /tmp can be used for any file
     37 # related tests.
     38 #rm -rf /tmp/*
     39 
     40 #
     41 #ARGS="-T ${BASEDIR} -I ${INCLUDE_PATH} -C ${CHECK_PATH}"
     42 ARGS="-T ${BASEDIR} -C ${CHECK_PATH}"
     43 #
     44 while getopts cf:L:s:vg opt
     45 do
     46     case "${opt}" in
     47 	c)
     48 	    if [ "X$CURSES_TRACE_MASK" = "X" ]; then
     49 		CURSES_TRACE_MASK=0x00000082
     50 	    fi
     51 	    export CURSES_TRACE_FILE
     52 	    export CURSES_TRACE_MASK
     53 	    ;;
     54 
     55 	F)
     56 	    CURSES_TRACE_FILE=${OPTARG}
     57 	    ;;
     58 
     59 	L)
     60 	    LD_LIBRARY_PATH=${OPTARG}:${LD_LIBRARY_PATH}
     61 	    ;;
     62 
     63 	s)
     64 	    SLAVE=${OPTARG}
     65 	    ;;
     66 
     67 	v)
     68 	    ARGS="-v ${ARGS}"
     69 	    ;;
     70 
     71 	g)
     72 	    ARGS="-g ${ARGS}"
     73 		;;
     74 
     75 	f)
     76 	ARGS="-f ${ARGS}"
     77 	;;
     78 
     79 	\?)
     80 	    usage
     81 	    exit 1
     82 	    ;;
     83     esac
     84 done
     85 #
     86 shift $((OPTIND - 1))
     87 #
     88 if [ -z "${1}" ]
     89 then
     90 	echo
     91 	echo "A test name needs to be specified."
     92 	echo
     93 	usage
     94 	echo
     95 	exit 1
     96 fi
     97 #
     98 exec ${BASEDIR}/director ${ARGS} -s ${SLAVE} "${INCLUDE_PATH}/$1"
     99