source: test/do-tests.sh @ ec19a99

develop
Last change on this file since ec19a99 was ec19a99, checked in by Shane Alcock <salcock@…>, 22 months ago

Add test case for trace_get_wire_length()

Given that there is often some confusion around the wire length
and whether we count the FCS as wire length or not (and what do
we do for formats that don't save the FCS, i.e. pcap), we should
really have a test that will at least alert us if someone has
changed how wire length is calculated for one of the formats.

  • Property mode set to 100755
File size: 7.0 KB
Line 
1#!/bin/bash
2
3OK=0
4FAIL=""
5
6do_test() {
7        if $@; then
8                OK=$[ $OK + 1 ]
9        else
10                FAIL="$FAIL
11$@"
12        fi
13}
14
15libdir=../lib/.libs:../libpacketdump/.libs
16export LD_LIBRARY_PATH="$libdir:/usr/local/lib/"
17export DYLD_LIBRARY_PATH="${libdir}"
18echo SLL Decoder
19do_test ./test-decode2 pcap:traces/100_sll.pcap
20do_test ./test-decode2 pcapfile:traces/sll.pcap.gz
21
22echo 802.1x decoder
23do_test ./test-decode2 pcap:traces/8021x.pcap
24
25echo MPLS Decoder
26do_test ./test-decode2 pcap:traces/10_mpls_ip.pcap
27
28echo Radius Decoder
29do_test ./test-decode2 pcap:traces/radius.pcap
30
31rm -f traces/*.out.*
32echo \* Read erf
33do_test ./test-format erf
34do_test ./test-decode erf
35
36echo \* Read erf provenance
37do_test ./test-format erfprov
38
39echo \* Read pcap
40do_test ./test-format pcap
41do_test ./test-decode pcap
42
43echo \* Read pcapfile
44do_test ./test-format pcapfile
45do_test ./test-decode pcapfile
46
47echo \* Read pcapfilens
48do_test ./test-format pcapfilens
49do_test ./test-decode pcapfilens
50
51echo \* Read legacyatm
52do_test ./test-format legacyatm
53do_test ./test-decode legacyatm
54
55echo \* Read legacyeth
56do_test ./test-format legacyeth
57do_test ./test-decode legacyeth
58
59echo \* Read legacypos
60do_test ./test-format legacypos
61do_test ./test-decode legacypos
62
63echo \* Read tsh
64do_test ./test-format tsh
65do_test ./test-decode tsh
66
67echo \* Read rawerf
68do_test ./test-format rawerf
69do_test ./test-decode rawerf
70
71echo \* Read pcapng
72do_test ./test-format pcapng
73do_test ./test-decode pcapng
74
75
76echo \* Testing pcap-bpf
77do_test ./test-pcap-bpf
78
79echo \* Testing payload length
80do_test ./test-plen
81
82echo \* Testing wire length
83echo \* ERF
84do_test ./test-wlen erf
85echo \* pcapfile
86do_test ./test-wlen pcapfile
87echo \* pcapfilens
88do_test ./test-wlen pcapfilens
89echo \* legacyatm
90do_test ./test-wlen legacyatm
91echo \* legacypos
92do_test ./test-wlen legacypos
93echo \* legacyeth
94do_test ./test-wlen legacyeth
95echo \* rawerf
96do_test ./test-wlen rawerf
97echo \* pcap
98do_test ./test-wlen pcap
99echo \* tsh
100do_test ./test-wlen tsh
101echo \* pcapng
102do_test ./test-wlen pcapng
103
104echo \* Testing port numbers
105do_test ./test-ports
106
107echo \* Testing fragment parsing
108do_test ./test-fragment
109
110echo \* Testing event framework
111do_test ./test-event
112
113echo \* Testing time conversions
114echo \* ERF
115do_test ./test-time erf
116echo \* pcapfile
117do_test ./test-time pcapfile
118echo \* pcapfilens
119do_test ./test-time pcapfilens
120echo \* legacyatm
121do_test ./test-time legacyatm
122echo \* legacypos
123do_test ./test-time legacypos
124echo \* legacyeth
125do_test ./test-time legacyeth
126echo \* pcap
127do_test ./test-time pcap
128echo \* rawerf
129do_test ./test-time rawerf
130echo \* tsh
131do_test ./test-time tsh
132echo \* pcapng
133do_test ./test-time pcapng
134
135echo \* Testing directions
136do_test ./test-dir
137
138echo \* Testing wireless
139do_test ./test-wireless
140
141echo \* Testing error handling
142do_test ./test-errors
143
144echo \* Testing drop counters for erf
145do_test ./test-drops erf
146
147echo \* Testing drop counters for pcapfile
148do_test ./test-drops pcapfile
149
150echo \* Testing drop counters for duck
151do_test ./test-drops duck
152
153echo \* Testing drop counters for legacyatm
154do_test ./test-drops legacyatm
155
156echo \* Testing drop counters for legacypos
157do_test ./test-drops legacypos
158
159echo \* Testing drop counters for legacyeth
160do_test ./test-drops legacyeth
161
162echo \* Testing drop counters for tsh
163do_test ./test-drops tsh
164
165echo \* Testing larger trace file
166do_test ./test-drops legacylarge
167
168echo \* Testing writing erf
169do_test ./test-write erf
170
171echo \* Testing write pcap
172do_test ./test-write pcap
173
174echo \* Testing write pcapfile
175do_test ./test-write pcapfile
176
177# Not all types are convertable, for instance libtrace doesn't
178# do rtclient output, and erf doesn't support 802.11
179echo \* Conversions
180echo " * erf -> erf"
181rm -f traces/*.out.*
182do_test ./test-convert erf erf
183
184echo " * erf -> pcap"
185rm -f traces/*.out.*
186do_test ./test-convert erf pcap
187
188echo " * erf -> pcapfile"
189rm -f traces/*.out.*
190do_test ./test-convert erf pcapfile
191
192echo " * erf -> pcapng"
193rm -f traces/*.out.*
194do_test ./test-convert erf pcapng
195
196
197echo " * pcap -> pcap"
198rm -f traces/*.out.*
199do_test ./test-convert pcap pcap
200
201echo " * pcap -> erf"
202rm -f traces/*.out.*
203do_test ./test-convert pcap erf
204
205echo " * pcap -> pcapfile"
206rm -f traces/*.out.*
207do_test ./test-convert pcap pcapfile
208
209echo " * pcap -> pcapng"
210rm -f traces/*.out.*
211do_test ./test-convert pcap pcapng
212
213
214echo " * pcapfile -> erf"
215rm -f traces/*.out.*
216do_test ./test-convert pcapfile erf
217
218echo " * pcapfile -> pcapfile"
219rm -f traces/*.out.*
220do_test ./test-convert pcapfile pcapfile
221
222echo " * pcapfile -> pcap"
223rm -f traces/*.out.*
224do_test ./test-convert pcapfile pcap
225
226echo " * pcapfile -> pcapng"
227rm -f traces/*.out.*
228do_test ./test-convert pcapfile pcapng
229
230
231echo " * pcapfilens -> pcapfile"
232rm -f traces/*.out.*
233do_test ./test-convert pcapfilens pcapfile
234
235echo " * pcapfilens -> erf"
236rm -f traces/*.out.*
237do_test ./test-convert pcapfilens erf
238
239
240echo " * pcapng -> pcapfile"
241rm -f traces/*.out.*
242do_test ./test-convert pcapng pcapfile
243
244echo " * pcapng -> erf"
245rm -f traces/*.out.*
246do_test ./test-convert pcapng erf
247
248echo " * pcapng -> pcap"
249rm -f traces/*.out.*
250do_test ./test-convert pcapng pcap
251
252echo " * pcapng -> pcapng"
253rm -f traces/*.out.*
254do_test ./test-convert pcapng pcapng
255
256
257echo " * pcap (sll) -> erf    raw IP"
258rm -f traces/*.out.*
259do_test ./test-convert sll1 erf
260
261echo " * pcap (sll) -> erf    loopback"
262rm -f traces/*.out.*
263do_test ./test-convert sll2 erf
264
265
266#./test-convert rtclient erf
267#./test-convert rtclient pcap
268
269# This doesn't work because pcap doesn't support legacyatm's linktype
270# so the packet is converted to a raw IP packet, which when read
271# back in again doesn't match legacyatm's original packet.
272#echo " * legacyatm -> pcapfile"
273#rm -f traces/*.out.*
274#./test-convert legacyatm pcapfile
275
276echo " * legacyeth -> pcapfile"
277rm -f traces/*.out.*
278do_test ./test-convert legacyeth pcapfile
279
280echo " * legacypos -> pcapfile"
281rm -f traces/*.out.*
282do_test ./test-convert legacypos pcapfile
283
284# Don't bother with this anymore -- DUCK qualifies as 'meta' so
285# doesn't get written at the moment.
286#echo " * duck -> duck"
287#rm -f traces/*.out.*
288#do_test ./test-convert duck duck
289
290echo " * tsh -> pcapfile"
291rm -f traces/*.out.*
292do_test ./test-convert tsh pcapfile
293
294echo " * tsh -> pcap"
295rm -f traces/*.out.*
296do_test ./test-convert tsh pcap
297
298echo \* Testing packet truncation
299echo " * pcap "
300rm -f traces/*.out.*
301do_test ./test-setcaplen pcap pcapfile
302
303echo " * pcapfile "
304rm -f traces/*.out.*
305do_test ./test-setcaplen pcapfile pcapfile
306
307echo " * erf "
308rm -f traces/*.out.*
309do_test ./test-setcaplen erf erf
310
311echo " * pcapng "
312rm -f traces/*.out.*
313do_test ./test-setcaplen pcapng pcapfile
314
315echo " * pcapfilens "
316rm -f traces/*.out.*
317do_test ./test-setcaplen pcapfilens pcapfile
318
319
320
321echo " * format autodetection - uncompressed"
322do_test ./test-autodetect traces/5_packets.erf
323echo " * format autodetection - gzip"
324do_test ./test-autodetect traces/5_packets.erf.gz
325echo " * format autodetection - bzip2"
326do_test ./test-autodetect traces/5_packets.erf.bz2
327echo " * format autodetection - lzma"
328do_test ./test-autodetect traces/5_packets.erf.xz
329
330echo " * VXLan decode"
331do_test ./test-vxlan
332
333echo
334echo "Tests passed: $OK"
335echo "Tests failed: $FAIL"
Note: See TracBrowser for help on using the repository browser.