diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-11 09:43:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-11 09:43:04 +0000 |
commit | d9d94d0e53d26af75ec8241383d166544ebd79f3 (patch) | |
tree | 9080b73624389403a198257fe0547bb4634e64d2 /src/util/test_resolver_api.c | |
parent | 2d792ee2e9cc0c993b8907e2c8edb0c2b8465343 (diff) | |
download | gnunet-d9d94d0e53d26af75ec8241383d166544ebd79f3.tar.gz gnunet-d9d94d0e53d26af75ec8241383d166544ebd79f3.zip |
converting to GNUNET_LOG_from*
Diffstat (limited to 'src/util/test_resolver_api.c')
-rw-r--r-- | src/util/test_resolver_api.c | 267 |
1 files changed, 134 insertions, 133 deletions
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c index 4e248aa72..24c71b41f 100644 --- a/src/util/test_resolver_api.c +++ b/src/util/test_resolver_api.c | |||
@@ -46,12 +46,13 @@ check_hostname (void *cls, const struct sockaddr *sa, socklen_t salen) | |||
46 | int *ok = cls; | 46 | int *ok = cls; |
47 | 47 | ||
48 | if (salen == 0) | 48 | if (salen == 0) |
49 | { | 49 | { |
50 | (*ok) &= ~8; | 50 | (*ok) &= ~8; |
51 | return; | 51 | return; |
52 | } | 52 | } |
53 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Got IP address `%s' for our host.\n"), | 53 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
54 | GNUNET_a2s (sa, salen)); | 54 | _("Got IP address `%s' for our host.\n"), GNUNET_a2s (sa, |
55 | salen)); | ||
55 | } | 56 | } |
56 | 57 | ||
57 | 58 | ||
@@ -63,21 +64,21 @@ check_localhost_num (void *cls, const char *hostname) | |||
63 | if (hostname == NULL) | 64 | if (hostname == NULL) |
64 | return; | 65 | return; |
65 | if (0 == strcmp (hostname, "127.0.0.1")) | 66 | if (0 == strcmp (hostname, "127.0.0.1")) |
66 | { | 67 | { |
67 | #if DEBUG_RESOLVER | 68 | #if DEBUG_RESOLVER |
68 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct hostname `%s'.\n", | 69 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
69 | hostname); | 70 | "Received correct hostname `%s'.\n", hostname); |
70 | #endif | 71 | #endif |
71 | (*ok) &= ~4; | 72 | (*ok) &= ~4; |
72 | } | 73 | } |
73 | else | 74 | else |
74 | { | 75 | { |
75 | #if DEBUG_RESOLVER | 76 | #if DEBUG_RESOLVER |
76 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received invalid hostname `%s'.\n", | 77 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
77 | hostname); | 78 | "Received invalid hostname `%s'.\n", hostname); |
78 | #endif | 79 | #endif |
79 | GNUNET_break (0); | 80 | GNUNET_break (0); |
80 | } | 81 | } |
81 | } | 82 | } |
82 | 83 | ||
83 | 84 | ||
@@ -89,19 +90,19 @@ check_localhost (void *cls, const char *hostname) | |||
89 | if (hostname == NULL) | 90 | if (hostname == NULL) |
90 | return; | 91 | return; |
91 | if (0 == strcmp (hostname, "localhost")) | 92 | if (0 == strcmp (hostname, "localhost")) |
92 | { | 93 | { |
93 | #if DEBUG_RESOLVER | 94 | #if DEBUG_RESOLVER |
94 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct hostname `%s'.\n", | 95 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
95 | hostname); | 96 | "Received correct hostname `%s'.\n", hostname); |
96 | #endif | 97 | #endif |
97 | (*ok) &= ~2; | 98 | (*ok) &= ~2; |
98 | } | 99 | } |
99 | else | 100 | else |
100 | { | 101 | { |
101 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 102 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
102 | "Received unexpected hostname `%s', expected `localhost' (this could be OK).\n", | 103 | "Received unexpected hostname `%s', expected `localhost' (this could be OK).\n", |
103 | hostname); | 104 | hostname); |
104 | } | 105 | } |
105 | } | 106 | } |
106 | 107 | ||
107 | static void | 108 | static void |
@@ -114,19 +115,19 @@ check_127 (void *cls, const struct sockaddr *sa, socklen_t salen) | |||
114 | return; | 115 | return; |
115 | GNUNET_assert (sizeof (struct sockaddr_in) == salen); | 116 | GNUNET_assert (sizeof (struct sockaddr_in) == salen); |
116 | if (sai->sin_addr.s_addr == htonl (INADDR_LOOPBACK)) | 117 | if (sai->sin_addr.s_addr == htonl (INADDR_LOOPBACK)) |
117 | { | 118 | { |
118 | #if DEBUG_RESOLVER | 119 | #if DEBUG_RESOLVER |
119 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct address.\n"); | 120 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received correct address.\n"); |
120 | #endif | 121 | #endif |
121 | (*ok) &= ~1; | 122 | (*ok) &= ~1; |
122 | } | 123 | } |
123 | else | 124 | else |
124 | { | 125 | { |
125 | #if DEBUG_RESOLVER | 126 | #if DEBUG_RESOLVER |
126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received incorrect address.\n"); | 127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received incorrect address.\n"); |
127 | #endif | 128 | #endif |
128 | GNUNET_break (0); | 129 | GNUNET_break (0); |
129 | } | 130 | } |
130 | } | 131 | } |
131 | 132 | ||
132 | static void | 133 | static void |
@@ -138,32 +139,32 @@ check_local_fqdn (void *cls, const char *gnunet_fqdn) | |||
138 | char hostname[GNUNET_OS_get_hostname_max_length () + 1]; | 139 | char hostname[GNUNET_OS_get_hostname_max_length () + 1]; |
139 | 140 | ||
140 | if (0 != gethostname (hostname, sizeof (hostname) - 1)) | 141 | if (0 != gethostname (hostname, sizeof (hostname) - 1)) |
141 | { | 142 | { |
142 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 143 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
143 | "gethostname"); | 144 | "gethostname"); |
144 | return; | 145 | return; |
145 | } | 146 | } |
146 | #if DEBUG_RESOLVER | 147 | #if DEBUG_RESOLVER |
147 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Resolving our FQDN `%s'\n"), | 148 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Resolving our FQDN `%s'\n"), |
148 | hostname); | 149 | hostname); |
149 | #endif | 150 | #endif |
150 | host = gethostbyname (hostname); | 151 | host = gethostbyname (hostname); |
151 | if (NULL == host) | 152 | if (NULL == host) |
152 | { | 153 | { |
153 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 154 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
154 | _("Could not resolve our FQDN : %s %u\n"), hstrerror (h_errno), | 155 | _("Could not resolve our FQDN : %s %u\n"), |
155 | h_errno); | 156 | hstrerror (h_errno), h_errno); |
156 | return; | 157 | return; |
157 | } | 158 | } |
158 | 159 | ||
159 | GNUNET_assert (0 != host); | 160 | GNUNET_assert (0 != host); |
160 | 161 | ||
161 | result = strcmp (host->h_name, gnunet_fqdn); | 162 | result = strcmp (host->h_name, gnunet_fqdn); |
162 | if (0 != result) | 163 | if (0 != result) |
163 | { | 164 | { |
164 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 165 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
165 | "Local resolved and resolver resolved fqdns are not equal\n"); | 166 | "Local resolved and resolver resolved fqdns are not equal\n"); |
166 | } | 167 | } |
167 | GNUNET_assert (0 == result); | 168 | GNUNET_assert (0 == result); |
168 | } | 169 | } |
169 | 170 | ||
@@ -180,21 +181,21 @@ check_rootserver_ip (void *cls, const struct sockaddr *sa, socklen_t salen) | |||
180 | GNUNET_assert (sizeof (struct sockaddr_in) == salen); | 181 | GNUNET_assert (sizeof (struct sockaddr_in) == salen); |
181 | 182 | ||
182 | if (0 == strcmp (inet_ntoa (sai->sin_addr), ROOTSERVER_IP)) | 183 | if (0 == strcmp (inet_ntoa (sai->sin_addr), ROOTSERVER_IP)) |
183 | { | 184 | { |
184 | #if DEBUG_RESOLVER | 185 | #if DEBUG_RESOLVER |
185 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 186 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
186 | "Received correct rootserver ip address.\n"); | 187 | "Received correct rootserver ip address.\n"); |
187 | #endif | 188 | #endif |
188 | (*ok) &= ~1; | 189 | (*ok) &= ~1; |
189 | } | 190 | } |
190 | else | 191 | else |
191 | { | 192 | { |
192 | #if DEBUG_RESOLVER | 193 | #if DEBUG_RESOLVER |
193 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 194 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
194 | "Received incorrect rootserver ip address.\n"); | 195 | "Received incorrect rootserver ip address.\n"); |
195 | #endif | 196 | #endif |
196 | GNUNET_break (0); | 197 | GNUNET_break (0); |
197 | } | 198 | } |
198 | } | 199 | } |
199 | 200 | ||
200 | static void | 201 | static void |
@@ -206,21 +207,21 @@ check_rootserver_name (void *cls, const char *hostname) | |||
206 | return; | 207 | return; |
207 | 208 | ||
208 | if (0 == strcmp (hostname, ROOTSERVER_NAME)) | 209 | if (0 == strcmp (hostname, ROOTSERVER_NAME)) |
209 | { | 210 | { |
210 | #if DEBUG_RESOLVER | 211 | #if DEBUG_RESOLVER |
211 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 212 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
212 | "Received correct rootserver hostname `%s'.\n", hostname); | 213 | "Received correct rootserver hostname `%s'.\n", hostname); |
213 | #endif | 214 | #endif |
214 | (*ok) &= ~2; | 215 | (*ok) &= ~2; |
215 | } | 216 | } |
216 | else | 217 | else |
217 | { | 218 | { |
218 | #if DEBUG_RESOLVER | 219 | #if DEBUG_RESOLVER |
219 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 220 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
220 | "Received invalid rootserver hostname `%s'.\n", hostname); | 221 | "Received invalid rootserver hostname `%s'.\n", hostname); |
221 | #endif | 222 | #endif |
222 | GNUNET_break (0); | 223 | GNUNET_break (0); |
223 | } | 224 | } |
224 | } | 225 | } |
225 | 226 | ||
226 | static void | 227 | static void |
@@ -230,7 +231,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
230 | int *ok = cls; | 231 | int *ok = cls; |
231 | struct sockaddr_in sa; | 232 | struct sockaddr_in sa; |
232 | struct GNUNET_TIME_Relative timeout = | 233 | struct GNUNET_TIME_Relative timeout = |
233 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30); | 234 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30); |
234 | int count_ips = 0; | 235 | int count_ips = 0; |
235 | char *own_fqdn; | 236 | char *own_fqdn; |
236 | 237 | ||
@@ -257,50 +258,50 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
257 | 258 | ||
258 | rootserver = gethostbyname (rootserver_name); | 259 | rootserver = gethostbyname (rootserver_name); |
259 | if (rootserver == NULL) | 260 | if (rootserver == NULL) |
260 | { | 261 | { |
261 | /* Error: resolving ip addresses does not work */ | 262 | /* Error: resolving ip addresses does not work */ |
262 | #if DEBUG_RESOLVER | 263 | #if DEBUG_RESOLVER |
263 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 264 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
264 | _("gethostbyname() could not lookup IP address: %s\n"), | 265 | _("gethostbyname() could not lookup IP address: %s\n"), |
265 | hstrerror (h_errno)); | 266 | hstrerror (h_errno)); |
266 | #endif | 267 | #endif |
267 | fprintf (stderr, | 268 | fprintf (stderr, |
268 | "System seems to be off-line, will not run all DNS tests\n"); | 269 | "System seems to be off-line, will not run all DNS tests\n"); |
269 | *ok = 0; /* mark test as passing anyway */ | 270 | *ok = 0; /* mark test as passing anyway */ |
270 | return; | 271 | return; |
271 | } | 272 | } |
272 | 273 | ||
273 | /* Counting returned IP addresses */ | 274 | /* Counting returned IP addresses */ |
274 | while (rootserver->h_addr_list[count_ips] != NULL) | 275 | while (rootserver->h_addr_list[count_ips] != NULL) |
275 | count_ips++; | 276 | count_ips++; |
276 | if (count_ips > 1) | 277 | if (count_ips > 1) |
277 | { | 278 | { |
278 | #if DEBUG_RESOLVER | 279 | #if DEBUG_RESOLVER |
279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 280 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
280 | "IP received range for root name server, but a root name server has only 1 IP\n"); | 281 | "IP received range for root name server, but a root name server has only 1 IP\n"); |
281 | #endif | 282 | #endif |
282 | GNUNET_break (0); | 283 | GNUNET_break (0); |
283 | } | 284 | } |
284 | 285 | ||
285 | /* Comparing to resolved address to the address the root name server should have */ | 286 | /* Comparing to resolved address to the address the root name server should have */ |
286 | if (strcmp | 287 | if (strcmp |
287 | (inet_ntoa (*(struct in_addr *) rootserver->h_addr_list[0]), | 288 | (inet_ntoa (*(struct in_addr *) rootserver->h_addr_list[0]), |
288 | ROOTSERVER_IP) != 0) | 289 | ROOTSERVER_IP) != 0) |
289 | { | 290 | { |
290 | #if DEBUG_RESOLVER | 291 | #if DEBUG_RESOLVER |
291 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 292 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
292 | "IP received and IP for root name server differ\n"); | 293 | "IP received and IP for root name server differ\n"); |
293 | #endif | 294 | #endif |
294 | GNUNET_break (0); | 295 | GNUNET_break (0); |
295 | } | 296 | } |
296 | #if DEBUG_RESOLVER | 297 | #if DEBUG_RESOLVER |
297 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 298 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
298 | "System's own forward name resolution is working\n"); | 299 | "System's own forward name resolution is working\n"); |
299 | #endif | 300 | #endif |
300 | 301 | ||
301 | /* Resolve the same using GNUNET */ | 302 | /* Resolve the same using GNUNET */ |
302 | GNUNET_RESOLVER_ip_get (ROOTSERVER_NAME, AF_INET, timeout, | 303 | GNUNET_RESOLVER_ip_get (ROOTSERVER_NAME, AF_INET, timeout, |
303 | &check_rootserver_ip, cls); | 304 | &check_rootserver_ip, cls); |
304 | 305 | ||
305 | /* | 306 | /* |
306 | * Success: forward lookups work as expected | 307 | * Success: forward lookups work as expected |
@@ -311,41 +312,41 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
311 | 312 | ||
312 | rootserver->h_name = ""; | 313 | rootserver->h_name = ""; |
313 | if (1 != inet_pton (AF_INET, ROOTSERVER_IP, &rootserver_addr)) | 314 | if (1 != inet_pton (AF_INET, ROOTSERVER_IP, &rootserver_addr)) |
314 | { | 315 | { |
315 | #if DEBUG_RESOLVER | 316 | #if DEBUG_RESOLVER |
316 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 317 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
317 | "Could not transform root name server IP address\n"); | 318 | "Could not transform root name server IP address\n"); |
318 | #endif | 319 | #endif |
319 | GNUNET_break (0); | 320 | GNUNET_break (0); |
320 | } | 321 | } |
321 | 322 | ||
322 | rootserver = | 323 | rootserver = |
323 | gethostbyaddr (&rootserver_addr, sizeof (rootserver_addr), AF_INET); | 324 | gethostbyaddr (&rootserver_addr, sizeof (rootserver_addr), AF_INET); |
324 | if (rootserver == NULL) | 325 | if (rootserver == NULL) |
325 | { | 326 | { |
326 | /* Error: resolving IP addresses does not work */ | 327 | /* Error: resolving IP addresses does not work */ |
327 | #if DEBUG_RESOLVER | 328 | #if DEBUG_RESOLVER |
328 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 329 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
329 | _("gethostbyaddr() could not lookup hostname: %s\n"), | 330 | _("gethostbyaddr() could not lookup hostname: %s\n"), |
330 | hstrerror (h_errno)); | 331 | hstrerror (h_errno)); |
331 | #endif | 332 | #endif |
332 | GNUNET_break (0); | 333 | GNUNET_break (0); |
333 | } | 334 | } |
334 | else | 335 | else |
335 | { | ||
336 | if (0 != strcmp (rootserver->h_name, ROOTSERVER_NAME)) | ||
337 | { | 336 | { |
337 | if (0 != strcmp (rootserver->h_name, ROOTSERVER_NAME)) | ||
338 | { | ||
338 | #if DEBUG_RESOLVER | 339 | #if DEBUG_RESOLVER |
339 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 340 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
340 | "Received hostname and hostname for root name server differ\n"); | 341 | "Received hostname and hostname for root name server differ\n"); |
341 | #endif | 342 | #endif |
342 | GNUNET_break (0); | 343 | GNUNET_break (0); |
344 | } | ||
343 | } | 345 | } |
344 | } | ||
345 | 346 | ||
346 | #if DEBUG_RESOLVER | 347 | #if DEBUG_RESOLVER |
347 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 348 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
348 | "System's own reverse name resolution is working\n"); | 349 | "System's own reverse name resolution is working\n"); |
349 | #endif | 350 | #endif |
350 | 351 | ||
351 | /* Resolve the same using GNUNET */ | 352 | /* Resolve the same using GNUNET */ |
@@ -360,8 +361,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
360 | sa.sin_addr.S_un.S_addr = inet_addr (ROOTSERVER_IP); | 361 | sa.sin_addr.S_un.S_addr = inet_addr (ROOTSERVER_IP); |
361 | #endif | 362 | #endif |
362 | GNUNET_RESOLVER_hostname_get ((const struct sockaddr *) &sa, | 363 | GNUNET_RESOLVER_hostname_get ((const struct sockaddr *) &sa, |
363 | sizeof (struct sockaddr), GNUNET_YES, timeout, | 364 | sizeof (struct sockaddr), GNUNET_YES, timeout, |
364 | &check_rootserver_name, cls); | 365 | &check_rootserver_name, cls); |
365 | 366 | ||
366 | memset (&sa, 0, sizeof (sa)); | 367 | memset (&sa, 0, sizeof (sa)); |
367 | sa.sin_family = AF_INET; | 368 | sa.sin_family = AF_INET; |
@@ -372,12 +373,12 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
372 | 373 | ||
373 | GNUNET_RESOLVER_ip_get ("localhost", AF_INET, timeout, &check_127, cls); | 374 | GNUNET_RESOLVER_ip_get ("localhost", AF_INET, timeout, &check_127, cls); |
374 | GNUNET_RESOLVER_hostname_get ((const struct sockaddr *) &sa, | 375 | GNUNET_RESOLVER_hostname_get ((const struct sockaddr *) &sa, |
375 | sizeof (struct sockaddr), GNUNET_YES, timeout, | 376 | sizeof (struct sockaddr), GNUNET_YES, timeout, |
376 | &check_localhost, cls); | 377 | &check_localhost, cls); |
377 | 378 | ||
378 | GNUNET_RESOLVER_hostname_get ((const struct sockaddr *) &sa, | 379 | GNUNET_RESOLVER_hostname_get ((const struct sockaddr *) &sa, |
379 | sizeof (struct sockaddr), GNUNET_NO, timeout, | 380 | sizeof (struct sockaddr), GNUNET_NO, timeout, |
380 | &check_localhost_num, cls); | 381 | &check_localhost_num, cls); |
381 | GNUNET_RESOLVER_hostname_resolve (AF_UNSPEC, timeout, &check_hostname, cls); | 382 | GNUNET_RESOLVER_hostname_resolve (AF_UNSPEC, timeout, &check_hostname, cls); |
382 | 383 | ||
383 | } | 384 | } |
@@ -391,33 +392,33 @@ check () | |||
391 | struct GNUNET_OS_Process *proc; | 392 | struct GNUNET_OS_Process *proc; |
392 | 393 | ||
393 | char *const argv[] = | 394 | char *const argv[] = |
394 | { "test-resolver-api", "-c", "test_resolver_api_data.conf", | 395 | { "test-resolver-api", "-c", "test_resolver_api_data.conf", |
395 | #if VERBOSE | 396 | #if VERBOSE |
396 | "-L", "DEBUG", | 397 | "-L", "DEBUG", |
397 | #endif | 398 | #endif |
398 | NULL | 399 | NULL |
399 | }; | 400 | }; |
400 | struct GNUNET_GETOPT_CommandLineOption options[] = | 401 | struct GNUNET_GETOPT_CommandLineOption options[] = |
401 | { GNUNET_GETOPT_OPTION_END }; | 402 | { GNUNET_GETOPT_OPTION_END }; |
402 | pfx = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); | 403 | pfx = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); |
403 | GNUNET_asprintf (&fn, "%s%cgnunet-service-resolver", pfx, DIR_SEPARATOR); | 404 | GNUNET_asprintf (&fn, "%s%cgnunet-service-resolver", pfx, DIR_SEPARATOR); |
404 | GNUNET_free (pfx); | 405 | GNUNET_free (pfx); |
405 | proc = GNUNET_OS_start_process (NULL, NULL, fn, "gnunet-service-resolver", | 406 | proc = GNUNET_OS_start_process (NULL, NULL, fn, "gnunet-service-resolver", |
406 | #if VERBOSE | 407 | #if VERBOSE |
407 | "-L", "DEBUG", | 408 | "-L", "DEBUG", |
408 | #endif | 409 | #endif |
409 | "-c", "test_resolver_api_data.conf", NULL); | 410 | "-c", "test_resolver_api_data.conf", NULL); |
410 | GNUNET_assert (NULL != proc); | 411 | GNUNET_assert (NULL != proc); |
411 | GNUNET_free (fn); | 412 | GNUNET_free (fn); |
412 | GNUNET_assert (GNUNET_OK == | 413 | GNUNET_assert (GNUNET_OK == |
413 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | 414 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, |
414 | argv, "test-resolver-api", "nohelp", | 415 | argv, "test-resolver-api", "nohelp", |
415 | options, &run, &ok)); | 416 | options, &run, &ok)); |
416 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) | 417 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) |
417 | { | 418 | { |
418 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 419 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
419 | ok = 1; | 420 | ok = 1; |
420 | } | 421 | } |
421 | GNUNET_OS_process_wait (proc); | 422 | GNUNET_OS_process_wait (proc); |
422 | GNUNET_OS_process_close (proc); | 423 | GNUNET_OS_process_close (proc); |
423 | proc = NULL; | 424 | proc = NULL; |
@@ -433,11 +434,11 @@ main (int argc, char *argv[]) | |||
433 | 434 | ||
434 | GNUNET_log_setup ("test-resolver-api", | 435 | GNUNET_log_setup ("test-resolver-api", |
435 | #if VERBOSE | 436 | #if VERBOSE |
436 | "DEBUG", | 437 | "DEBUG", |
437 | #else | 438 | #else |
438 | "WARNING", | 439 | "WARNING", |
439 | #endif | 440 | #endif |
440 | NULL); | 441 | NULL); |
441 | ret = check (); | 442 | ret = check (); |
442 | 443 | ||
443 | return ret; | 444 | return ret; |