Add a Kerberos decryption test.
[metze/wireshark/wip.git] / test / config.sh
1 #!/bin/bash
2 #
3 # Configuration of the command line tests
4 #
5 # Wireshark - Network traffic analyzer
6 # By Gerald Combs <gerald@wireshark.org>
7 # Copyright 2005 Ulf Lamping
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License
11 # as published by the Free Software Foundation; either version 2
12 # of the License, or (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #
23
24 # The files we want to test are in the build directory.
25 WIRESHARK_RUN_FROM_BUILD_DIRECTORY=1
26 export WIRESHARK_RUN_FROM_BUILD_DIRECTORY
27
28 # Set WS_SYSTEM to our system type, e.g. Windows, Linux, Darwin
29 # http://support.microsoft.com/kb/100843
30 if [ -n "${OS#Windows}" ] ; then
31         WS_SYSTEM="Windows"
32         export CYGWIN="$CYGWIN error_start=c:\cygwin\bin\dumper.exe -d %1 %2"
33 else
34         WS_SYSTEM=`uname -s`
35 fi
36
37 #
38 #
39 ENDIANNESS="little"
40 echo -n I | od -to2 | awk '{ lastbit = substr($2,6,1); exit lastbit }'
41 if [ $? -eq 0 ] ; then
42         ENDIANNESS="big"
43 fi
44
45 # Absolute path to the source tree
46 SOURCE_DIR="$(cd "$(dirname "$0")" && cd .. && pwd)"
47
48 # Absolute path to this test directory (for capture and config files)
49 TESTS_DIR="$SOURCE_DIR/test"
50
51 # Are we allowed to open interfaces or capture on this system?
52 SKIP_CAPTURE=${SKIP_CAPTURE:-1}
53
54 # Override the last two items if we're running Windows
55 if [ "$WS_SYSTEM" = "Windows" ] ; then
56         WS_BIN_PATH=${WS_BIN_PATH:-$SOURCE_DIR/wireshark-gtk2}
57         WS_QT_BIN_PATH=${WS_QT_BIN_PATH:-$SOURCE_DIR/wireshark-qt-release}
58         SKIP_CAPTURE=0
59 fi
60
61 # Path to the Wireshark binaries, default to source dir if unset
62 WS_BIN_PATH=${WS_BIN_PATH:-$SOURCE_DIR}
63 WS_QT_BIN_PATH=${WS_QT_BIN_PATH:-$WS_BIN_PATH}
64
65 # Tweak the following to your liking.
66 WIRESHARK=$WS_QT_BIN_PATH/wireshark
67 WIRESHARK_GTK=$WS_BIN_PATH/wireshark-gtk
68 TSHARK=$WS_BIN_PATH/tshark
69 RAWSHARK=$WS_BIN_PATH/rawshark
70 CAPINFOS=$WS_BIN_PATH/capinfos
71 MERGECAP=$WS_BIN_PATH/mergecap
72 TEXT2PCAP=$WS_BIN_PATH/text2pcap
73 DUMPCAP=$WS_BIN_PATH/dumpcap
74
75 # interface with at least a few packets/sec traffic on it
76 # (e.g. start a web radio to generate some traffic :-)
77 # an interfaces index (1 based) should do well for recent devbuilds
78 if [ "$WS_SYSTEM" = "Windows" -a -z "$TRAFFIC_CAPTURE_IFACE" ] ; then
79         # Try to fetch the first Ethernet interface.
80         TRAFFIC_CAPTURE_IFACE=`$TSHARK -D 2>&1 | \
81                 egrep 'Ethernet|Network Connection|VMware|Intel|Realtek' | \
82                 head -1 | cut -c 1`
83 fi
84 TRAFFIC_CAPTURE_IFACE=${TRAFFIC_CAPTURE_IFACE:-1}
85
86 # time to capture some traffic (in seconds)
87 # (you may increase this if you get errors caused by very low traffic)
88 TRAFFIC_CAPTURE_DURATION=10
89
90 # the default is to not capture in promiscuous mode
91 # (this makes known trouble with some Windows WLAN adapters)
92 # if you need promiscuous mode, comment this line out
93 TRAFFIC_CAPTURE_PROMISC=-p
94
95 # only test capturing from a fifo if we're not on Windows
96 #  and we have a mkfifo. (Windows cygwin has a mkfifo but
97 #   Windows dumpcap & etc use Windows named pipes which
98 #   are different than the cygwin named pipes).
99 #
100 if [ "$WS_SYSTEM" != "Windows" ] && which mkfifo &>/dev/null ; then
101         TEST_FIFO=1
102 fi
103
104 # Tell Wireshark to quit after capuring packets.
105 export WIRESHARK_QUIT_AFTER_CAPTURE="True"
106
107 CAPTURE_DIR="$TESTS_DIR/captures/"
108
109 # Figure out if we were built with lua or not so we can skip the lua tests if we
110 # don't have it.
111 $TSHARK -v | grep -q "with Lua"
112 HAVE_LUA=$?
113
114 # Check whether we need to skip the HTTP2/HPACK decryption test.
115 $TSHARK -v | tr '\n' ' '| grep -q "with nghttp2"
116 HAVE_NGHTTP2=$?
117
118 # Check whether we need to skip a certain decryption test.
119 # XXX What do we print for Nettle?
120 $TSHARK -v | tr '\n' ' '| egrep -q "with MIT Kerberos|with Heimdal Kerberos"
121 HAVE_KERBEROS=$?
122
123 HAVE_ICONV="False"
124 hash iconv 2>/dev/null && HAVE_ICONV="True"
125
126 # Display our environment
127
128 ##printf "\n ------- Info =-----------------\n"
129 ##printf "Syms :$WS_SYSTEM: :$TRAFFIC_CAPTURE_IFACE: :$SKIP_CAPTURE: :$TEST_FIFO:\n"
130 ##
131 ##ls -l $WIRESHARK $TSHARK $DUMPCAP
132 ##ls -l $(which wireshark) $(which tshark) $(which dumpcap)
133 ##printf " ----------------------------------\n\n"
134
135 # Editor modelines
136 #
137 # Local Variables:
138 # sh-basic-offset: 8
139 # tab-width: 8
140 # indent-tabs-mode: t
141 # End:
142 #
143 # ex: set shiftwidth=8 tabstop=8 noexpandtab:
144 # :indentSize=8:tabSize=8:noTabs=false: