diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-10-04 12:17:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-10-04 12:17:19 +0000 |
commit | 15a3aa15f50b3c88fcd8b6cc1042ca49dc21bd51 (patch) | |
tree | c8c2c7d36449668362dd5c41722eaae9fb04ff91 /src/statistics | |
parent | abd8f5e779a5de462a28e48c1450d4ce47d24458 (diff) | |
download | gnunet-15a3aa15f50b3c88fcd8b6cc1042ca49dc21bd51.tar.gz gnunet-15a3aa15f50b3c88fcd8b6cc1042ca49dc21bd51.zip |
use arm instead of bash-ish kill
Diffstat (limited to 'src/statistics')
-rwxr-xr-x | src/statistics/test_gnunet_statistics.sh | 68 | ||||
-rw-r--r-- | src/statistics/test_statistics_api_data.conf | 4 |
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 | ||
3 | rm -rf /tmp/test-gnunetd-statistics/ | 3 | rm -rf /tmp/test-gnunetd-statistics/ |
4 | exe="./gnunet-statistics -c test_statistics_api_data.conf" | 4 | exe="./gnunet-statistics -c test_statistics_api_data.conf" |
5 | base=/tmp/gnunet-test-statistics | 5 | base=/tmp/gnunet-test-statistics |
6 | arm="gnunet-arm -c test_statistics_api_data.conf $DEBUG" | ||
6 | #DEBUG="-L DEBUG" | 7 | #DEBUG="-L DEBUG" |
7 | # ----------------------------------- | 8 | # ----------------------------------- |
8 | echo -n "Preparing: Starting service..." | 9 | echo -n "Preparing: Starting service..." |
9 | ./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf & | 10 | |
11 | $arm -s > /dev/null | ||
10 | sleep 1 | 12 | sleep 1 |
13 | $arm -i statistics > /dev/null | ||
14 | sleep 1 | ||
11 | echo "DONE" | 15 | echo "DONE" |
12 | 16 | ||
13 | # ---------------------------------------------------------------------------------- | 17 | # ---------------------------------------------------------------------------------- |
@@ -15,7 +19,7 @@ echo -n "TEST: Bad argument checking..." | |||
15 | 19 | ||
16 | if $exe -x 2> /dev/null; then | 20 | if $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 |
20 | fi | 24 | fi |
21 | echo "PASS" | 25 | echo "PASS" |
@@ -25,7 +29,7 @@ echo -n "TEST: Set value..." | |||
25 | 29 | ||
26 | if ! $exe $DEBUG -n test -s subsystem 42 ; then | 30 | if ! $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 |
30 | fi | 34 | fi |
31 | echo "PASS" | 35 | echo "PASS" |
@@ -35,7 +39,7 @@ echo -n "TEST: Set another value..." | |||
35 | 39 | ||
36 | if ! $exe $DEBUG -n other -s osystem 43 ; then | 40 | if ! $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 |
40 | fi | 44 | fi |
41 | echo "PASS" | 45 | echo "PASS" |
@@ -45,13 +49,13 @@ echo -n "TEST: viewing all stats..." | |||
45 | 49 | ||
46 | if ! $exe $DEBUG > $base.out; then | 50 | if ! $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 |
50 | fi | 54 | fi |
51 | LINES=`cat $base.out | wc -l` | 55 | LINES=`cat $base.out | wc -l` |
52 | if test $LINES -ne 2; then | 56 | if 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 |
56 | fi | 60 | fi |
57 | echo "PASS" | 61 | echo "PASS" |
@@ -61,13 +65,13 @@ echo -n "TEST: viewing stats by name..." | |||
61 | 65 | ||
62 | if ! $exe $DEBUG -n other > $base.out; then | 66 | if ! $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 |
66 | fi | 70 | fi |
67 | LINES=`cat $base.out | grep 43 | wc -l` | 71 | LINES=`cat $base.out | grep 43 | wc -l` |
68 | if test $LINES -ne 1; then | 72 | if 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 |
72 | fi | 76 | fi |
73 | echo "PASS" | 77 | echo "PASS" |
@@ -77,13 +81,13 @@ echo -n "TEST: viewing stats by subsystem..." | |||
77 | 81 | ||
78 | if ! $exe $DEBUG -s subsystem > $base.out; then | 82 | if ! $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 |
82 | fi | 86 | fi |
83 | LINES=`cat $base.out | grep 42 | wc -l` | 87 | LINES=`cat $base.out | grep 42 | wc -l` |
84 | if test $LINES -ne 1; then | 88 | if 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 |
88 | fi | 92 | fi |
89 | echo "PASS" | 93 | echo "PASS" |
@@ -94,37 +98,31 @@ echo -n "TEST: Set persistent value..." | |||
94 | 98 | ||
95 | if ! $exe $DEBUG -n lasting -s subsystem 40 -p; then | 99 | if ! $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 |
99 | fi | 103 | fi |
100 | echo "PASS" | 104 | echo "PASS" |
101 | 105 | ||
102 | # ----------------------------------- | 106 | # ----------------------------------- |
103 | echo -n "Restarting service..." | 107 | echo -n "Restarting service..." |
108 | $arm -k statistics > /dev/null | ||
104 | sleep 1 | 109 | sleep 1 |
105 | if ! kill %%; | 110 | $arm -i statistics > /dev/null |
106 | then | ||
107 | echo "FAIL: could not kill service" | ||
108 | kill %% | ||
109 | exit 1 | ||
110 | fi | ||
111 | sleep 1 | ||
112 | ./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf & | ||
113 | sleep 1 | 111 | sleep 1 |
114 | 112 | echo "DONE" | |
115 | 113 | ||
116 | # ---------------------------------------------------------------------------------- | 114 | # ---------------------------------------------------------------------------------- |
117 | echo -n "TEST: checking persistence..." | 115 | echo -n "TEST: checking persistence..." |
118 | 116 | ||
119 | if ! $exe $DEBUG > $base.out; then | 117 | if ! $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 |
123 | fi | 121 | fi |
124 | LINES=`cat $base.out | grep 40 | wc -l` | 122 | LINES=`cat $base.out | grep 40 | wc -l` |
125 | if test $LINES -ne 1; then | 123 | if 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 |
129 | fi | 127 | fi |
130 | echo "PASS" | 128 | echo "PASS" |
@@ -136,7 +134,7 @@ echo -n "TEST: Removing persistence..." | |||
136 | 134 | ||
137 | if ! $exe $DEBUG -n lasting -s subsystem 40; then | 135 | if ! $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 |
141 | fi | 139 | fi |
142 | echo "PASS" | 140 | echo "PASS" |
@@ -144,34 +142,32 @@ echo "PASS" | |||
144 | 142 | ||
145 | # ----------------------------------- | 143 | # ----------------------------------- |
146 | echo -n "Restarting service..." | 144 | echo -n "Restarting service..." |
145 | $arm -k statistics > /dev/null | ||
147 | sleep 1 | 146 | sleep 1 |
148 | if ! kill %%; | 147 | $arm -i statistics > /dev/null |
149 | then | ||
150 | echo "FAIL: could not kill service" | ||
151 | kill %% | ||
152 | exit 1 | ||
153 | fi | ||
154 | sleep 1 | ||
155 | ./gnunet-service-statistics $DEBUG -c test_statistics_api_data.conf & | ||
156 | sleep 1 | 148 | sleep 1 |
157 | 149 | echo "DONE" | |
158 | 150 | ||
159 | # ---------------------------------------------------------------------------------- | 151 | # ---------------------------------------------------------------------------------- |
160 | echo -n "TEST: checking removed persistence..." | 152 | echo -n "TEST: checking removed persistence..." |
161 | 153 | ||
162 | if ! $exe $DEBUG > $base.out; then | 154 | if ! $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 |
166 | fi | 158 | fi |
167 | LINES=`cat $base.out | grep 40 | wc -l` | 159 | LINES=`cat $base.out | grep 40 | wc -l` |
168 | if test $LINES -ne 0; then | 160 | if 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 |
172 | fi | 164 | fi |
173 | echo "PASS" | 165 | echo "PASS" |
174 | 166 | ||
175 | kill %% | 167 | # ----------------------------------- |
168 | echo -n "Stopping service..." | ||
169 | $arm -e > /dev/null | ||
170 | sleep 1 | ||
171 | echo "DONE" | ||
176 | rm -f $base.out | 172 | rm -f $base.out |
177 | rm -rf /tmp/test-gnunetd-statistics/ | 173 | rm -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] |
2 | SERVICEHOME = /tmp/test-gnunetd-statistics/ | 2 | SERVICEHOME = /tmp/test-gnunetd-statistics/ |
3 | DEFAULTCONFIG = test_statistics_api_data.conf | ||
3 | 4 | ||
4 | [statistics] | 5 | [statistics] |
5 | PORT = 22353 | 6 | PORT = 22353 |
7 | |||
8 | [arm] | ||
9 | PORT = 22354 | ||