2 (shopt -s igncr) 2>/dev/null && shopt -s igncr; # comment is needed
3 # # hack for cygwin bash
6 # Test various command line testable aspects of the Wireshark tools
10 # Wireshark - Network traffic analyzer
11 # By Gerald Combs <gerald@wireshark.org>
12 # Copyright 2005 Ulf Lamping
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; either version 2
17 # of the License, or (at your option) any later version.
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 # an existing capture file
35 while getopts "chs:" OPTION ; do
39 s) RUN_SUITE="$OPTARG" ;;
40 *) echo "Unknown option: " $OPTION $OPTARG
44 shift $(( $OPTIND - 1 ))
46 if [ $PRINT_USAGE -ne 0 ] ; then
49 Usage: $THIS [-c] [-h] [-s <suite>]
50 -c: Disable color output
51 -h: Print this message and exit
52 -s: Run a suite. Must be one of: all, capture, clopts, io, or
58 source test-backend.sh
61 source suite-clopts.sh
63 source suite-capture.sh
64 source suite-unittests.sh
68 test_step_prerequisites() {
71 for i in "$WIRESHARK" "$TSHARK" "$CAPINFOS" "$DUMPCAP" ; do
73 echo "Couldn't find $i"
77 if [ $NOTFOUND -eq 1 ]; then
78 test_step_failed "Tool not found"
86 prerequisites_suite() {
87 test_step_add "Prerequisites settings" test_step_prerequisites
91 test_suite_add "Prerequisites" prerequisites_suite
92 test_suite_add "Command line options" clopt_suite
93 test_suite_add "File I/O" io_suite
94 test_suite_add "Capture" capture_suite
95 test_suite_add "Unittests" unittests_suite
99 #test_set_output OFF # doesn't work
100 #test_set_output DOTTED
101 test_set_output VERBOSE
104 #test_suite_run "TShark command line options" clopt_suite
105 #test_suite_run "TShark capture" capture_suite
109 #test_suite_run "All" test_suite
110 #test_suite_show "All" test_suite
112 if [ -n "$RUN_SUITE" ] ; then
115 test_suite_run "All" test_suite
118 test_suite_run "Capture" capture_suite
121 test_suite_run "Command line options" clopt_suite
124 test_suite_run "File I/O" io_suite
127 test_suite_run "Prerequisites" prerequisites_suite
135 menu_function[0]=test_suite
137 echo "----------------------------------------------------------------------"
139 for ((a=0; a <= 100000000000 ; a++))
141 TEST_STEPS[0]=0 # number of steps of a specific nesting level
143 #echo $current_title $current_function
144 test_suite_show "${menu_title[MENU_LEVEL]}" "${menu_function[MENU_LEVEL]}"
145 echo "1-$TEST_STEPS : Select item"
146 echo "Enter: Test All"
147 if [[ ! $MENU_LEVEL -eq 0 ]]; then
154 echo "$newl----------------------------------------------------------------------"
156 TEST_STEPS[0]=0 # number of steps of a specific nesting level
165 for ((a_runs=1; a_runs <= LIMIT_RUNS ; a_runs++)) # Double parentheses, and "LIMIT" with no "$".
167 test_suite_run "${menu_title[MENU_LEVEL]}" "${menu_function[MENU_LEVEL]}"
169 echo "----------------------------------------------------------------------"
172 if [[ ! $MENU_LEVEL -eq 0 ]]; then
173 let "MENU_LEVEL -= 1"
174 #echo "----------------------------------------------------------------------"
178 let "MENU_LEVEL += 1"
179 menu_title[MENU_LEVEL]=${test_title[1]}
180 menu_function[MENU_LEVEL]=${test_function[1]}
183 let "MENU_LEVEL += 1"
184 menu_title[MENU_LEVEL]=${test_title[2]}
185 menu_function[MENU_LEVEL]=${test_function[2]}
188 let "MENU_LEVEL += 1"
189 menu_title[MENU_LEVEL]=${test_title[3]}
190 menu_function[MENU_LEVEL]=${test_function[3]}
193 let "MENU_LEVEL += 1"
194 menu_title[MENU_LEVEL]=${test_title[4]}
195 menu_function[MENU_LEVEL]=${test_function[4]}
198 let "MENU_LEVEL += 1"
199 menu_title[MENU_LEVEL]=${test_title[5]}
200 menu_function[MENU_LEVEL]=${test_function[5]}
203 let "MENU_LEVEL += 1"
204 menu_title[MENU_LEVEL]=${test_title[6]}
205 menu_function[MENU_LEVEL]=${test_function[6]}
208 let "MENU_LEVEL += 1"
209 menu_title[MENU_LEVEL]=${test_title[7]}
210 menu_function[MENU_LEVEL]=${test_function[7]}
213 let "MENU_LEVEL += 1"
214 menu_title[MENU_LEVEL]=${test_title[8]}
215 menu_function[MENU_LEVEL]=${test_function[8]}
218 let "MENU_LEVEL += 1"
219 menu_title[MENU_LEVEL]=${test_title[9]}
220 menu_function[MENU_LEVEL]=${test_function[9]}