aboutsummaryrefslogtreecommitdiff
path: root/src/dht/test_dht_tools.sh
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-04-05 14:47:28 +0000
committerNathan S. Evans <evans@in.tum.de>2010-04-05 14:47:28 +0000
commit05aa3418d8abd5f9ff35b130fdc59e52e3c9df9b (patch)
tree5ac77291332ea251bf16918739cf5beac13fb2f5 /src/dht/test_dht_tools.sh
parent086481b8012d98192db673c3e066c74415c345a7 (diff)
downloadgnunet-05aa3418d8abd5f9ff35b130fdc59e52e3c9df9b.tar.gz
gnunet-05aa3418d8abd5f9ff35b130fdc59e52e3c9df9b.zip
put and get testcase
Diffstat (limited to 'src/dht/test_dht_tools.sh')
-rwxr-xr-xsrc/dht/test_dht_tools.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/dht/test_dht_tools.sh b/src/dht/test_dht_tools.sh
new file mode 100755
index 000000000..c026ecf0b
--- /dev/null
+++ b/src/dht/test_dht_tools.sh
@@ -0,0 +1,60 @@
1#!/bin/bash
2
3armexe="gnunet-arm -c test_dht_api_peer1.conf "
4putexe="gnunet-dht-put -c test_dht_api_peer1.conf "
5getexe="gnunet-dht-get -c test_dht_api_peer1.conf "
6out=`mktemp /tmp/test-gnunet-arm-logXXXXXXXX`
7checkout="check.out"
8
9stop_arm()
10{
11 if ! $armexe $DEBUG -e > $out ; then
12 echo "FAIL: error running $armexe"
13 echo "Command output was:"
14 cat $out
15 stop_arm
16 exit 1
17 fi
18}
19
20echo -n "TEST: Starting ARM..."
21if ! $armexe $DEBUG -s > $out ; then
22 echo "FAIL: error running $armexe"
23 echo "Command output was:"
24 cat $out
25 stop_arm
26 exit 1
27fi
28echo "PASS"
29sleep 1
30
31echo -n "TEST: Testing put..."
32if ! $putexe -k testkey -d testdata > $out ; then
33 echo "FAIL: error running $putexe"
34 echo "Command output was:"
35 cat $out
36 stop_arm
37 exit 1
38fi
39echo "PASS"
40sleep 1
41
42echo -n "TEST: Testing get..."
43echo "Result 0, type 0:" > $checkout
44echo "testdata" >> $checkout
45
46if ! $getexe -k testkey -T 1 > $out ; then
47 echo "FAIL: error running $putexe"
48 echo "Command output was:"
49 cat $out
50 stop_arm
51 exit 1
52fi
53if ! diff -q $out $checkout ; then
54 echo "FAIL: $out and $checkout differ"
55 stop_arm
56 exit 1
57fi
58echo "PASS"
59
60stop_arm