aboutsummaryrefslogtreecommitdiff
path: root/src/dht/test_dht_tools.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/test_dht_tools.sh')
-rwxr-xr-xsrc/dht/test_dht_tools.sh21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/dht/test_dht_tools.sh b/src/dht/test_dht_tools.sh
index f83c26a1a..56cc99e15 100755
--- a/src/dht/test_dht_tools.sh
+++ b/src/dht/test_dht_tools.sh
@@ -1,7 +1,8 @@
1#!/bin/sh 1#!/bin/sh
2# This file is in the public domain.
2 3
3out=`mktemp /tmp/test-gnunet-dht-logXXXXXXXX` 4out=`mktemp /tmp/test-gnunet-dht-logXXXXXXXX`
4tempcfg=`mktemp /tmp/test_dht_api_peer1.XXXXXXXX` 5tempcfg=`mktemp /tmp/test-dht-tools.XXXXXXXX`
5checkout="check.out" 6checkout="check.out"
6armexe="gnunet-arm -c $tempcfg " 7armexe="gnunet-arm -c $tempcfg "
7putexe="gnunet-dht-put -c $tempcfg " 8putexe="gnunet-dht-put -c $tempcfg "
@@ -19,16 +20,7 @@ stop_arm()
19 rm -f $out $tempcfg 20 rm -f $out $tempcfg
20} 21}
21 22
22cp test_dht_api_peer1.conf $tempcfg 23cp test_dht_tools.conf $tempcfg
23
24echo -n "TEST: Generating hostkey..."
25if ! $peerinfo > $out ; then
26 echo "FAIL: error running $peerinfo"
27 echo "Command output was:"
28 cat $out
29 exit 1
30fi
31echo "PASS"
32 24
33echo -n "TEST: Starting ARM..." 25echo -n "TEST: Starting ARM..."
34if ! $armexe $DEBUG -s > $out ; then 26if ! $armexe $DEBUG -s > $out ; then
@@ -39,7 +31,6 @@ if ! $armexe $DEBUG -s > $out ; then
39 exit 1 31 exit 1
40fi 32fi
41echo "PASS" 33echo "PASS"
42sleep 1
43 34
44echo -n "TEST: Testing put..." 35echo -n "TEST: Testing put..."
45if ! $putexe -k testkey -d testdata -t 8 > $out ; then 36if ! $putexe -k testkey -d testdata -t 8 > $out ; then
@@ -50,13 +41,12 @@ if ! $putexe -k testkey -d testdata -t 8 > $out ; then
50 exit 1 41 exit 1
51fi 42fi
52echo "PASS" 43echo "PASS"
53sleep 1
54 44
55echo -n "TEST: Testing get..." 45echo -n "TEST: Testing get..."
56echo "Result 0, type 8:" > $checkout 46echo "Result 0, type 8:" > $checkout
57echo "testdata" >> $checkout 47echo "testdata" >> $checkout
58 48
59if ! $getexe -k testkey -T 5 -t 8 > $out ; then 49if ! $getexe -k testkey -T 100ms -t 8 > $out ; then
60 echo "FAIL: error running $putexe" 50 echo "FAIL: error running $putexe"
61 echo "Command output was:" 51 echo "Command output was:"
62 cat $out 52 cat $out
@@ -65,7 +55,8 @@ if ! $getexe -k testkey -T 5 -t 8 > $out ; then
65fi 55fi
66 56
67if ! diff --strip-trailing-cr -q $out $checkout ; then 57if ! diff --strip-trailing-cr -q $out $checkout ; then
68 echo "FAIL: $out and $checkout differ" 58 echo "FAIL: $out and $checkout differ:"
59 diff --strip-trailing-cr $out $checkout
69 stop_arm 60 stop_arm
70 exit 1 61 exit 1
71fi 62fi