aboutsummaryrefslogtreecommitdiff
path: root/src/monkey/test_gnunet_monkey.sh
diff options
context:
space:
mode:
authorSafey A.Halim <safey.allah@gmail.com>2010-06-29 19:14:37 +0000
committerSafey A.Halim <safey.allah@gmail.com>2010-06-29 19:14:37 +0000
commit1e2ec555753751d032dbe1f19d5206a2da4de65a (patch)
treeba5f6d9487ab2f7aea7fa98d1de3d6abef268b33 /src/monkey/test_gnunet_monkey.sh
parentc75af8bb6df74bfcba1e7b1a3123babf066a1939 (diff)
downloadgnunet-1e2ec555753751d032dbe1f19d5206a2da4de65a.tar.gz
gnunet-1e2ec555753751d032dbe1f19d5206a2da4de65a.zip
Adding "Monkey", GNUnet module for automatic debugging. Experimental code so far.
Diffstat (limited to 'src/monkey/test_gnunet_monkey.sh')
-rwxr-xr-xsrc/monkey/test_gnunet_monkey.sh199
1 files changed, 199 insertions, 0 deletions
diff --git a/src/monkey/test_gnunet_monkey.sh b/src/monkey/test_gnunet_monkey.sh
new file mode 100755
index 000000000..7595a68fb
--- /dev/null
+++ b/src/monkey/test_gnunet_monkey.sh
@@ -0,0 +1,199 @@
1#!/bin/sh
2
3rm -rf /tmp/test-gnunetd-monkey/
4exe="./gnunet-monkey -c test_monkey_api_data.conf"
5out=`mktemp /tmp/test-gnunet-monkey-logXXXXXXXX`
6arm="gnunet-arm -c test_monkey_api_data.conf $DEBUG"
7#DEBUG="-L DEBUG"
8# -----------------------------------
9echo -n "Preparing: Starting service..."
10
11$arm -s > /dev/null
12sleep 1
13$arm -i monkey > /dev/null
14sleep 1
15echo "DONE"
16
17# ----------------------------------------------------------------------------------
18echo -n "TEST: Bad argument checking..."
19
20if $exe -x 2> /dev/null; then
21 echo "FAIL: error running $exe"
22 $arm -e
23 exit 1
24fi
25echo "PASS"
26
27# ----------------------------------------------------------------------------------
28echo -n "TEST: Set value..."
29
30if ! $exe $DEBUG -n test -s subsystem 42 ; then
31 echo "FAIL: error running $exe"
32 $arm -e
33 exit 1
34fi
35echo "PASS"
36
37# ----------------------------------------------------------------------------------
38echo -n "TEST: Set another value..."
39
40if ! $exe $DEBUG -n other -s osystem 43 ; then
41 echo "FAIL: error running $exe"
42 $arm -e
43 exit 1
44fi
45echo "PASS"
46
47# ----------------------------------------------------------------------------------
48echo -n "TEST: viewing all stats..."
49
50if ! $exe $DEBUG > $out; then
51 echo "FAIL: error running $exe"
52 $arm -e
53 exit 1
54fi
55LINES=`cat $out | wc -l`
56if test $LINES -ne 2; then
57 echo "FAIL: unexpected output"
58 $arm -e
59 exit 1
60fi
61echo "PASS"
62
63# ----------------------------------------------------------------------------------
64echo -n "TEST: viewing stats by name..."
65
66if ! $exe $DEBUG -n other > $out; then
67 echo "FAIL: error running $exe"
68 $arm -e
69 exit 1
70fi
71LINES=`cat $out | grep 43 | wc -l`
72if test $LINES -ne 1; then
73 echo "FAIL: unexpected output"
74 $arm -e
75 exit 1
76fi
77echo "PASS"
78
79# ----------------------------------------------------------------------------------
80echo -n "TEST: viewing stats by subsystem..."
81
82if ! $exe $DEBUG -s subsystem > $out; then
83 echo "FAIL: error running $exe"
84 $arm -e
85 exit 1
86fi
87LINES=`cat $out | grep 42 | wc -l`
88if test $LINES -ne 1; then
89 echo "FAIL: unexpected output"
90 $arm -e
91 exit 1
92fi
93echo "PASS"
94
95
96# ----------------------------------------------------------------------------------
97echo -n "TEST: Set persistent value..."
98
99if ! $exe $DEBUG -n lasting -s subsystem 40 -p; then
100 echo "FAIL: error running $exe"
101 $arm -e
102 exit 1
103fi
104if ! $exe $DEBUG > $out; then
105 echo "FAIL: error running $exe"
106 $arm -e
107 exit 1
108fi
109LINES=`cat $out | grep 40 | wc -l`
110if test $LINES -ne 1; then
111 echo "FAIL: unexpected output"
112 cat $out
113 $arm -e
114 exit 1
115fi
116echo "PASS"
117
118# -----------------------------------
119echo -n "Restarting service..."
120$arm -k monkey > /dev/null
121sleep 1
122$arm -i monkey > /dev/null
123sleep 1
124echo "DONE"
125
126# ----------------------------------------------------------------------------------
127echo -n "TEST: checking persistence..."
128
129if ! $exe $DEBUG > $out; then
130 echo "FAIL: error running $exe"
131 $arm -e
132 exit 1
133fi
134LINES=`cat $out | grep 40 | wc -l`
135if test $LINES -ne 1; then
136 echo "FAIL: unexpected output"
137 cat $out
138 $arm -e
139 exit 1
140fi
141echo "PASS"
142
143
144
145# ----------------------------------------------------------------------------------
146echo -n "TEST: Removing persistence..."
147
148if ! $exe $DEBUG -n lasting -s subsystem 40; then
149 echo "FAIL: error running $exe"
150 $arm -e
151 exit 1
152fi
153if ! $exe $DEBUG > $out; then
154 echo "FAIL: error running $exe"
155 $arm -e
156 exit 1
157fi
158LINES=`cat $out | grep \! | wc -l`
159if test $LINES -ne 0; then
160 echo "FAIL: unexpected output"
161 cat $out
162 $arm -e
163 exit 1
164fi
165echo "PASS"
166
167
168# -----------------------------------
169echo -n "Restarting service..."
170$arm -k monkey > /dev/null
171sleep 1
172$arm -i monkey > /dev/null
173sleep 1
174echo "DONE"
175
176# ----------------------------------------------------------------------------------
177echo -n "TEST: checking removed persistence..."
178
179if ! $exe $DEBUG > $out; then
180 echo "FAIL: error running $exe"
181 $arm -e
182 exit 1
183fi
184LINES=`cat $out | grep 40 | wc -l`
185if test $LINES -ne 0; then
186 echo "FAIL: unexpected output"
187 cat $out
188 $arm -e
189 exit 1
190fi
191echo "PASS"
192
193# -----------------------------------
194echo -n "Stopping service..."
195$arm -e > /dev/null
196sleep 1
197echo "DONE"
198rm -f $out
199rm -rf /tmp/test-gnunetd-monkey/