xref: /freebsd/contrib/unbound/testcode/do-tests.sh (revision be771a7b7f4580a30d99e41a5bb1b93a385a119d)
1*be771a7bSCy Schubert#!/usr/bin/env bash
2*be771a7bSCy Schubert. testdata/common.sh
3*be771a7bSCy Schubertquiet=0
4*be771a7bSCy Schubertif test "$1" = "-q"; then
5*be771a7bSCy Schubert	quiet=1
6*be771a7bSCy Schubert	tdirarg="-q"
7*be771a7bSCy Schubert	shift
8*be771a7bSCy Schubertfi
9*be771a7bSCy Schubert
10*be771a7bSCy SchubertNEED_SPLINT='00-lint.tdir'
11*be771a7bSCy SchubertNEED_DOXYGEN='01-doc.tdir'
12*be771a7bSCy SchubertNEED_XXD='fwd_compress_c00c.tdir fwd_zero.tdir'
13*be771a7bSCy SchubertNEED_NC='fwd_compress_c00c.tdir fwd_zero.tdir'
14*be771a7bSCy SchubertNEED_CURL='06-ianaports.tdir root_anchor.tdir'
15*be771a7bSCy SchubertNEED_WHOAMI='07-confroot.tdir'
16*be771a7bSCy SchubertNEED_IPV6='fwd_ancil.tdir fwd_tcp_tc6.tdir stub_udp6.tdir edns_cache.tdir'
17*be771a7bSCy SchubertNEED_NOMINGW='tcp_sigpipe.tdir 07-confroot.tdir 08-host-lib.tdir fwd_ancil.tdir'
18*be771a7bSCy SchubertNEED_DNSCRYPT_PROXY='dnscrypt_queries.tdir dnscrypt_queries_chacha.tdir'
19*be771a7bSCy SchubertNEED_UNSHARE='acl_interface.tdir proxy_protocol.tdir'
20*be771a7bSCy SchubertNEED_REDIS_SERVER='redis_replica.tdir'
21*be771a7bSCy Schubert
22*be771a7bSCy Schubert# test if dig and ldns-testns are available.
23*be771a7bSCy Schuberttest_tool_avail "dig"
24*be771a7bSCy Schuberttest_tool_avail "ldns-testns"
25*be771a7bSCy Schubert
26*be771a7bSCy Schubert# test for ipv6, uses streamtcp peculiarity.
27*be771a7bSCy Schubertif ./streamtcp -f ::1 2>&1 | grep "not supported" >/dev/null 2>&1; then
28*be771a7bSCy Schubert	HAVE_IPV6=no
29*be771a7bSCy Schubertelse
30*be771a7bSCy Schubert	HAVE_IPV6=yes
31*be771a7bSCy Schubertfi
32*be771a7bSCy Schubert
33*be771a7bSCy Schubert# test mingw. no signals and so on.
34*be771a7bSCy Schubertif uname | grep MINGW >/dev/null; then
35*be771a7bSCy Schubert	HAVE_MINGW=yes
36*be771a7bSCy Schubertelse
37*be771a7bSCy Schubert	HAVE_MINGW=no
38*be771a7bSCy Schubertfi
39*be771a7bSCy Schubert
40*be771a7bSCy Schubert# stop tests from notifying systemd, if that is compiled in.
41*be771a7bSCy Schubertexport -n NOTIFY_SOCKET
42*be771a7bSCy Schubert
43*be771a7bSCy Schubertcd testdata;
44*be771a7bSCy Schubertsh ../testcode/mini_tdir.sh $tdirarg clean
45*be771a7bSCy Schubertrm -f .perfstats.txt
46*be771a7bSCy Schubertfor test in `ls -d *.tdir`; do
47*be771a7bSCy Schubert	SKIP=0
48*be771a7bSCy Schubert	skip_if_in_list $test "$NEED_SPLINT" "splint"
49*be771a7bSCy Schubert	skip_if_in_list $test "$NEED_DOXYGEN" "doxygen"
50*be771a7bSCy Schubert	skip_if_in_list $test "$NEED_CURL" "curl"
51*be771a7bSCy Schubert	skip_if_in_list $test "$NEED_XXD" "xxd"
52*be771a7bSCy Schubert	skip_if_in_list $test "$NEED_NC" "nc"
53*be771a7bSCy Schubert	skip_if_in_list $test "$NEED_WHOAMI" "whoami"
54*be771a7bSCy Schubert	skip_if_in_list $test "$NEED_DNSCRYPT_PROXY" "dnscrypt-proxy"
55*be771a7bSCy Schubert	skip_if_in_list $test "$NEED_UNSHARE" "unshare"
56*be771a7bSCy Schubert	skip_if_in_list $test "$NEED_REDIS_SERVER" "redis-server"
57*be771a7bSCy Schubert
58*be771a7bSCy Schubert	if echo $NEED_IPV6 | grep $test >/dev/null; then
59*be771a7bSCy Schubert		if test "$HAVE_IPV6" = no; then
60*be771a7bSCy Schubert			SKIP=1;
61*be771a7bSCy Schubert		fi
62*be771a7bSCy Schubert	fi
63*be771a7bSCy Schubert	if echo $NEED_NOMINGW | grep $test >/dev/null; then
64*be771a7bSCy Schubert		if test "$HAVE_MINGW" = yes; then
65*be771a7bSCy Schubert			SKIP=1;
66*be771a7bSCy Schubert		fi
67*be771a7bSCy Schubert	fi
68*be771a7bSCy Schubert	if test $SKIP -eq 0; then
69*be771a7bSCy Schubert		echo $test
70*be771a7bSCy Schubert		sh ../testcode/mini_tdir.sh -a ../.. $tdirarg exe $test
71*be771a7bSCy Schubert	else
72*be771a7bSCy Schubert		echo "skip $test"
73*be771a7bSCy Schubert	fi
74*be771a7bSCy Schubertdone
75*be771a7bSCy Schubertsh ../testcode/mini_tdir.sh $tdirarg report
76*be771a7bSCy Schubertcat .perfstats.txt
77