diff options
-rw-r--r-- | src/namestore/Makefile.am | 35 | ||||
-rwxr-xr-x | src/namestore/test_namestore_lookup.sh | 64 | ||||
-rwxr-xr-x | src/namestore/test_namestore_put.sh | 42 |
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 = \ | |||
62 | endif | 62 | endif |
63 | 63 | ||
64 | if ENABLE_TEST_RUN | 64 | if ENABLE_TEST_RUN |
65 | TESTS = $(check_PROGRAMS) | 65 | TESTS = \ |
66 | $(check_PROGRAMS) \ | ||
67 | $(check_SCRIPTS) | ||
66 | endif | 68 | endif |
67 | 69 | ||
68 | lib_LTLIBRARIES = \ | 70 | lib_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 | ||
269 | EXTRA_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 | |||
281 | test_plugin_namestore_sqlite_SOURCES = \ | 271 | test_plugin_namestore_sqlite_SOURCES = \ |
282 | test_plugin_namestore.c | 272 | test_plugin_namestore.c |
283 | test_plugin_namestore_sqlite_LDADD = \ | 273 | test_plugin_namestore_sqlite_LDADD = \ |
@@ -288,4 +278,21 @@ test_plugin_namestore_postgres_SOURCES = \ | |||
288 | test_plugin_namestore.c | 278 | test_plugin_namestore.c |
289 | test_plugin_namestore_postgres_LDADD = \ | 279 | test_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 | |||
283 | check_SCRIPTS = \ | ||
284 | test_namestore_put.sh \ | ||
285 | test_namestore_lookup.sh | ||
286 | |||
287 | EXTRA_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 | ||
2 | CONFIGURATION="test_namestore_defaults.conf" | ||
3 | trap "gnunet-arm -e -c $CONFIGURATION" SIGINT | ||
4 | rm -rf `gnunet-config -c $CONFIGURATION -s PATHS -o SERVICEHOME` | ||
5 | TEST_DOMAIN_PLUS="www.gnu" | ||
6 | TEST_DOMAIN_DNS="www3.gnu" | ||
7 | TEST_IP_PLUS="127.0.0.1" | ||
8 | TEST_IP_DNS="131.159.74.67" | ||
9 | TEST_RECORD_CNAME_SERVER="server" | ||
10 | TEST_RECORD_CNAME_PLUS="server.+" | ||
11 | TEST_RECORD_CNAME_DNS="gnunet.org" | ||
12 | TEST_RECORD_NAME_SERVER="server" | ||
13 | TEST_RECORD_NAME_PLUS="www" | ||
14 | TEST_RECORD_NAME_DNS="www3" | ||
15 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | ||
16 | |||
17 | function start_peer | ||
18 | { | ||
19 | gnunet-arm -s -c $CONFIGURATION | ||
20 | gnunet-identity -C testego -c $CONFIGURATION | ||
21 | } | ||
22 | |||
23 | function stop_peer | ||
24 | { | ||
25 | gnunet-identity -D testego -c $CONFIGURATION | ||
26 | gnunet-arm -e -c $CONFIGURATION | ||
27 | } | ||
28 | |||
29 | |||
30 | start_peer | ||
31 | # Create a public record | ||
32 | gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION | ||
33 | NAMESTORE_RES=$? | ||
34 | # Lookup specific name | ||
35 | OUTPUT=`gnunet-namestore -p -z testego -n $TEST_RECORD_NAME_DNS -D` | ||
36 | |||
37 | |||
38 | FOUND_IP=false | ||
39 | FOUND_NAME=false | ||
40 | for 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 | ||
49 | stop_peer | ||
50 | |||
51 | |||
52 | if [ $FOUND_DNS == true -a $FOUND_IP == true ] | ||
53 | then | ||
54 | echo "PASS: Lookup name in namestore" | ||
55 | exit 0 | ||
56 | elif [ $FOUND_DNS == false ] | ||
57 | then | ||
58 | echo "FAIL: Lookup name in namestore: name not returned" | ||
59 | exit 1 | ||
60 | elif [ $FOUND_IP == false ] | ||
61 | then | ||
62 | echo "FAIL: Lookup name in namestore: IP not returned" | ||
63 | exit 1 | ||
64 | fi | ||
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 | ||
2 | CONFIGURATION="test_namestore_defaults.conf" | ||
3 | trap "gnunet-arm -e -c $CONFIGURATION" SIGINT | ||
4 | rm -rf `gnunet-config -c $CONFIGURATION -s PATHS -o SERVICEHOME` | ||
5 | TEST_DOMAIN_PLUS="www.gnu" | ||
6 | TEST_DOMAIN_DNS="www3.gnu" | ||
7 | TEST_IP_PLUS="127.0.0.1" | ||
8 | TEST_IP_DNS="131.159.74.67" | ||
9 | TEST_RECORD_CNAME_SERVER="server" | ||
10 | TEST_RECORD_CNAME_PLUS="server.+" | ||
11 | TEST_RECORD_CNAME_DNS="gnunet.org" | ||
12 | TEST_RECORD_NAME_SERVER="server" | ||
13 | TEST_RECORD_NAME_PLUS="www" | ||
14 | TEST_RECORD_NAME_DNS="www3" | ||
15 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | ||
16 | |||
17 | function start_peer | ||
18 | { | ||
19 | gnunet-arm -s -c $CONFIGURATION | ||
20 | gnunet-identity -C testego -c $CONFIGURATION | ||
21 | } | ||
22 | |||
23 | function stop_peer | ||
24 | { | ||
25 | gnunet-identity -D testego -c $CONFIGURATION | ||
26 | gnunet-arm -e -c $CONFIGURATION | ||
27 | } | ||
28 | |||
29 | |||
30 | start_peer | ||
31 | # Create a public record | ||
32 | gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION | ||
33 | NAMESTORE_RES=$? | ||
34 | stop_peer | ||
35 | |||
36 | if [ $NAMESTORE_RES == 0 ] | ||
37 | then | ||
38 | echo "PASS: Creating name in namestore" | ||
39 | else | ||
40 | echo "FAIL: Creating name in namestore failed with $NAMESTORE_RES." | ||
41 | exit 1 | ||
42 | fi | ||