aboutsummaryrefslogtreecommitdiff
path: root/testdata/fwd_ancil.tdir/fwd_ancil.test
blob: b5d063aa0184019304cbad8755c6d0b7595dc83d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# #-- fwd_ancil.test --#
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test

PRE="../.."
. ../common.sh

if grep -F "disable interface-automatic" unbound.log; then
	echo "skip test"
	exit 0
fi

get_make
(cd $PRE; $MAKE streamtcp)

# detect platform support first
echo "> streamtcp -n -u -f 127.0.0.1 www.example.com. A IN"
$PRE/streamtcp -n -u -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN | tee outfile
sleep 2
echo "> check answer"
if ! grep "Please disable interface-automatic" unbound.log; then
	echo "OK"
else
	echo "No platform support for ancillary data"
	echo "> cat logfiles"
	cat fwd.log 
	cat unbound.log
	echo "Not OK - but ignore test"
	exit 0
fi
rm outfile


# do the test
echo "> streamtcp -f 127.0.0.1 www.example.com. A IN"
$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN | tee outfile
echo "> check answer"
if grep "10.20.30.40" outfile; then
	echo "OK"
else
	echo "> cat logfiles"
	cat fwd.log 
	cat unbound.log
	echo "Not OK"
	exit 1
fi
rm outfile

echo "> streamtcp -f ::1 www.example.com. A IN"
$PRE/streamtcp -f ::1@$UNBOUND_PORT www.example.com. A IN | tee outfile
echo "> check answer"
if grep "10.20.30.40" outfile; then
	echo "OK"
else
	echo "> cat logfiles"
	cat fwd.log 
	cat unbound.log
	echo "Not OK"
	exit 1
fi
rm outfile

echo "> streamtcp -u -f ::1 www.example.com. A IN"
$PRE/streamtcp -u -f ::1@$UNBOUND_PORT www.example.com. A IN | tee outfile
echo "> check answer"
if grep "10.20.30.40" outfile; then
	echo "OK"
else
	echo "> cat logfiles"
	cat fwd.log 
	cat unbound.log
	echo "Not OK"
	exit 1
fi
rm outfile

echo "> streamtcp -u -f 127.0.0.1 www.example.com. A IN"
$PRE/streamtcp -u -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN | tee outfile
echo "> check answer"
if grep "10.20.30.40" outfile; then
	echo "OK"
else
	echo "> cat logfiles"
	cat fwd.log 
	cat unbound.log
	echo "Not OK"
	exit 1
fi
rm outfile

echo "> cat logfiles"
cat fwd.log 
cat unbound.log
exit 0