aboutsummaryrefslogtreecommitdiff
path: root/src/statistics
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-10-04 12:17:19 +0000
committerChristian Grothoff <christian@grothoff.org>2009-10-04 12:17:19 +0000
commit15a3aa15f50b3c88fcd8b6cc1042ca49dc21bd51 (patch)
treec8c2c7d36449668362dd5c41722eaae9fb04ff91 /src/statistics
parentabd8f5e779a5de462a28e48c1450d4ce47d24458 (diff)
downloadgnunet-15a3aa15f50b3c88fcd8b6cc1042ca49dc21bd51.tar.gz
gnunet-15a3aa15f50b3c88fcd8b6cc1042ca49dc21bd51.zip
use arm instead of bash-ish kill
Diffstat (limited to 'src/statistics')
-rwxr-xr-xsrc/statistics/test_gnunet_statistics.sh68
-rw-r--r--src/statistics/test_statistics_api_data.conf4
2 files changed, 36 insertions, 36 deletions
diff --git a/src/statistics/test_gnunet_statistics.sh b/src/statistics/test_gnunet_statistics.sh
index 191b4321b..aacbc75b0 100755
--- a/src/statistics/test_gnunet_statistics.sh
+++ b/src/statistics/test_gnunet_statistics.sh
@@ -1,13 +1,17 @@
1#!/bin/sh 1#!/bin/bash
2 2
3rm -rf /tmp/test-gnunetd-statistics/ 3rm -rf /tmp/test-gnunetd-statistics/
4exe="./gnunet-statistics -c test_statistics_api_data.conf" 4exe="./gnunet-statistics -c test_statistics_api_data.conf"
5base=/tmp/gnunet-test-statistics 5base=/tmp/gnunet-test-statistics
6arm="gnunet-arm -c test_statistics_api_data.conf $DEBUG"
6#DEBUG="-L DEBUG" 7#DEBUG="-L DEBUG"
7# ----------------------------------- 8# -----------------------------------
8echo -n "Preparing: Starting service..." 9echo -n "Preparing: Starting service..."
9./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf & 10
11$arm -s > /dev/null
10sleep 1 12sleep 1
13$arm -i statistics > /dev/null
14sleep 1
11echo "DONE" 15echo "DONE"
12 16
13# ---------------------------------------------------------------------------------- 17# ----------------------------------------------------------------------------------
@@ -15,7 +19,7 @@ echo -n "TEST: Bad argument checking..."
15 19
16if $exe -x 2> /dev/null; then 20if $exe -x 2> /dev/null; then
17 echo "FAIL: error running $exe" 21 echo "FAIL: error running $exe"
18 kill %% 22 $arm -e
19 exit 1 23 exit 1
20fi 24fi
21echo "PASS" 25echo "PASS"
@@ -25,7 +29,7 @@ echo -n "TEST: Set value..."
25 29
26if ! $exe $DEBUG -n test -s subsystem 42 ; then 30if ! $exe $DEBUG -n test -s subsystem 42 ; then
27 echo "FAIL: error running $exe" 31 echo "FAIL: error running $exe"
28 kill %% 32 $arm -e
29 exit 1 33 exit 1
30fi 34fi
31echo "PASS" 35echo "PASS"
@@ -35,7 +39,7 @@ echo -n "TEST: Set another value..."
35 39
36if ! $exe $DEBUG -n other -s osystem 43 ; then 40if ! $exe $DEBUG -n other -s osystem 43 ; then
37 echo "FAIL: error running $exe" 41 echo "FAIL: error running $exe"
38 kill %% 42 $arm -e
39 exit 1 43 exit 1
40fi 44fi
41echo "PASS" 45echo "PASS"
@@ -45,13 +49,13 @@ echo -n "TEST: viewing all stats..."
45 49
46if ! $exe $DEBUG > $base.out; then 50if ! $exe $DEBUG > $base.out; then
47 echo "FAIL: error running $exe" 51 echo "FAIL: error running $exe"
48 kill %% 52 $arm -e
49 exit 1 53 exit 1
50fi 54fi
51LINES=`cat $base.out | wc -l` 55LINES=`cat $base.out | wc -l`
52if test $LINES -ne 2; then 56if test $LINES -ne 2; then
53 echo "FAIL: unexpected output" 57 echo "FAIL: unexpected output"
54 kill %% 58 $arm -e
55 exit 1 59 exit 1
56fi 60fi
57echo "PASS" 61echo "PASS"
@@ -61,13 +65,13 @@ echo -n "TEST: viewing stats by name..."
61 65
62if ! $exe $DEBUG -n other > $base.out; then 66if ! $exe $DEBUG -n other > $base.out; then
63 echo "FAIL: error running $exe" 67 echo "FAIL: error running $exe"
64 kill %% 68 $arm -e
65 exit 1 69 exit 1
66fi 70fi
67LINES=`cat $base.out | grep 43 | wc -l` 71LINES=`cat $base.out | grep 43 | wc -l`
68if test $LINES -ne 1; then 72if test $LINES -ne 1; then
69 echo "FAIL: unexpected output" 73 echo "FAIL: unexpected output"
70 kill %% 74 $arm -e
71 exit 1 75 exit 1
72fi 76fi
73echo "PASS" 77echo "PASS"
@@ -77,13 +81,13 @@ echo -n "TEST: viewing stats by subsystem..."
77 81
78if ! $exe $DEBUG -s subsystem > $base.out; then 82if ! $exe $DEBUG -s subsystem > $base.out; then
79 echo "FAIL: error running $exe" 83 echo "FAIL: error running $exe"
80 kill %% 84 $arm -e
81 exit 1 85 exit 1
82fi 86fi
83LINES=`cat $base.out | grep 42 | wc -l` 87LINES=`cat $base.out | grep 42 | wc -l`
84if test $LINES -ne 1; then 88if test $LINES -ne 1; then
85 echo "FAIL: unexpected output" 89 echo "FAIL: unexpected output"
86 kill %% 90 $arm -e
87 exit 1 91 exit 1
88fi 92fi
89echo "PASS" 93echo "PASS"
@@ -94,37 +98,31 @@ echo -n "TEST: Set persistent value..."
94 98
95if ! $exe $DEBUG -n lasting -s subsystem 40 -p; then 99if ! $exe $DEBUG -n lasting -s subsystem 40 -p; then
96 echo "FAIL: error running $exe" 100 echo "FAIL: error running $exe"
97 kill %% 101 $arm -e
98 exit 1 102 exit 1
99fi 103fi
100echo "PASS" 104echo "PASS"
101 105
102# ----------------------------------- 106# -----------------------------------
103echo -n "Restarting service..." 107echo -n "Restarting service..."
108$arm -k statistics > /dev/null
104sleep 1 109sleep 1
105if ! kill %%; 110$arm -i statistics > /dev/null
106then
107 echo "FAIL: could not kill service"
108 kill %%
109 exit 1
110fi
111sleep 1
112./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf &
113sleep 1 111sleep 1
114 112echo "DONE"
115 113
116# ---------------------------------------------------------------------------------- 114# ----------------------------------------------------------------------------------
117echo -n "TEST: checking persistence..." 115echo -n "TEST: checking persistence..."
118 116
119if ! $exe $DEBUG > $base.out; then 117if ! $exe $DEBUG > $base.out; then
120 echo "FAIL: error running $exe" 118 echo "FAIL: error running $exe"
121 kill %% 119 $arm -e
122 exit 1 120 exit 1
123fi 121fi
124LINES=`cat $base.out | grep 40 | wc -l` 122LINES=`cat $base.out | grep 40 | wc -l`
125if test $LINES -ne 1; then 123if test $LINES -ne 1; then
126 echo "FAIL: unexpected output" 124 echo "FAIL: unexpected output"
127 kill %% 125 $arm -e
128 exit 1 126 exit 1
129fi 127fi
130echo "PASS" 128echo "PASS"
@@ -136,7 +134,7 @@ echo -n "TEST: Removing persistence..."
136 134
137if ! $exe $DEBUG -n lasting -s subsystem 40; then 135if ! $exe $DEBUG -n lasting -s subsystem 40; then
138 echo "FAIL: error running $exe" 136 echo "FAIL: error running $exe"
139 kill %% 137 $arm -e
140 exit 1 138 exit 1
141fi 139fi
142echo "PASS" 140echo "PASS"
@@ -144,34 +142,32 @@ echo "PASS"
144 142
145# ----------------------------------- 143# -----------------------------------
146echo -n "Restarting service..." 144echo -n "Restarting service..."
145$arm -k statistics > /dev/null
147sleep 1 146sleep 1
148if ! kill %%; 147$arm -i statistics > /dev/null
149then
150 echo "FAIL: could not kill service"
151 kill %%
152 exit 1
153fi
154sleep 1
155./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf &
156sleep 1 148sleep 1
157 149echo "DONE"
158 150
159# ---------------------------------------------------------------------------------- 151# ----------------------------------------------------------------------------------
160echo -n "TEST: checking removed persistence..." 152echo -n "TEST: checking removed persistence..."
161 153
162if ! $exe $DEBUG > $base.out; then 154if ! $exe $DEBUG > $base.out; then
163 echo "FAIL: error running $exe" 155 echo "FAIL: error running $exe"
164 kill %% 156 $arm -e
165 exit 1 157 exit 1
166fi 158fi
167LINES=`cat $base.out | grep 40 | wc -l` 159LINES=`cat $base.out | grep 40 | wc -l`
168if test $LINES -ne 0; then 160if test $LINES -ne 0; then
169 echo "FAIL: unexpected output" 161 echo "FAIL: unexpected output"
170 kill %% 162 $arm -e
171 exit 1 163 exit 1
172fi 164fi
173echo "PASS" 165echo "PASS"
174 166
175kill %% 167# -----------------------------------
168echo -n "Stopping service..."
169$arm -e > /dev/null
170sleep 1
171echo "DONE"
176rm -f $base.out 172rm -f $base.out
177rm -rf /tmp/test-gnunetd-statistics/ 173rm -rf /tmp/test-gnunetd-statistics/
diff --git a/src/statistics/test_statistics_api_data.conf b/src/statistics/test_statistics_api_data.conf
index 571a9b3e4..da4bed775 100644
--- a/src/statistics/test_statistics_api_data.conf
+++ b/src/statistics/test_statistics_api_data.conf
@@ -1,5 +1,9 @@
1[PATHS] 1[PATHS]
2SERVICEHOME = /tmp/test-gnunetd-statistics/ 2SERVICEHOME = /tmp/test-gnunetd-statistics/
3DEFAULTCONFIG = test_statistics_api_data.conf
3 4
4[statistics] 5[statistics]
5PORT = 22353 6PORT = 22353
7
8[arm]
9PORT = 22354