3 rm -rf /tmp/test-gnunetd-statistics/
4 exe="./gnunet-statistics -c test_statistics_api_data.conf"
5 base=/tmp/gnunet-test-statistics
7 # -----------------------------------
8 echo -n "Preparing: Starting service..."
9 ./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf &
13 # ----------------------------------------------------------------------------------
14 echo -n "TEST: Bad argument checking..."
16 if $exe -x 2> /dev/null; then
17 echo "FAIL: error running $exe"
23 # ----------------------------------------------------------------------------------
24 echo -n "TEST: Set value..."
26 if ! $exe $DEBUG -n test -s subsystem 42 ; then
27 echo "FAIL: error running $exe"
33 # ----------------------------------------------------------------------------------
34 echo -n "TEST: Set another value..."
36 if ! $exe $DEBUG -n other -s osystem 43 ; then
37 echo "FAIL: error running $exe"
43 # ----------------------------------------------------------------------------------
44 echo -n "TEST: viewing all stats..."
46 if ! $exe $DEBUG > $base.out; then
47 echo "FAIL: error running $exe"
51 LINES=`cat $base.out | wc -l`
52 if test $LINES -ne 2; then
53 echo "FAIL: unexpected output"
59 # ----------------------------------------------------------------------------------
60 echo -n "TEST: viewing stats by name..."
62 if ! $exe $DEBUG -n other > $base.out; then
63 echo "FAIL: error running $exe"
67 LINES=`cat $base.out | grep 43 | wc -l`
68 if test $LINES -ne 1; then
69 echo "FAIL: unexpected output"
75 # ----------------------------------------------------------------------------------
76 echo -n "TEST: viewing stats by subsystem..."
78 if ! $exe $DEBUG -s subsystem > $base.out; then
79 echo "FAIL: error running $exe"
83 LINES=`cat $base.out | grep 42 | wc -l`
84 if test $LINES -ne 1; then
85 echo "FAIL: unexpected output"
92 # ----------------------------------------------------------------------------------
93 echo -n "TEST: Set persistent value..."
95 if ! $exe $DEBUG -n lasting -s subsystem 40 -p; then
96 echo "FAIL: error running $exe"
102 # -----------------------------------
103 echo -n "Restarting service..."
107 echo "FAIL: could not kill service"
112 ./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf &
116 # ----------------------------------------------------------------------------------
117 echo -n "TEST: checking persistence..."
119 if ! $exe $DEBUG > $base.out; then
120 echo "FAIL: error running $exe"
124 LINES=`cat $base.out | grep 40 | wc -l`
125 if test $LINES -ne 1; then
126 echo "FAIL: unexpected output"
134 # ----------------------------------------------------------------------------------
135 echo -n "TEST: Removing persistence..."
137 if ! $exe $DEBUG -n lasting -s subsystem 40; then
138 echo "FAIL: error running $exe"
145 # -----------------------------------
146 echo -n "Restarting service..."
150 echo "FAIL: could not kill service"
155 ./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf &
159 # ----------------------------------------------------------------------------------
160 echo -n "TEST: checking removed persistence..."
162 if ! $exe $DEBUG > $base.out; then
163 echo "FAIL: error running $exe"
167 LINES=`cat $base.out | grep 40 | wc -l`
168 if test $LINES -ne 0; then
169 echo "FAIL: unexpected output"
177 rm -rf /tmp/test-gnunetd-statistics/