Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libcurses Fix script to use getopts instead of a h...
details: https://anonhg.NetBSD.org/src/rev/e24276cac40c
branches: trunk
changeset: 996156:e24276cac40c
user: blymn <blymn%NetBSD.org@localhost>
date: Mon Jan 21 21:21:13 2019 +0000
description:
Fix script to use getopts instead of a hand rolled argument parser,
add option to set curses debug output file and other general fixes.
Thanks to kre%netbsd.org@localhost for comments and help with this.
diffstat:
tests/lib/libcurses/debug_test | 64 ++++++++++++++++++++++++++++-------------
1 files changed, 43 insertions(+), 21 deletions(-)
diffs (98 lines):
diff -r 3e2067360b8a -r e24276cac40c tests/lib/libcurses/debug_test
--- a/tests/lib/libcurses/debug_test Mon Jan 21 21:11:54 2019 +0000
+++ b/tests/lib/libcurses/debug_test Mon Jan 21 21:21:13 2019 +0000
@@ -1,13 +1,5 @@
#!/bin/sh
#
-# Set up the environment to run the test frame. Option flags:
-#
-# -c : Set up curses tracing, assumes the curses lib has been built with
-# debug enabled. Default trace mask traces input, can be overridden
-# by setting the trace mask in the environment before calling the
-# script.
-# -s : Specify the slave command. Defaults to "../slave/slave"
-# -v : Enable verbose output
#
BASEDIR="/usr/tests/lib/libcurses"
CHECK_PATH="${BASEDIR}/check_files/"
@@ -15,15 +7,31 @@
INCLUDE_PATH="${BASEDIR}/tests/"
export INCLUDE_PATH
#
+CURSES_TRACE_FILE="/tmp/ctrace"
SLAVE="${BASEDIR}/slave"
+
+usage() {
+ echo "Set up the environment to run the test frame. Option flags:"
+ echo
+ echo " -c : Set up curses tracing, assumes the curses lib has been built with"
+ echo " debug enabled. Default trace mask traces input, can be overridden"
+ echo " by setting the trace mask in the environment before calling the"
+ echo " The trace file output goes to /tmp/ctrace"
+ echo " script."
+ echo " -f : Specify the file name for curses tracing the default is"
+ echo " ${CURSES_TRACE_FILE}"
+ echo " -s : Specify the slave command. Defaults to \"../slave/slave\""
+ echo " -v : Enable verbose output"
+ echo
+}
+
#
ARGS=""
#
-while /usr/bin/true
+while getopts cf:s:v opt
do
- case $1 in
- -c)
- CURSES_TRACE_FILE="/tmp/ctrace"
+ case "${opt}" in
+ c)
if [ "X$CURSES_TRACE_MASK" = "X" ]; then
CURSES_TRACE_MASK=0x00000082
fi
@@ -31,21 +39,35 @@
export CURSES_TRACE_MASK
;;
- -s)
- SLAVE=$2
- shift
+ f)
+ CURSES_TRACE_FILE=${OPTARG}
;;
- -v)
+ s)
+ SLAVE=${OPTARG}
+ ;;
+
+ v)
ARGS="-v"
;;
- *)
- break
+ \?)
+ usage
+ exit 1
;;
esac
-
- shift
done
#
-exec ${BASEDIR}/director ${ARGS} -s ${SLAVE} ${INCLUDE_PATH}/$@
+shift $((OPTIND - 1))
+#
+if [ -z "${1}" ]
+then
+ echo
+ echo "A test name needs to be specified."
+ echo
+ usage
+ echo
+ exit 1
+fi
+#
+exec ${BASEDIR}/director ${ARGS} -s ${SLAVE} "${INCLUDE_PATH}/$1"
Home |
Main Index |
Thread Index |
Old Index