remove valgrinds
[oweals/gnunet.git] / src / dht / test_dht_tools.sh
1 #!/bin/sh
2
3 out=`mktemp /tmp/test-gnunet-dht-logXXXXXXXX`
4 tempcfg=`mktemp /tmp/test_dht_api_peer1.XXXXXXXX`
5 checkout="check.out"
6 armexe="gnunet-arm -c $tempcfg "
7 putexe="gnunet-dht-put -c $tempcfg "
8 getexe="gnunet-dht-get -c $tempcfg "
9 peerinfo="gnunet-peerinfo -c $tempcfg -sq"
10 stop_arm()
11 {
12   if ! $armexe $DEBUG -e -d > $out ; then
13     echo "FAIL: error running $armexe"
14     echo "Command output was:"
15     cat $out
16     rm -f $out $tempcfg
17     exit 1
18   fi
19   rm -f $out $tempcfg
20 }
21
22 cp test_dht_api_peer1.conf $tempcfg
23
24 echo -n "TEST: Generating hostkey..."
25 if ! $peerinfo > $out ; then
26   echo "FAIL: error running $peerinfo"
27   echo "Command output was:"
28   cat $out 
29   exit 1
30 fi
31 echo "PASS"
32
33 echo -n "TEST: Starting ARM..."
34 if ! $armexe $DEBUG -s > $out ; then
35   echo "FAIL: error running $armexe"
36   echo "Command output was:"
37   cat $out
38   stop_arm
39   exit 1
40 fi
41 echo "PASS"
42 sleep 1
43
44 echo -n "TEST: Testing put..."
45 #if ! valgrind --log-file=test_put.log $putexe -k testkey -d testdata > $out ; then
46 if ! $putexe -k testkey -d testdata > $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 echo "PASS"
54 sleep 1
55
56 echo -n "TEST: Testing get..."
57 echo "Result 0, type 0:" > $checkout
58 echo "testdata" >> $checkout
59
60 #if ! valgrind --log-file=test_get.log $getexe -k testkey -T 1 > $out ; then
61 if ! $getexe -k testkey -T 1 > $out ; then
62   echo "FAIL: error running $putexe"
63   echo "Command output was:"
64   cat $out
65   stop_arm
66   exit 1
67 fi
68 if ! diff -q $out $checkout ; then
69   echo "FAIL: $out and $checkout differ"
70   stop_arm
71   exit 1
72 fi
73 echo "PASS"
74 stop_arm