aboutsummaryrefslogtreecommitdiff
path: root/src/arm/test_gnunet_arm.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/arm/test_gnunet_arm.sh')
-rwxr-xr-xsrc/arm/test_gnunet_arm.sh117
1 files changed, 117 insertions, 0 deletions
diff --git a/src/arm/test_gnunet_arm.sh b/src/arm/test_gnunet_arm.sh
new file mode 100755
index 000000000..72f7a176b
--- /dev/null
+++ b/src/arm/test_gnunet_arm.sh
@@ -0,0 +1,117 @@
1#!/bin/bash
2
3rm -rf /tmp/test-gnunetd-arm/
4exe="./gnunet-arm -c test_arm_api_data.conf"
5base=/tmp/gnunet-test-arm
6#DEBUG="-L DEBUG"
7
8# ----------------------------------------------------------------------------------
9echo -n "TEST: Bad argument checking... "
10
11if $exe -x 2> /dev/null; then
12 echo "FAIL: error running $exe"
13 exit 1
14fi
15echo "PASS"
16
17# ----------------------------------------------------------------------------------
18echo -n "TEST: Start ARM... "
19
20if ! $exe $DEBUG -s > /dev/null ; then
21 echo "FAIL: error running $exe"
22 exit 1
23fi
24LINES=`ps ax | grep gnunet-service-arm | grep -v grep | wc -l`
25if test $LINES -eq 0; then
26 echo "FAIL: found $LINES gnunet-service-arm processes"
27 exit 1
28fi
29echo "PASS"
30
31# ----------------------------------------------------------------------------------
32echo -n "TEST: Start another service... "
33
34if ! $exe $DEBUG -i resolver > /dev/null ; then
35 echo "FAIL: error running $exe"
36 kill %%
37 exit 1
38fi
39sleep 1
40LINES=`ps ax | grep gnunet-service-resolver | grep -v grep | wc -l`
41if test $LINES -ne 1; then
42 echo "FAIL: unexpected output (got $LINES lines, wanted 1)"
43 $exe -e
44 exit 1
45fi
46echo "PASS"
47
48# ----------------------------------------------------------------------------------
49echo -n "TEST: Test -t on running service... "
50
51if ! $exe $DEBUG -t resolver > $base.out; then
52 echo "FAIL: error running $exe"
53 exit 1
54fi
55LINES=`cat $base.out | grep resolver | grep not | wc -l`
56if test $LINES -ne 0; then
57 echo "FAIL: unexpected output"
58 $exe -e
59 exit 1
60fi
61LINES=`cat $base.out | grep resolver | grep -v not | wc -l`
62if test $LINES -ne 1; then
63 echo "FAIL: unexpected output"
64 $exe -e
65 exit 1
66fi
67echo "PASS"
68
69# ----------------------------------------------------------------------------------
70echo -n "TEST: Stop a service... "
71
72if ! $exe $DEBUG -k resolver > /dev/null; then
73 echo "FAIL: error running $exe"
74 $exe -e
75 exit 1
76fi
77sleep 1
78LINES=`ps ax | grep gnunet-service-resolver | grep -v grep | wc -l`
79if test $LINES -ne 0; then
80 echo "FAIL: unexpected output"
81 $exe -e
82 exit 1
83fi
84echo "PASS"
85
86# ----------------------------------------------------------------------------------
87echo -n "TEST: Test -t on stopped service... "
88
89if ! $exe $DEBUG -t resolver > $base.out; then
90 echo "FAIL: error running $exe"
91 $exe -e
92 exit 1
93fi
94LINES=`cat $base.out | grep resolver | grep not | wc -l`
95if test $LINES -ne 1; then
96 echo "FAIL: unexpected output"
97 $exe -e
98 exit 1
99fi
100echo "PASS"
101
102# ----------------------------------------------------------------------------------
103echo -n "TEST: Stop ARM... "
104
105if ! $exe $DEBUG -e > /dev/null; then
106 echo "FAIL: error running $exe"
107 exit 1
108fi
109LINES=`ps ax | grep gnunet-service-arm | grep -v grep | wc -l`
110if test $LINES -ne 0; then
111 echo "FAIL: unexpected output"
112 exit 1
113fi
114echo "PASS"
115
116rm -rf /tmp/test-gnunetd-arm/
117rm -f $base.out