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