diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-01 09:49:17 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-01 09:49:17 +0000 |
commit | 8962c636773aeb4a029b9db542b454bd64b2d915 (patch) | |
tree | 2f822035bca621ea7c8e3c26c2439447a42d4116 /src/transport/test_transport_api_multiaddress.c | |
parent | d7181f0e7bc21fe4d7193cea580d034cd188ea48 (diff) | |
download | gnunet-8962c636773aeb4a029b9db542b454bd64b2d915.tar.gz gnunet-8962c636773aeb4a029b9db542b454bd64b2d915.zip |
porting all tests using testing lib
Diffstat (limited to 'src/transport/test_transport_api_multiaddress.c')
-rw-r--r-- | src/transport/test_transport_api_multiaddress.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/transport/test_transport_api_multiaddress.c b/src/transport/test_transport_api_multiaddress.c index 8204610d7..1096df840 100644 --- a/src/transport/test_transport_api_multiaddress.c +++ b/src/transport/test_transport_api_multiaddress.c | |||
@@ -48,10 +48,17 @@ | |||
48 | * How long until we give up on transmitting the message? | 48 | * How long until we give up on transmitting the message? |
49 | */ | 49 | */ |
50 | #define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) | 50 | #define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
51 | |||
51 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90) | 52 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90) |
52 | 53 | ||
53 | #define MTYPE 12345 | 54 | #define MTYPE 12345 |
54 | 55 | ||
56 | static char *test_source; | ||
57 | |||
58 | static char *test_plugin; | ||
59 | |||
60 | static char *test_name; | ||
61 | |||
55 | static int ok; | 62 | static int ok; |
56 | 63 | ||
57 | static GNUNET_SCHEDULER_TaskIdentifier die_task; | 64 | static GNUNET_SCHEDULER_TaskIdentifier die_task; |
@@ -244,6 +251,16 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
244 | p2 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p2, ¬ify_receive, | 251 | p2 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p2, ¬ify_receive, |
245 | ¬ify_connect, ¬ify_disconnect, | 252 | ¬ify_connect, ¬ify_disconnect, |
246 | NULL); | 253 | NULL); |
254 | |||
255 | if ((p1 == NULL) || (p2 == NULL)) | ||
256 | { | ||
257 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); | ||
258 | if (die_task != GNUNET_SCHEDULER_NO_TASK) | ||
259 | GNUNET_SCHEDULER_cancel (die_task); | ||
260 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); | ||
261 | return; | ||
262 | } | ||
263 | |||
247 | cc = GNUNET_TRANSPORT_TESTING_connect_peers (p1, p2, &testing_connect_cb, | 264 | cc = GNUNET_TRANSPORT_TESTING_connect_peers (p1, p2, &testing_connect_cb, |
248 | NULL); | 265 | NULL); |
249 | } | 266 | } |
@@ -280,8 +297,14 @@ int | |||
280 | main (int argc, char *argv[]) | 297 | main (int argc, char *argv[]) |
281 | { | 298 | { |
282 | int ret; | 299 | int ret; |
300 | int nat_res; | ||
283 | 301 | ||
284 | GNUNET_log_setup ("test-transport-api", | 302 | GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source); |
303 | GNUNET_TRANSPORT_TESTING_get_test_plugin_name (argv[0], test_source, | ||
304 | &test_plugin); | ||
305 | GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name); | ||
306 | |||
307 | GNUNET_log_setup (test_name, | ||
285 | #if VERBOSE | 308 | #if VERBOSE |
286 | "DEBUG", | 309 | "DEBUG", |
287 | #else | 310 | #else |
@@ -289,10 +312,8 @@ main (int argc, char *argv[]) | |||
289 | #endif | 312 | #endif |
290 | NULL); | 313 | NULL); |
291 | 314 | ||
292 | int nat_res; | 315 | if ((strcmp (test_plugin, "tcp_nat") == 0) || |
293 | 316 | (strcmp (test_plugin, "udp_nat") == 0)) | |
294 | if ((strstr (argv[0], "tcp_nat") != NULL) || | ||
295 | (strstr (argv[0], "udp_nat") != NULL)) | ||
296 | { | 317 | { |
297 | nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); | 318 | nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); |
298 | if (GNUNET_NO == nat_res) | 319 | if (GNUNET_NO == nat_res) |
@@ -307,7 +328,6 @@ main (int argc, char *argv[]) | |||
307 | "gnunet-nat-server", "file not found"); | 328 | "gnunet-nat-server", "file not found"); |
308 | return 0; | 329 | return 0; |
309 | } | 330 | } |
310 | |||
311 | } | 331 | } |
312 | 332 | ||
313 | GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1); | 333 | GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1); |
@@ -318,6 +338,11 @@ main (int argc, char *argv[]) | |||
318 | GNUNET_free (cfg_file_p1); | 338 | GNUNET_free (cfg_file_p1); |
319 | GNUNET_free (cfg_file_p2); | 339 | GNUNET_free (cfg_file_p2); |
320 | 340 | ||
341 | GNUNET_free (test_source); | ||
342 | GNUNET_free (test_plugin); | ||
343 | GNUNET_free (test_name); | ||
344 | |||
345 | |||
321 | return ret; | 346 | return ret; |
322 | } | 347 | } |
323 | 348 | ||