diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-11-03 21:26:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-11-03 21:26:40 +0000 |
commit | 721e49caeea6ba5073f8bc5c6c08359295c02bb5 (patch) | |
tree | e06e80ba90af91e9452a48a7a5782913199b4877 /src/statistics | |
parent | 37ac1b7c9e9e05f93d4100cfb53450ec2d370989 (diff) | |
download | gnunet-721e49caeea6ba5073f8bc5c6c08359295c02bb5.tar.gz gnunet-721e49caeea6ba5073f8bc5c6c08359295c02bb5.zip |
original patch from Mantis 1614
Diffstat (limited to 'src/statistics')
-rw-r--r-- | src/statistics/test_statistics_api.c | 20 | ||||
-rw-r--r-- | src/statistics/test_statistics_api_loop.c | 10 |
2 files changed, 18 insertions, 12 deletions
diff --git a/src/statistics/test_statistics_api.c b/src/statistics/test_statistics_api.c index 5c55a11a6..6a45e3b10 100644 --- a/src/statistics/test_statistics_api.c +++ b/src/statistics/test_statistics_api.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "gnunet_scheduler_lib.h" | 29 | #include "gnunet_scheduler_lib.h" |
30 | #include "gnunet_statistics_service.h" | 30 | #include "gnunet_statistics_service.h" |
31 | 31 | ||
32 | #define DEBUG_STATISTICS GNUNET_NO | 32 | #define DEBUG_STATISTICS GNUNET_YES |
33 | 33 | ||
34 | #define START_SERVICE GNUNET_YES | 34 | #define START_SERVICE GNUNET_YES |
35 | 35 | ||
@@ -157,8 +157,8 @@ check () | |||
157 | GNUNET_GETOPT_OPTION_END | 157 | GNUNET_GETOPT_OPTION_END |
158 | }; | 158 | }; |
159 | #if START_SERVICE | 159 | #if START_SERVICE |
160 | pid_t pid; | 160 | GNUNET_OS_Process *proc; |
161 | pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", | 161 | proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", |
162 | "gnunet-service-statistics", | 162 | "gnunet-service-statistics", |
163 | #if DEBUG_STATISTICS | 163 | #if DEBUG_STATISTICS |
164 | "-L", "DEBUG", | 164 | "-L", "DEBUG", |
@@ -168,19 +168,21 @@ check () | |||
168 | GNUNET_PROGRAM_run (5, argv, "test-statistics-api", "nohelp", | 168 | GNUNET_PROGRAM_run (5, argv, "test-statistics-api", "nohelp", |
169 | options, &run, &ok); | 169 | options, &run, &ok); |
170 | #if START_SERVICE | 170 | #if START_SERVICE |
171 | if (0 != PLIBC_KILL (pid, SIGTERM)) | 171 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) |
172 | { | 172 | { |
173 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 173 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
174 | ok = 1; | 174 | ok = 1; |
175 | } | 175 | } |
176 | GNUNET_OS_process_wait(pid); | 176 | GNUNET_OS_process_wait (proc); |
177 | GNUNET_OS_process_close (proc); | ||
178 | proc = NULL; | ||
177 | #endif | 179 | #endif |
178 | if (ok != 0) | 180 | if (ok != 0) |
179 | return ok; | 181 | return ok; |
180 | ok = 1; | 182 | ok = 1; |
181 | #if START_SERVICE | 183 | #if START_SERVICE |
182 | /* restart to check persistence! */ | 184 | /* restart to check persistence! */ |
183 | pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", | 185 | proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", |
184 | "gnunet-service-statistics", | 186 | "gnunet-service-statistics", |
185 | #if DEBUG_STATISTICS | 187 | #if DEBUG_STATISTICS |
186 | "-L", "DEBUG", | 188 | "-L", "DEBUG", |
@@ -190,12 +192,14 @@ check () | |||
190 | GNUNET_PROGRAM_run (5, argv, "test-statistics-api", "nohelp", | 192 | GNUNET_PROGRAM_run (5, argv, "test-statistics-api", "nohelp", |
191 | options, &run_more, &ok); | 193 | options, &run_more, &ok); |
192 | #if START_SERVICE | 194 | #if START_SERVICE |
193 | if (0 != PLIBC_KILL (pid, SIGTERM)) | 195 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) |
194 | { | 196 | { |
195 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 197 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
196 | ok = 1; | 198 | ok = 1; |
197 | } | 199 | } |
198 | GNUNET_OS_process_wait(pid); | 200 | GNUNET_OS_process_wait (proc); |
201 | GNUNET_OS_process_close (proc); | ||
202 | proc = NULL; | ||
199 | #endif | 203 | #endif |
200 | return ok; | 204 | return ok; |
201 | } | 205 | } |
diff --git a/src/statistics/test_statistics_api_loop.c b/src/statistics/test_statistics_api_loop.c index 289e8f09f..b4e7ae7ab 100644 --- a/src/statistics/test_statistics_api_loop.c +++ b/src/statistics/test_statistics_api_loop.c | |||
@@ -96,8 +96,8 @@ check () | |||
96 | GNUNET_GETOPT_OPTION_END | 96 | GNUNET_GETOPT_OPTION_END |
97 | }; | 97 | }; |
98 | #if START_SERVICE | 98 | #if START_SERVICE |
99 | pid_t pid; | 99 | GNUNET_OS_Process *proc; |
100 | pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", | 100 | proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", |
101 | "gnunet-service-statistics", | 101 | "gnunet-service-statistics", |
102 | #if DEBUG_STATISTICS | 102 | #if DEBUG_STATISTICS |
103 | "-L", "DEBUG", | 103 | "-L", "DEBUG", |
@@ -107,12 +107,14 @@ check () | |||
107 | GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", | 107 | GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", |
108 | options, &run, &ok); | 108 | options, &run, &ok); |
109 | #if START_SERVICE | 109 | #if START_SERVICE |
110 | if (0 != PLIBC_KILL (pid, SIGTERM)) | 110 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) |
111 | { | 111 | { |
112 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 112 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
113 | ok = 1; | 113 | ok = 1; |
114 | } | 114 | } |
115 | GNUNET_OS_process_wait(pid); | 115 | GNUNET_OS_process_wait (proc); |
116 | GNUNET_OS_process_close (proc); | ||
117 | proc = NULL; | ||
116 | #endif | 118 | #endif |
117 | return ok; | 119 | return ok; |
118 | } | 120 | } |