From 9bce094f751c1e80a41c4ea509845205e8842845 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 17 Jan 2012 22:25:52 +0000 Subject: [PATCH] -adding testcase --- src/dns/Makefile.am | 8 ++++++++ src/dns/test_gnunet_dns.sh | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100755 src/dns/test_gnunet_dns.sh diff --git a/src/dns/Makefile.am b/src/dns/Makefile.am index 5f9f39116..d8c2cd1c1 100644 --- a/src/dns/Makefile.am +++ b/src/dns/Makefile.am @@ -40,6 +40,9 @@ noinst_PROGRAMS = \ plugin_LTLIBRARIES = \ libgnunet_plugin_block_dns.la +check_SCRIPTS = \ + test_gnunet_dns.sh + gnunet_helper_dns_SOURCES = \ gnunet-helper-dns.c @@ -97,4 +100,9 @@ libgnunet_plugin_block_dns_la_LDFLAGS = \ $(top_builddir)/src/block/$(GN_PLUGIN_LDFLAGS) +if ENABLE_TEST_RUN +TESTS = $(check_PROGRAMS) $(check_SCRIPTS) +endif +EXTRA_DIST = \ + $(check_SCRIPTS) diff --git a/src/dns/test_gnunet_dns.sh b/src/dns/test_gnunet_dns.sh new file mode 100755 index 000000000..35585d46e --- /dev/null +++ b/src/dns/test_gnunet_dns.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +ME=`whoami` +if [ "$ME" != "root" ] +then + echo "This test only works if run as root. Skipping." + exit 0 +fi +export PATH=".:$PATH" +gnunet-service-dns -c dns.conf & +gnunet-dns-redirector -c dns.conf -4 127.0.0.1 & +sleep 1 +LO=`nslookup gnunet.org | grep Address | tail -n1` +if [ "$LO" != "Address: 127.0.0.1" ] +then + echo "Fail: $LO" +fi +kill `jobs -p` -- 2.25.1