endif
if ENABLE_TEST_RUN
-TESTS = $(check_PROGRAMS)
+TESTS = \
+ $(check_PROGRAMS) \
+ $(check_SCRIPTS)
endif
lib_LTLIBRARIES = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la
-EXTRA_DIST = \
- test_namestore_api.conf \
- test_plugin_namestore_sqlite.conf \
- test_plugin_namestore_postgres.conf \
- test_hostkey \
- zonefiles/S5I9DSGQVAB5FVV16T3B3CC5H1B2JGL3Q412JBKURME8EKU0600G.zkey \
- zonefiles/AQ835GVL939H4O8QJQ7GBLPTQC0QAAO91BN7QK01BA63MDSK6I4G.zkey \
- zonefiles/HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey \
- zonefiles/N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey
-
-
-
test_plugin_namestore_sqlite_SOURCES = \
test_plugin_namestore.c
test_plugin_namestore_sqlite_LDADD = \
test_plugin_namestore.c
test_plugin_namestore_postgres_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/util/libgnunetutil.la
+
+check_SCRIPTS = \
+ test_namestore_put.sh \
+ test_namestore_lookup.sh
+
+EXTRA_DIST = \
+ test_namestore_api.conf \
+ test_plugin_namestore_sqlite.conf \
+ test_plugin_namestore_postgres.conf \
+ test_namestore_defaults.conf \
+ test_hostkey \
+ zonefiles/S5I9DSGQVAB5FVV16T3B3CC5H1B2JGL3Q412JBKURME8EKU0600G.zkey \
+ zonefiles/AQ835GVL939H4O8QJQ7GBLPTQC0QAAO91BN7QK01BA63MDSK6I4G.zkey \
+ zonefiles/HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey \
+ zonefiles/N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey \
+ $(check_SCRIPTS)
+
--- /dev/null
+#!/bin/bash
+CONFIGURATION="test_namestore_defaults.conf"
+trap "gnunet-arm -e -c $CONFIGURATION" SIGINT
+rm -rf `gnunet-config -c $CONFIGURATION -s PATHS -o SERVICEHOME`
+TEST_DOMAIN_PLUS="www.gnu"
+TEST_DOMAIN_DNS="www3.gnu"
+TEST_IP_PLUS="127.0.0.1"
+TEST_IP_DNS="131.159.74.67"
+TEST_RECORD_CNAME_SERVER="server"
+TEST_RECORD_CNAME_PLUS="server.+"
+TEST_RECORD_CNAME_DNS="gnunet.org"
+TEST_RECORD_NAME_SERVER="server"
+TEST_RECORD_NAME_PLUS="www"
+TEST_RECORD_NAME_DNS="www3"
+which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
+
+function start_peer
+{
+ gnunet-arm -s -c $CONFIGURATION
+ gnunet-identity -C testego -c $CONFIGURATION
+}
+
+function stop_peer
+{
+ gnunet-identity -D testego -c $CONFIGURATION
+ gnunet-arm -e -c $CONFIGURATION
+}
+
+
+start_peer
+# Create a public record
+gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION
+NAMESTORE_RES=$?
+# Lookup specific name
+OUTPUT=`gnunet-namestore -p -z testego -n $TEST_RECORD_NAME_DNS -D`
+
+
+FOUND_IP=false
+FOUND_NAME=false
+for LINE in $OUTPUT ;
+ do
+ if echo "$LINE" | grep -q "$TEST_RECORD_NAME_DNS"; then
+ FOUND_DNS=true;
+ fi
+ if echo "$LINE" | grep -q "$TEST_IP_PLUS"; then
+ FOUND_IP=true;
+ fi
+ done
+stop_peer
+
+
+if [ $FOUND_DNS == true -a $FOUND_IP == true ]
+then
+ echo "PASS: Lookup name in namestore"
+ exit 0
+elif [ $FOUND_DNS == false ]
+then
+ echo "FAIL: Lookup name in namestore: name not returned"
+ exit 1
+elif [ $FOUND_IP == false ]
+then
+ echo "FAIL: Lookup name in namestore: IP not returned"
+ exit 1
+fi
--- /dev/null
+#!/bin/bash
+CONFIGURATION="test_namestore_defaults.conf"
+trap "gnunet-arm -e -c $CONFIGURATION" SIGINT
+rm -rf `gnunet-config -c $CONFIGURATION -s PATHS -o SERVICEHOME`
+TEST_DOMAIN_PLUS="www.gnu"
+TEST_DOMAIN_DNS="www3.gnu"
+TEST_IP_PLUS="127.0.0.1"
+TEST_IP_DNS="131.159.74.67"
+TEST_RECORD_CNAME_SERVER="server"
+TEST_RECORD_CNAME_PLUS="server.+"
+TEST_RECORD_CNAME_DNS="gnunet.org"
+TEST_RECORD_NAME_SERVER="server"
+TEST_RECORD_NAME_PLUS="www"
+TEST_RECORD_NAME_DNS="www3"
+which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
+
+function start_peer
+{
+ gnunet-arm -s -c $CONFIGURATION
+ gnunet-identity -C testego -c $CONFIGURATION
+}
+
+function stop_peer
+{
+ gnunet-identity -D testego -c $CONFIGURATION
+ gnunet-arm -e -c $CONFIGURATION
+}
+
+
+start_peer
+# Create a public record
+gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION
+NAMESTORE_RES=$?
+stop_peer
+
+if [ $NAMESTORE_RES == 0 ]
+then
+ echo "PASS: Creating name in namestore"
+else
+ echo "FAIL: Creating name in namestore failed with $NAMESTORE_RES."
+ exit 1
+fi