aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-09-30 09:07:43 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-09-30 09:07:43 +0000
commite8873abb7cd92b5b71785a0e5a24de68fae40b21 (patch)
treebf3f1dc83828d613c3a093ad7687e3a09825cec8 /src/namestore
parent4a2bfd0f2a0c0dae8417d7b643ccf33250354d85 (diff)
downloadgnunet-e8873abb7cd92b5b71785a0e5a24de68fae40b21.tar.gz
gnunet-e8873abb7cd92b5b71785a0e5a24de68fae40b21.zip
new namestore CLI tests
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/Makefile.am35
-rwxr-xr-xsrc/namestore/test_namestore_lookup.sh64
-rwxr-xr-xsrc/namestore/test_namestore_put.sh42
3 files changed, 127 insertions, 14 deletions
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index 0cb08fc77..13f025b75 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -62,7 +62,9 @@ check_PROGRAMS = \
62endif 62endif
63 63
64if ENABLE_TEST_RUN 64if ENABLE_TEST_RUN
65TESTS = $(check_PROGRAMS) 65TESTS = \
66 $(check_PROGRAMS) \
67 $(check_SCRIPTS)
66endif 68endif
67 69
68lib_LTLIBRARIES = \ 70lib_LTLIBRARIES = \
@@ -266,18 +268,6 @@ test_namestore_record_serialization_LDADD = \
266 $(top_builddir)/src/util/libgnunetutil.la \ 268 $(top_builddir)/src/util/libgnunetutil.la \
267 $(top_builddir)/src/namestore/libgnunetnamestore.la 269 $(top_builddir)/src/namestore/libgnunetnamestore.la
268 270
269EXTRA_DIST = \
270 test_namestore_api.conf \
271 test_plugin_namestore_sqlite.conf \
272 test_plugin_namestore_postgres.conf \
273 test_hostkey \
274 zonefiles/S5I9DSGQVAB5FVV16T3B3CC5H1B2JGL3Q412JBKURME8EKU0600G.zkey \
275 zonefiles/AQ835GVL939H4O8QJQ7GBLPTQC0QAAO91BN7QK01BA63MDSK6I4G.zkey \
276 zonefiles/HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey \
277 zonefiles/N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey
278
279
280
281test_plugin_namestore_sqlite_SOURCES = \ 271test_plugin_namestore_sqlite_SOURCES = \
282 test_plugin_namestore.c 272 test_plugin_namestore.c
283test_plugin_namestore_sqlite_LDADD = \ 273test_plugin_namestore_sqlite_LDADD = \
@@ -288,4 +278,21 @@ test_plugin_namestore_postgres_SOURCES = \
288 test_plugin_namestore.c 278 test_plugin_namestore.c
289test_plugin_namestore_postgres_LDADD = \ 279test_plugin_namestore_postgres_LDADD = \
290 $(top_builddir)/src/testing/libgnunettesting.la \ 280 $(top_builddir)/src/testing/libgnunettesting.la \
291 $(top_builddir)/src/util/libgnunetutil.la 281 $(top_builddir)/src/util/libgnunetutil.la
282
283check_SCRIPTS = \
284 test_namestore_put.sh \
285 test_namestore_lookup.sh
286
287EXTRA_DIST = \
288 test_namestore_api.conf \
289 test_plugin_namestore_sqlite.conf \
290 test_plugin_namestore_postgres.conf \
291 test_namestore_defaults.conf \
292 test_hostkey \
293 zonefiles/S5I9DSGQVAB5FVV16T3B3CC5H1B2JGL3Q412JBKURME8EKU0600G.zkey \
294 zonefiles/AQ835GVL939H4O8QJQ7GBLPTQC0QAAO91BN7QK01BA63MDSK6I4G.zkey \
295 zonefiles/HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey \
296 zonefiles/N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey \
297 $(check_SCRIPTS)
298
diff --git a/src/namestore/test_namestore_lookup.sh b/src/namestore/test_namestore_lookup.sh
new file mode 100755
index 000000000..da4724ebf
--- /dev/null
+++ b/src/namestore/test_namestore_lookup.sh
@@ -0,0 +1,64 @@
1#!/bin/bash
2CONFIGURATION="test_namestore_defaults.conf"
3trap "gnunet-arm -e -c $CONFIGURATION" SIGINT
4rm -rf `gnunet-config -c $CONFIGURATION -s PATHS -o SERVICEHOME`
5TEST_DOMAIN_PLUS="www.gnu"
6TEST_DOMAIN_DNS="www3.gnu"
7TEST_IP_PLUS="127.0.0.1"
8TEST_IP_DNS="131.159.74.67"
9TEST_RECORD_CNAME_SERVER="server"
10TEST_RECORD_CNAME_PLUS="server.+"
11TEST_RECORD_CNAME_DNS="gnunet.org"
12TEST_RECORD_NAME_SERVER="server"
13TEST_RECORD_NAME_PLUS="www"
14TEST_RECORD_NAME_DNS="www3"
15which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
16
17function start_peer
18{
19 gnunet-arm -s -c $CONFIGURATION
20 gnunet-identity -C testego -c $CONFIGURATION
21}
22
23function stop_peer
24{
25 gnunet-identity -D testego -c $CONFIGURATION
26 gnunet-arm -e -c $CONFIGURATION
27}
28
29
30start_peer
31# Create a public record
32gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION
33NAMESTORE_RES=$?
34# Lookup specific name
35OUTPUT=`gnunet-namestore -p -z testego -n $TEST_RECORD_NAME_DNS -D`
36
37
38FOUND_IP=false
39FOUND_NAME=false
40for LINE in $OUTPUT ;
41 do
42 if echo "$LINE" | grep -q "$TEST_RECORD_NAME_DNS"; then
43 FOUND_DNS=true;
44 fi
45 if echo "$LINE" | grep -q "$TEST_IP_PLUS"; then
46 FOUND_IP=true;
47 fi
48 done
49stop_peer
50
51
52if [ $FOUND_DNS == true -a $FOUND_IP == true ]
53then
54 echo "PASS: Lookup name in namestore"
55 exit 0
56elif [ $FOUND_DNS == false ]
57then
58 echo "FAIL: Lookup name in namestore: name not returned"
59 exit 1
60elif [ $FOUND_IP == false ]
61then
62 echo "FAIL: Lookup name in namestore: IP not returned"
63 exit 1
64fi
diff --git a/src/namestore/test_namestore_put.sh b/src/namestore/test_namestore_put.sh
new file mode 100755
index 000000000..1e8b0bd46
--- /dev/null
+++ b/src/namestore/test_namestore_put.sh
@@ -0,0 +1,42 @@
1#!/bin/bash
2CONFIGURATION="test_namestore_defaults.conf"
3trap "gnunet-arm -e -c $CONFIGURATION" SIGINT
4rm -rf `gnunet-config -c $CONFIGURATION -s PATHS -o SERVICEHOME`
5TEST_DOMAIN_PLUS="www.gnu"
6TEST_DOMAIN_DNS="www3.gnu"
7TEST_IP_PLUS="127.0.0.1"
8TEST_IP_DNS="131.159.74.67"
9TEST_RECORD_CNAME_SERVER="server"
10TEST_RECORD_CNAME_PLUS="server.+"
11TEST_RECORD_CNAME_DNS="gnunet.org"
12TEST_RECORD_NAME_SERVER="server"
13TEST_RECORD_NAME_PLUS="www"
14TEST_RECORD_NAME_DNS="www3"
15which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
16
17function start_peer
18{
19 gnunet-arm -s -c $CONFIGURATION
20 gnunet-identity -C testego -c $CONFIGURATION
21}
22
23function stop_peer
24{
25 gnunet-identity -D testego -c $CONFIGURATION
26 gnunet-arm -e -c $CONFIGURATION
27}
28
29
30start_peer
31# Create a public record
32gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION
33NAMESTORE_RES=$?
34stop_peer
35
36if [ $NAMESTORE_RES == 0 ]
37then
38 echo "PASS: Creating name in namestore"
39else
40 echo "FAIL: Creating name in namestore failed with $NAMESTORE_RES."
41 exit 1
42fi