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:"
52 # ----------------------------------------------------------------------------------
53 echo -n "TEST: Start another service... "
55 if ! $exe $DEBUG -i resolver > $out ; then
56 echo "FAIL: error running $exe"
57 echo "Command output was:"
63 LINES=`ps -C gnunet-service-resolver -o pid= | wc -l`
64 if test $LINES -ne 1; then
65 echo "FAIL: unexpected output (got $LINES lines, wanted 1)"
66 echo "Command output was:"
73 # ----------------------------------------------------------------------------------
74 echo -n "TEST: Test -t on running service... "
76 if ! $exe $DEBUG -t resolver > $base.out; then
77 echo "FAIL: error running $exe"
80 LINES=`cat $base.out | grep resolver | grep not | wc -l`
81 if test $LINES -ne 0; then
82 echo "FAIL: unexpected output:"
87 LINES=`cat $base.out | grep resolver | grep -v not | wc -l`
88 if test $LINES -ne 1; then
89 echo "FAIL: unexpected output"
96 # ----------------------------------------------------------------------------------
97 echo -n "TEST: Stop a service... "
99 if ! $exe $DEBUG -k resolver > $out; then
100 echo "FAIL: error running $exe"
105 LINES=`ps -C gnunet-service-resolver -o pid= | wc -l`
106 if test $LINES -ne 0; then
108 LINES=`ps -C gnunet-service-resolver -o pid= | wc -l`
110 if test $LINES -ne 0; then
113 echo "FAIL: unexpected output"
114 echo "Command output was:"
121 # ----------------------------------------------------------------------------------
122 echo -n "TEST: Test -t on stopped service... "
124 if ! $exe $DEBUG -t resolver > $base.out; then
125 echo "FAIL: error running $exe"
130 LINES=`cat $base.out | grep resolver | grep not | wc -l`
131 if test $LINES -ne 1; then
132 echo "FAIL: unexpected output"
139 # ----------------------------------------------------------------------------------
140 echo -n "TEST: Stop ARM... "
142 if ! $exe $DEBUG -e > $out; then
143 echo "FAIL: error running $exe"
147 LINES=`ps -C gnunet-service-arm -o pid= | wc -l`
148 if test $LINES -ne 0; then
150 LINES=`ps -C gnunet-service-arm -o pid= | wc -l`
152 if test $LINES -ne 0; then
153 echo "FAIL: unexpected output, still have $LINES gnunet-service-arm processes"
154 echo "Command output was:"
160 rm -rf /tmp/test-gnunetd-arm/