summaryrefslogtreecommitdiff
path: root/testdata/dnscrypt_cert_chacha.tdir/dnscrypt_cert_chacha.pre
diff options
context:
space:
mode:
Diffstat (limited to 'testdata/dnscrypt_cert_chacha.tdir/dnscrypt_cert_chacha.pre')
-rw-r--r--testdata/dnscrypt_cert_chacha.tdir/dnscrypt_cert_chacha.pre43
1 files changed, 43 insertions, 0 deletions
diff --git a/testdata/dnscrypt_cert_chacha.tdir/dnscrypt_cert_chacha.pre b/testdata/dnscrypt_cert_chacha.tdir/dnscrypt_cert_chacha.pre
new file mode 100644
index 000000000000..c77290a8ab7d
--- /dev/null
+++ b/testdata/dnscrypt_cert_chacha.tdir/dnscrypt_cert_chacha.pre
@@ -0,0 +1,43 @@
+# #-- dnscrypt_cert_chacha.pre--#
+# 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
+
+# Check if we can run the test.
+. ./precheck.sh
+
+get_random_port 3
+UNBOUND_PORT=$RND_PORT
+FWD_PORT=$(($RND_PORT + 1))
+DNSCRYPT_PORT=$(($RND_PORT + 2))
+echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
+echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
+echo "DNSCRYPT_PORT=$DNSCRYPT_PORT" >> .tpkg.var.test
+
+# start forwarder
+get_ldns_testns
+$LDNS_TESTNS -p $FWD_PORT dnscrypt_cert_chacha.testns >fwd.log 2>&1 &
+FWD_PID=$!
+echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
+
+# make config file
+sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' \
+ -e 's/@DNSCRYPT_PORT\@/'$DNSCRYPT_PORT'/' < dnscrypt_cert_chacha.conf > ub.conf
+# start unbound in the background
+$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
+UNBOUND_PID=$!
+echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
+
+cat .tpkg.var.test
+wait_ldns_testns_up fwd.log
+if [ $xchacha20 -eq 0 ]; then
+ # no xchacha20 support, we expect unbound to exit with an error message.
+ wait_server_up unbound.log "Certificate for XChacha20 but libsodium does not support it"
+else
+ wait_unbound_up unbound.log
+fi
+