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