source: test/do-tests.sh @ 51276bd

develop
Last change on this file since 51276bd was 51276bd, checked in by Jacob Van Walraven <jcv9@…>, 22 months ago

Add tests for writing pcapng

  • Property mode set to 100755
File size: 6.5 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 port numbers
83do_test ./test-ports
84
85echo \* Testing fragment parsing
86do_test ./test-fragment
87
88echo \* Testing event framework
89do_test ./test-event
90
91echo \* Testing time conversions
92echo \* ERF
93do_test ./test-time erf
94echo \* pcapfile
95do_test ./test-time pcapfile
96echo \* pcapfilens
97do_test ./test-time pcapfilens
98echo \* legacyatm
99do_test ./test-time legacyatm
100echo \* legacypos
101do_test ./test-time legacypos
102echo \* legacyeth
103do_test ./test-time legacyeth
104echo \* pcap
105do_test ./test-time pcap
106echo \* rawerf
107do_test ./test-time rawerf
108echo \* tsh
109do_test ./test-time tsh
110echo \* pcapng
111do_test ./test-time pcapng
112
113echo \* Testing directions
114do_test ./test-dir
115
116echo \* Testing wireless
117do_test ./test-wireless
118
119echo \* Testing error handling
120do_test ./test-errors
121
122echo \* Testing drop counters for erf
123do_test ./test-drops erf
124
125echo \* Testing drop counters for pcapfile
126do_test ./test-drops pcapfile
127
128echo \* Testing drop counters for duck
129do_test ./test-drops duck
130
131echo \* Testing drop counters for legacyatm
132do_test ./test-drops legacyatm
133
134echo \* Testing drop counters for legacypos
135do_test ./test-drops legacypos
136
137echo \* Testing drop counters for legacyeth
138do_test ./test-drops legacyeth
139
140echo \* Testing drop counters for tsh
141do_test ./test-drops tsh
142
143echo \* Testing larger trace file
144do_test ./test-drops legacylarge
145
146echo \* Testing writing erf
147do_test ./test-write erf
148
149echo \* Testing write pcap
150do_test ./test-write pcap
151
152echo \* Testing write pcapfile
153do_test ./test-write pcapfile
154
155# Not all types are convertable, for instance libtrace doesn't
156# do rtclient output, and erf doesn't support 802.11
157echo \* Conversions
158echo " * erf -> erf"
159rm -f traces/*.out.*
160do_test ./test-convert erf erf
161
162echo " * erf -> pcap"
163rm -f traces/*.out.*
164do_test ./test-convert erf pcap
165
166echo " * erf -> pcapfile"
167rm -f traces/*.out.*
168do_test ./test-convert erf pcapfile
169
170echo " * erf -> pcapng"
171rm -f traces/*.out.*
172do_test ./test-convert erf pcapng
173
174
175echo " * pcap -> pcap"
176rm -f traces/*.out.*
177do_test ./test-convert pcap pcap
178
179echo " * pcap -> erf"
180rm -f traces/*.out.*
181do_test ./test-convert pcap erf
182
183echo " * pcap -> pcapfile"
184rm -f traces/*.out.*
185do_test ./test-convert pcap pcapfile
186
187echo " * pcap -> pcapng"
188rm -f traces/*.out.*
189do_test ./test-convert pcap pcapng
190
191
192echo " * pcapfile -> erf"
193rm -f traces/*.out.*
194do_test ./test-convert pcapfile erf
195
196echo " * pcapfile -> pcapfile"
197rm -f traces/*.out.*
198do_test ./test-convert pcapfile pcapfile
199
200echo " * pcapfile -> pcap"
201rm -f traces/*.out.*
202do_test ./test-convert pcapfile pcap
203
204echo " * pcapfile -> pcapng"
205rm -f traces/*.out.*
206do_test ./test-convert pcapfile pcapng
207
208
209echo " * pcapfilens -> pcapfile"
210rm -f traces/*.out.*
211do_test ./test-convert pcapfilens pcapfile
212
213echo " * pcapfilens -> erf"
214rm -f traces/*.out.*
215do_test ./test-convert pcapfilens erf
216
217
218echo " * pcapng -> pcapfile"
219rm -f traces/*.out.*
220do_test ./test-convert pcapng pcapfile
221
222echo " * pcapng -> erf"
223rm -f traces/*.out.*
224do_test ./test-convert pcapng erf
225
226echo " * pcapng -> pcap"
227rm -f traces/*.out.*
228do_test ./test-convert pcapng pcap
229
230echo " * pcapng -> pcapng"
231rm -f traces/*.out.*
232do_test ./test-convert pcapng pcapng
233
234
235echo " * pcap (sll) -> erf    raw IP"
236rm -f traces/*.out.*
237do_test ./test-convert sll1 erf
238
239echo " * pcap (sll) -> erf    loopback"
240rm -f traces/*.out.*
241do_test ./test-convert sll2 erf
242
243
244#./test-convert rtclient erf
245#./test-convert rtclient pcap
246
247# This doesn't work because pcap doesn't support legacyatm's linktype
248# so the packet is converted to a raw IP packet, which when read
249# back in again doesn't match legacyatm's original packet.
250#echo " * legacyatm -> pcapfile"
251#rm -f traces/*.out.*
252#./test-convert legacyatm pcapfile
253
254echo " * legacyeth -> pcapfile"
255rm -f traces/*.out.*
256do_test ./test-convert legacyeth pcapfile
257
258echo " * legacypos -> pcapfile"
259rm -f traces/*.out.*
260do_test ./test-convert legacypos pcapfile
261
262# Don't bother with this anymore -- DUCK qualifies as 'meta' so
263# doesn't get written at the moment.
264#echo " * duck -> duck"
265#rm -f traces/*.out.*
266#do_test ./test-convert duck duck
267
268echo " * tsh -> pcapfile"
269rm -f traces/*.out.*
270do_test ./test-convert tsh pcapfile
271
272echo " * tsh -> pcap"
273rm -f traces/*.out.*
274do_test ./test-convert tsh pcap
275
276echo \* Testing packet truncation
277echo " * pcap "
278rm -f traces/*.out.*
279do_test ./test-setcaplen pcap pcapfile
280
281echo " * pcapfile "
282rm -f traces/*.out.*
283do_test ./test-setcaplen pcapfile pcapfile
284
285echo " * erf "
286rm -f traces/*.out.*
287do_test ./test-setcaplen erf erf
288
289echo " * pcapng "
290rm -f traces/*.out.*
291do_test ./test-setcaplen pcapng pcapfile
292
293echo " * pcapfilens "
294rm -f traces/*.out.*
295do_test ./test-setcaplen pcapfilens pcapfile
296
297
298
299echo " * format autodetection - uncompressed"
300do_test ./test-autodetect traces/5_packets.erf
301echo " * format autodetection - gzip"
302do_test ./test-autodetect traces/5_packets.erf.gz
303echo " * format autodetection - bzip2"
304do_test ./test-autodetect traces/5_packets.erf.bz2
305echo " * format autodetection - lzma"
306do_test ./test-autodetect traces/5_packets.erf.xz
307
308echo " * VXLan decode"
309do_test ./test-vxlan
310
311echo
312echo "Tests passed: $OK"
313echo "Tests failed: $FAIL"
Note: See TracBrowser for help on using the repository browser.