Home | History | Annotate | Line # | Download | only in libcurses
      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 "    -n : Add the nofail option to the director invocation"
     30 	echo "       : so the director won't exit on check_file mismatch"
     31 	echo "    -s : Specify the slave command.  Defaults to \"../slave/slave\""
     32 	echo "    -v : Enable verbose output"
     33 	echo "    -g : Enable check file generation if the file does not exists"
     34 	echo "    -f : Forces check file generation if -g flag is set"
     35 	echo "    -t : Specify the TERM to use for the tests"
     36 	echo
     37 }
     38 
     39 # This is needed for getwin/putwin test case and /tmp can be used for any file
     40 # related tests.
     41 #rm -rf /tmp/*
     42 
     43 #
     44 #ARGS="-T ${BASEDIR} -I ${INCLUDE_PATH} -C ${CHECK_PATH}"
     45 ARGS="-T ${BASEDIR} -C ${CHECK_PATH}"
     46 #
     47 while getopts cf:F:L:ns:t:vg opt
     48 do
     49     case "${opt}" in
     50 	c)
     51 	    if [ "X$CURSES_TRACE_MASK" = "X" ]; then
     52 		CURSES_TRACE_MASK=0x00000082
     53 	    fi
     54 	    export CURSES_TRACE_FILE
     55 	    export CURSES_TRACE_MASK
     56 	    ;;
     57 
     58 	F)
     59 	    CURSES_TRACE_FILE=${OPTARG}
     60 	    ;;
     61 
     62 	L)
     63 	    LD_LIBRARY_PATH=${OPTARG}:${LD_LIBRARY_PATH}
     64 	    ;;
     65 
     66 	n)
     67 	    ARGS="-n ${ARGS} "
     68 	    ;;
     69 
     70 	s)
     71 	    SLAVE=${OPTARG}
     72 	    ;;
     73 
     74 	t)
     75 	    ARGS="-t ${OPTARG} ${ARGS}"
     76 	    ;;
     77 
     78 	v)
     79 	    ARGS="-v ${ARGS}"
     80 	    ;;
     81 
     82 	g)
     83 	    ARGS="-g ${ARGS}"
     84 		;;
     85 
     86 	f)
     87 	ARGS="-f ${ARGS}"
     88 	;;
     89 
     90 	\?)
     91 	    usage
     92 	    exit 1
     93 	    ;;
     94     esac
     95 done
     96 #
     97 shift $((OPTIND - 1))
     98 #
     99 if [ -z "${1}" ]
    100 then
    101 	echo
    102 	echo "A test name needs to be specified."
    103 	echo
    104 	usage
    105 	echo
    106 	exit 1
    107 fi
    108 #
    109 exec ${BASEDIR}/director ${ARGS} -s ${SLAVE} "${INCLUDE_PATH}/$1"
    110