3 # Test file format conversions of the Wireshark tools
7 # Wireshark - Network traffic analyzer
8 # By Gerald Combs <gerald@wireshark.org>
9 # Copyright 2005 Ulf Lamping
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License
13 # as published by the Free Software Foundation; either version 2
14 # of the License, or (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 # common exit status values
32 TS_FF_ARGS
="-Tfields -e frame.number -e frame.time_epoch -e frame.time_delta"
34 FF_BASELINE
=.
/ff-ts-usec-pcap-direct.txt
35 DIFF_OUT
=.
/diff-output.txt
37 # Microsecond pcap / stdin
38 ff_step_usec_pcap_stdin
() {
39 $TSHARK $TS_FF_ARGS -i - < "${CAPTURE_DIR}dhcp.pcap" > .
/ff-ts-usec-pcap-stdin.txt
2> /dev
/null
40 diff -u $FF_BASELINE .
/ff-ts-usec-pcap-stdin.txt
> $DIFF_OUT 2>&1
42 if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
43 test_step_failed
"Output of microsecond pcap direct read vs microsecond pcap via stdin differ"
50 # Nanosecond pcap / stdin
51 ff_step_nsec_pcap_stdin
() {
52 $TSHARK $TS_FF_ARGS -i - < "${CAPTURE_DIR}dhcp-nanosecond.pcap" > .
/ff-ts-nsec-pcap-stdin.txt
2> /dev
/null
53 diff -u $FF_BASELINE .
/ff-ts-nsec-pcap-stdin.txt
> $DIFF_OUT 2>&1
55 if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
56 test_step_failed
"Output of microsecond pcap direct read vs nanosecond pcap via stdin differ"
63 # Nanosecond pcap / direct
64 ff_step_nsec_pcap_direct
() {
65 $TSHARK $TS_FF_ARGS -r "${CAPTURE_DIR}dhcp-nanosecond.pcap" > .
/ff-ts-nsec-pcap-direct.txt
2> /dev
/null
66 diff -u $FF_BASELINE .
/ff-ts-nsec-pcap-direct.txt
> $DIFF_OUT 2>&1
68 if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
69 test_step_failed
"Output of microsecond pcap direct read vs nanosecond pcap direct read differ"
76 # Microsecond pcap-ng / stdin
77 ff_step_usec_pcapng_stdin
() {
78 $TSHARK $TS_FF_ARGS -i - < "${CAPTURE_DIR}dhcp.pcapng" > .
/ff-ts-usec-pcapng-stdin.txt
2> /dev
/null
79 diff -u $FF_BASELINE .
/ff-ts-usec-pcapng-stdin.txt
> $DIFF_OUT 2>&1
81 if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
82 test_step_failed
"Output of microsecond pcap direct read vs microsecond pcap-ng via stdin differ"
89 # Microsecond pcap-ng / direct
90 ff_step_usec_pcapng_direct
() {
91 $TSHARK $TS_FF_ARGS -r "${CAPTURE_DIR}dhcp.pcapng" > .
/ff-ts-usec-pcapng-direct.txt
2> /dev
/null
92 diff -u $FF_BASELINE .
/ff-ts-usec-pcapng-direct.txt
> $DIFF_OUT 2>&1
94 if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
95 test_step_failed
"Output of microsecond pcap direct read vs microsecond pcap-ng direct read differ"
102 # Nanosecond pcap-ng / stdin
103 ff_step_nsec_pcapng_stdin
() {
104 $TSHARK $TS_FF_ARGS -i - < "${CAPTURE_DIR}dhcp-nanosecond.pcapng" > .
/ff-ts-nsec-pcapng-stdin.txt
2> /dev
/null
105 diff -u $FF_BASELINE .
/ff-ts-nsec-pcapng-stdin.txt
> $DIFF_OUT 2>&1
107 if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
108 test_step_failed
"Output of microsecond pcap direct read vs nanosecond pcap-ng via stdin differ"
115 # Nanosecond pcap-ng / direct
116 ff_step_nsec_pcapng_direct
() {
117 $TSHARK $TS_FF_ARGS -r "${CAPTURE_DIR}dhcp-nanosecond.pcapng" > .
/ff-ts-nsec-pcapng-direct.txt
2> /dev
/null
118 diff -u $FF_BASELINE .
/ff-ts-nsec-pcapng-direct.txt
> $DIFF_OUT 2>&1
120 if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
121 test_step_failed
"Output of microsecond pcap direct read vs nanosecond pcap-ng direct read differ"
129 # Microsecond pcap direct read is used as the baseline.
130 test_step_add
"Microsecond pcap via stdin" ff_step_usec_pcap_stdin
131 test_step_add
"Nanosecond pcap via stdin" ff_step_nsec_pcap_stdin
132 test_step_add
"Nanosecond pcap direct read" ff_step_nsec_pcap_direct
133 # test_step_add "Microsecond pcap-ng via stdin" ff_step_usec_pcapng_stdin
134 test_step_add
"Microsecond pcap-ng direct read" ff_step_usec_pcapng_direct
135 # test_step_add "Nanosecond pcap-ng via stdin" ff_step_nsec_pcapng_stdin
136 test_step_add
"Nanosecond pcap-ng direct read" ff_step_nsec_pcapng_direct
146 $TSHARK $TS_FF_ARGS -r "${CAPTURE_DIR}dhcp.pcap" > $FF_BASELINE 2> /dev
/null
149 fileformats_suite
() {
150 test_step_set_pre ff_prep_step
151 test_step_set_post ff_cleanup_step
152 test_suite_add
"TShark file format conversion" tshark_ff_suite
153 #test_suite_add "Wireshark file format" wireshark_ff_suite
154 #test_suite_add "Editcap file format" editcap_ff_suite
157 # Editor modelines - http://www.wireshark.org/tools/modelines.html
162 # indent-tabs-mode: t
165 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
166 # :indentSize=8:tabSize=8:noTabs=false: