Debian Codegraph @

src/test/test2.sh

raw
1 #!/bin/sh -e
2 #
3 # DNS Reply Tool (drool)
4 #
5 # Copyright (c) 2017-2021, OARC, Inc.
6 # Copyright (c) 2017, Comcast Corporation
7 # All rights reserved.
8 #
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
11 # are met:
12 #
13 # 1. Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 #
16 # 2. Redistributions in binary form must reproduce the above copyright
17 # notice, this list of conditions and the following disclaimer in
18 # the documentation and/or other materials provided with the
19 # distribution.
20 #
21 # 3. Neither the name of the copyright holder nor the names of its
22 # contributors may be used to endorse or promote products derived
23 # from this software without specific prior written permission.
24 #
25 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 # POSSIBILITY OF SUCH DAMAGE.
37
38 . ./env.sh
39
40 export LUA_PATH="$srcdir/../lib/?.lua;$LUA_PATH"
41
42 if [ -n "$DROOL_TEST_NETWORK" ]; then
43 rm -f test2.out test2.out2
44 for pcap in ./dns.pcap-dist ./1qtcp.pcap-dist; do
45 ../drool replay -n --no-tcp "$pcap" 127.0.0.1 53 | tail -n 7 >>test2.out
46 ../drool replay -n --no-tcp "$pcap" ::1 53 | tail -n 7 >>test2.out
47 ../drool replay -T -n --no-tcp "$pcap" 127.0.0.1 53 | tail -n 7 >>test2-threads.out
48 ../drool replay -T -n --no-tcp "$pcap" ::1 53 | tail -n 7 >>test2-threads.out
49 done
50 awk '{print $1 " " $2}' <test2.out >test2.out2
51 diff test2.out2 "$srcdir/test2.gold"
52 awk '{print $1 " " $2}' <test2-threads.out >test2-threads.out2
53 diff test2-threads.out2 "$srcdir/test2.gold"
54 else
55 echo "Not testing network (set DROOL_TEST_NETWORK to enable)"
56 fi