diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-04-05 14:47:28 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-04-05 14:47:28 +0000 |
commit | 05aa3418d8abd5f9ff35b130fdc59e52e3c9df9b (patch) | |
tree | 5ac77291332ea251bf16918739cf5beac13fb2f5 /src/dht/test_dht_tools.sh | |
parent | 086481b8012d98192db673c3e066c74415c345a7 (diff) | |
download | gnunet-05aa3418d8abd5f9ff35b130fdc59e52e3c9df9b.tar.gz gnunet-05aa3418d8abd5f9ff35b130fdc59e52e3c9df9b.zip |
put and get testcase
Diffstat (limited to 'src/dht/test_dht_tools.sh')
-rwxr-xr-x | src/dht/test_dht_tools.sh | 60 |
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 | |||
3 | armexe="gnunet-arm -c test_dht_api_peer1.conf " | ||
4 | putexe="gnunet-dht-put -c test_dht_api_peer1.conf " | ||
5 | getexe="gnunet-dht-get -c test_dht_api_peer1.conf " | ||
6 | out=`mktemp /tmp/test-gnunet-arm-logXXXXXXXX` | ||
7 | checkout="check.out" | ||
8 | |||
9 | stop_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 | |||
20 | echo -n "TEST: Starting ARM..." | ||
21 | if ! $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 | ||
27 | fi | ||
28 | echo "PASS" | ||
29 | sleep 1 | ||
30 | |||
31 | echo -n "TEST: Testing put..." | ||
32 | if ! $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 | ||
38 | fi | ||
39 | echo "PASS" | ||
40 | sleep 1 | ||
41 | |||
42 | echo -n "TEST: Testing get..." | ||
43 | echo "Result 0, type 0:" > $checkout | ||
44 | echo "testdata" >> $checkout | ||
45 | |||
46 | if ! $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 | ||
52 | fi | ||
53 | if ! diff -q $out $checkout ; then | ||
54 | echo "FAIL: $out and $checkout differ" | ||
55 | stop_arm | ||
56 | exit 1 | ||
57 | fi | ||
58 | echo "PASS" | ||
59 | |||
60 | stop_arm | ||