aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2006-10-10 20:55:38 +0000
committerGerald Combs <gerald@wireshark.org>2006-10-10 20:55:38 +0000
commitaba9c21960cca46a4987b742967aa0a5214f3178 (patch)
tree85197c5c463db3e3ef405559a8d97e81c6860523 /test
parentfe2f2920b843530dc8253da9098889d38dae4241 (diff)
Add command-line options: -c disables color, -h prints help, -s runs
a suite. svn path=/trunk/; revision=19479
Diffstat (limited to 'test')
-rw-r--r--test/test-backend.sh18
-rw-r--r--test/test.sh46
2 files changed, 56 insertions, 8 deletions
diff --git a/test/test-backend.sh b/test/test-backend.sh
index d7da592dd4..49762a724d 100644
--- a/test/test-backend.sh
+++ b/test/test-backend.sh
@@ -36,11 +36,19 @@
# coloring the output
-color_reset="tput sgr0"
-color_green='\E[32;40m'
-color_red='\E[31;40m'
-color_yellow='\E[33;40m'
-color_blue='\E[36;40m'
+if [ $USE_COLOR -eq 1 ] ; then
+ color_reset="tput sgr0"
+ color_green='\E[32;40m'
+ color_red='\E[31;40m'
+ color_yellow='\E[33;40m'
+ color_blue='\E[36;40m'
+else
+ color_reset="/bin/true"
+ color_green=''
+ color_red=''
+ color_yellow=''
+ color_blue=''
+fi
# runtime flags
TEST_RUN="OFF"
diff --git a/test/test.sh b/test/test.sh
index 491e489a26..2088725a0f 100644
--- a/test/test.sh
+++ b/test/test.sh
@@ -25,7 +25,32 @@
# an existing capture file
CAPFILE=./dhcp.pcap
+USE_COLOR=1
+RUN_SUITE=""
+PRINT_USAGE=0
+
+while getopts "chs:" OPTION ; do
+ case $OPTION in
+ c) USE_COLOR=0 ;;
+ h) PRINT_USAGE=1 ;;
+ s) RUN_SUITE="$OPTARG" ;;
+ *) echo "Unknown option: " $OPTION $OPTARG
+ esac
+done
+shift $(( $OPTIND - 1 ))
+
+if [ $PRINT_USAGE -ne 0 ] ; then
+ THIS=`basename $0`
+ cat <<FIN
+Usage: $THIS [-c] [-h] [-s <suite>]
+ -c: Disable color output
+ -h: Print this message and exit
+ -s: Run a suite. Must be one of: all, capture, clopts, io, or
+ prerequisites
+FIN
+ exit 0
+fi
source test-backend.sh
@@ -79,9 +104,24 @@ test_set_output VERBOSE
#test_suite_run "All" test_suite
#test_suite_show "All" test_suite
-if [ "$1" == "all" ] ; then
- test_suite_run "All" test_suite
- exit $?
+if [ -n "$RUN_SUITE" ] ; then
+ case $RUN_SUITE in
+ "all")
+ test_suite_run "All" test_suite
+ exit $? ;;
+ "capture")
+ test_suite_run "Capture" capture_suite
+ exit $? ;;
+ "clopts")
+ test_suite_run "Command line options" clopt_suite
+ exit $? ;;
+ "io")
+ test_suite_run "File I/O" io_suite
+ exit $? ;;
+ "prerequisites")
+ test_suite_run "Prerequisites" prerequisites_suite
+ exit $? ;;
+ esac
fi
MENU_LEVEL=0