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