aboutsummaryrefslogtreecommitdiffstats
path: root/test/test.sh
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-12-13 23:15:20 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-12-13 23:15:20 +0000
commit0922a2b922646a831c9ff3c6d8f8b43700ef6edc (patch)
treebd8e7343f1749d610fa756b75bd7c3dfd44d3596 /test/test.sh
parent79217bab2ebb0d2811e130bea6334c8227a88a28 (diff)
add a new directory 'test', currently containing an alpha test (using some simple bash scripts) of the ethereal/tethereal command line parameters. See the file README.test for details.
svn path=/trunk/; revision=16788
Diffstat (limited to 'test/test.sh')
-rw-r--r--test/test.sh138
1 files changed, 138 insertions, 0 deletions
diff --git a/test/test.sh b/test/test.sh
new file mode 100644
index 0000000000..8e43a2fb0d
--- /dev/null
+++ b/test/test.sh
@@ -0,0 +1,138 @@
+#!/bin/bash
+#
+# Test various command line testable aspects of the Ethereal tools
+#
+# $Id$
+#
+# Ethereal - Network traffic analyzer
+# By Gerald Combs <gerald@ethereal.com>
+# Copyright 2005 Ulf Lamping
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+# an existing capture file
+CAPFILE=./dhcp.pcap
+
+
+source test-backend.sh
+
+source config.sh
+source suite-clopts.sh
+source suite-capture.sh
+
+
+#check prerequisites
+test_step_prerequisites() {
+
+ NOTFOUND=0
+ for i in "$ETHEREAL" "$TETHEREAL" "$CAPINFOS" "$DUMPCAP" ; do
+ if [ ! -x $i ]; then
+ echo "Couldn't find $i"
+ NOTFOUND=1
+ fi
+ done
+ if [ $NOTFOUND -eq 1 ]; then
+ test_step_failed "Tool not found"
+ exit 1
+ else
+ test_step_ok
+ fi
+}
+
+
+prerequisites_suite() {
+ test_step_add "Prerequisites settings" test_step_prerequisites
+}
+
+test_suite() {
+ test_suite_add "Prerequisites" prerequisites_suite
+ test_suite_add "Basic command line options" clopt_suite
+ test_suite_add "Capture" capture_suite
+}
+
+
+#test_set_output OFF # doesn't work
+#test_set_output DOTTED
+test_set_output VERBOSE
+
+
+#test_suite_run "Tethereal command line options" clopt_suite
+#test_suite_run "Tethereal capture" capture_suite
+
+
+# all
+#test_suite_run "All" test_suite
+#test_suite_show "All" test_suite
+
+MENU_LEVEL=0
+
+menu_title[0]="All"
+menu_function[0]=test_suite
+
+echo "----------------------------------------------------------------------"
+
+for ((a=0; a <= 100000000000 ; a++))
+do
+ TEST_STEPS[0]=0 # number of steps of a specific nesting level
+
+ #echo $current_title $current_function
+ test_suite_show "${menu_title[MENU_LEVEL]}" "${menu_function[MENU_LEVEL]}"
+ echo "1-$TEST_STEPS : Select item"
+ echo "Enter: Test All"
+ if [[ ! $MENU_LEVEL -eq 0 ]]; then
+ echo "U : Up"
+ fi
+ echo "Q : Quit"
+ echo ""
+ read -n1 key
+ newl=$'\x0d'
+ echo "$newl----------------------------------------------------------------------"
+
+ TEST_STEPS[0]=0 # number of steps of a specific nesting level
+
+ #echo $key
+ case "$key" in
+ "Q" | "q")
+ exit 0
+ ;;
+ "T" | "t" | "")
+ test_suite_run "${menu_title[MENU_LEVEL]}" "${menu_function[MENU_LEVEL]}"
+ echo "----------------------------------------------------------------------"
+ ;;
+ "U" | "u")
+ if [[ ! $MENU_LEVEL -eq 0 ]]; then
+ let "MENU_LEVEL -= 1"
+ #echo "----------------------------------------------------------------------"
+ fi
+ ;;
+ "1")
+ let "MENU_LEVEL += 1"
+ menu_title[MENU_LEVEL]=${test_title[1]}
+ menu_function[MENU_LEVEL]=${test_function[1]}
+ ;;
+ "2")
+ let "MENU_LEVEL += 1"
+ menu_title[MENU_LEVEL]=${test_title[2]}
+ menu_function[MENU_LEVEL]=${test_function[2]}
+ ;;
+ "3")
+ let "MENU_LEVEL += 1"
+ menu_title[MENU_LEVEL]=${test_title[3]}
+ menu_function[MENU_LEVEL]=${test_function[3]}
+ ;;
+
+ esac
+done \ No newline at end of file