3 rm -rf /tmp/test-gnunetd-arm/
4 exe="./gnunet-arm -c test_arm_api_data.conf"
5 base=/tmp/gnunet-test-arm
6 out=/tmp/test-gnunetd-arm.log
9 # -------------------------------------------
10 echo -n "TEST: can this script work?... "
11 LINES=`ps -C gnunet-service-arm -o pid= | wc -l`
12 if test $LINES -ne 0; then
13 echo "No (arm exists). Exiting early."
16 LINES=`ps -C gnunet-service-resolver -o pid= | wc -l`
17 if test $LINES -ne 0; then
18 echo "No (resolver exists). Exiting early."
24 # ----------------------------------------------------------------------------------
25 echo -n "TEST: Bad argument checking... "
27 if $exe -x 2> /dev/null; then
28 echo "FAIL: error running $exe"
33 # ----------------------------------------------------------------------------------
34 echo -n "TEST: Start ARM... "
36 if ! $exe $DEBUG -s > $out ; then
37 echo "FAIL: error running $exe"
38 echo "Command output was:"
42 LINES=`ps -u $USER -C gnunet-service-arm -o pid= | wc -l`
43 if test $LINES -eq 0; then
44 echo "FAIL: found $LINES gnunet-service-arm processes"
45 echo "Command output was:"
51 # ----------------------------------------------------------------------------------
52 echo -n "TEST: Start another service... "
54 if ! $exe $DEBUG -i resolver > $out ; then
55 echo "FAIL: error running $exe"
56 echo "Command output was:"
62 LINES=`ps -C gnunet-service-resolver -o pid= | wc -l`
63 if test $LINES -ne 1; then
64 echo "FAIL: unexpected output (got $LINES lines, wanted 1)"
65 echo "Command output was:"
72 # ----------------------------------------------------------------------------------
73 echo -n "TEST: Test -t on running service... "
75 if ! $exe $DEBUG -t resolver > $base.out; then
76 echo "FAIL: error running $exe"
79 LINES=`cat $base.out | grep resolver | grep not | wc -l`
80 if test $LINES -ne 0; then
81 echo "FAIL: unexpected output:"
86 LINES=`cat $base.out | grep resolver | grep -v not | wc -l`
87 if test $LINES -ne 1; then
88 echo "FAIL: unexpected output"
95 # ----------------------------------------------------------------------------------
96 echo -n "TEST: Stop a service... "
98 if ! $exe $DEBUG -k resolver > $out; then
99 echo "FAIL: error running $exe"
104 LINES=`ps -C gnunet-service-resolver -o pid= | wc -l`
105 if test $LINES -ne 0; then
107 LINES=`ps -C gnunet-service-resolver -o pid= | wc -l`
109 if test $LINES -ne 0; then
112 echo "FAIL: unexpected output"
113 echo "Command output was:"
120 # ----------------------------------------------------------------------------------
121 echo -n "TEST: Test -t on stopped service... "
123 if ! $exe $DEBUG -t resolver > $base.out; then
124 echo "FAIL: error running $exe"
129 LINES=`cat $base.out | grep resolver | grep not | wc -l`
130 if test $LINES -ne 1; then
131 echo "FAIL: unexpected output"
138 # ----------------------------------------------------------------------------------
139 echo -n "TEST: Stop ARM... "
141 if ! $exe $DEBUG -e > $out; then
142 echo "FAIL: error running $exe"
146 LINES=`ps -C gnunet-service-arm -o pid= | wc -l`
147 if test $LINES -ne 0; then
149 LINES=`ps -C gnunet-service-arm -o pid= | wc -l`
151 if test $LINES -ne 0; then
152 echo "FAIL: unexpected output, still have $LINES gnunet-service-arm processes"
153 echo "Command output was:"
159 rm -rf /tmp/test-gnunetd-arm/