diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-06-16 12:35:26 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-06-16 12:35:26 +0000 |
commit | 33cbde487152c775a38628ae7b12e8f5e8040a52 (patch) | |
tree | 3edafc6f153c9cf47f92d71bcb3d2f64b1ddc6f9 /src/transport/test_transport_api_reliability.c | |
parent | 2aff944f4bce448c67c576d384926c2ffe8c8c5a (diff) | |
download | gnunet-33cbde487152c775a38628ae7b12e8f5e8040a52.tar.gz gnunet-33cbde487152c775a38628ae7b12e8f5e8040a52.zip |
clean up in transport tests
Diffstat (limited to 'src/transport/test_transport_api_reliability.c')
-rw-r--r-- | src/transport/test_transport_api_reliability.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 45642486c..4db329ad6 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "gnunet_transport_service.h" | 36 | #include "gnunet_transport_service.h" |
37 | #include "gauger.h" | 37 | #include "gauger.h" |
38 | #include "transport.h" | 38 | #include "transport.h" |
39 | #include "transport-testing.h" | ||
39 | 40 | ||
40 | #define VERBOSE GNUNET_NO | 41 | #define VERBOSE GNUNET_NO |
41 | 42 | ||
@@ -57,16 +58,6 @@ | |||
57 | 58 | ||
58 | #define MTYPE 12345 | 59 | #define MTYPE 12345 |
59 | 60 | ||
60 | struct PeerContext | ||
61 | { | ||
62 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
63 | struct GNUNET_TRANSPORT_Handle *th; | ||
64 | struct GNUNET_PeerIdentity id; | ||
65 | #if START_ARM | ||
66 | struct GNUNET_OS_Process *arm_proc; | ||
67 | #endif | ||
68 | }; | ||
69 | |||
70 | static struct PeerContext p1; | 61 | static struct PeerContext p1; |
71 | 62 | ||
72 | static struct PeerContext p2; | 63 | static struct PeerContext p2; |
@@ -438,6 +429,11 @@ static void | |||
438 | setup_peer (struct PeerContext *p, const char *cfgname) | 429 | setup_peer (struct PeerContext *p, const char *cfgname) |
439 | { | 430 | { |
440 | p->cfg = GNUNET_CONFIGURATION_create (); | 431 | p->cfg = GNUNET_CONFIGURATION_create (); |
432 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | ||
433 | if (GNUNET_CONFIGURATION_have_value (p->cfg,"PATHS", "SERVICEHOME")) | ||
434 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "PATHS", "SERVICEHOME", &p->servicehome); | ||
435 | GNUNET_DISK_directory_remove (p->servicehome); | ||
436 | |||
441 | #if START_ARM | 437 | #if START_ARM |
442 | p->arm_proc = GNUNET_OS_start_process (NULL, NULL, | 438 | p->arm_proc = GNUNET_OS_start_process (NULL, NULL, |
443 | "gnunet-service-arm", | 439 | "gnunet-service-arm", |
@@ -447,7 +443,6 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
447 | #endif | 443 | #endif |
448 | "-c", cfgname, NULL); | 444 | "-c", cfgname, NULL); |
449 | #endif | 445 | #endif |
450 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | ||
451 | 446 | ||
452 | if (is_https) | 447 | if (is_https) |
453 | { | 448 | { |
@@ -462,11 +457,11 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
462 | if (0 == stat (key_file_p1, &sbuf )) | 457 | if (0 == stat (key_file_p1, &sbuf )) |
463 | { | 458 | { |
464 | if (0 == remove(key_file_p1)) | 459 | if (0 == remove(key_file_p1)) |
465 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 460 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
466 | "Successfully removed existing private key file `%s'\n", | 461 | "Successfully removed existing private key file `%s'\n", |
467 | key_file_p1); | 462 | key_file_p1); |
468 | else | 463 | else |
469 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 464 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
470 | "Failed to remove private key file `%s'\n", | 465 | "Failed to remove private key file `%s'\n", |
471 | key_file_p1); | 466 | key_file_p1); |
472 | } | 467 | } |
@@ -477,11 +472,11 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
477 | if (0 == stat (cert_file_p1, &sbuf )) | 472 | if (0 == stat (cert_file_p1, &sbuf )) |
478 | { | 473 | { |
479 | if (0 == remove(cert_file_p1)) | 474 | if (0 == remove(cert_file_p1)) |
480 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 475 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
481 | "Successfully removed existing certificate file `%s'\n", | 476 | "Successfully removed existing certificate file `%s'\n", |
482 | cert_file_p1); | 477 | cert_file_p1); |
483 | else | 478 | else |
484 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 479 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
485 | "Failed to remove existing certificate file `%s'\n", | 480 | "Failed to remove existing certificate file `%s'\n", |
486 | cert_file_p1); | 481 | cert_file_p1); |
487 | } | 482 | } |
@@ -496,11 +491,11 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
496 | if (0 == stat (key_file_p2, &sbuf )) | 491 | if (0 == stat (key_file_p2, &sbuf )) |
497 | { | 492 | { |
498 | if (0 == remove(key_file_p2)) | 493 | if (0 == remove(key_file_p2)) |
499 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 494 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
500 | "Successfully removed existing private key file `%s'\n", | 495 | "Successfully removed existing private key file `%s'\n", |
501 | key_file_p2); | 496 | key_file_p2); |
502 | else | 497 | else |
503 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 498 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
504 | "Failed to remove private key file `%s'\n", | 499 | "Failed to remove private key file `%s'\n", |
505 | key_file_p2); | 500 | key_file_p2); |
506 | } | 501 | } |
@@ -511,11 +506,11 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
511 | if (0 == stat (cert_file_p2, &sbuf )) | 506 | if (0 == stat (cert_file_p2, &sbuf )) |
512 | { | 507 | { |
513 | if (0 == remove(cert_file_p2)) | 508 | if (0 == remove(cert_file_p2)) |
514 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 509 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
515 | "Successfully removed existing certificate file `%s'\n", | 510 | "Successfully removed existing certificate file `%s'\n", |
516 | cert_file_p2); | 511 | cert_file_p2); |
517 | else | 512 | else |
518 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 513 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
519 | "Failed to remove existing certificate file `%s'\n", | 514 | "Failed to remove existing certificate file `%s'\n", |
520 | cert_file_p2); | 515 | cert_file_p2); |
521 | } | 516 | } |
@@ -798,6 +793,8 @@ check () | |||
798 | GNUNET_free(key_file_p2); | 793 | GNUNET_free(key_file_p2); |
799 | GNUNET_free(cert_file_p1); | 794 | GNUNET_free(cert_file_p1); |
800 | GNUNET_free(cert_file_p2); | 795 | GNUNET_free(cert_file_p2); |
796 | GNUNET_free(p1.servicehome); | ||
797 | GNUNET_free(p2.servicehome); | ||
801 | } | 798 | } |
802 | 799 | ||
803 | return ok; | 800 | return ok; |
@@ -812,9 +809,6 @@ main (int argc, char *argv[]) | |||
812 | return GNUNET_SYSERR; | 809 | return GNUNET_SYSERR; |
813 | #endif | 810 | #endif |
814 | 811 | ||
815 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-1"); | ||
816 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-2"); | ||
817 | |||
818 | if (strstr(argv[0], "tcp_nat") != NULL) | 812 | if (strstr(argv[0], "tcp_nat") != NULL) |
819 | { | 813 | { |
820 | is_tcp_nat = GNUNET_YES; | 814 | is_tcp_nat = GNUNET_YES; |
@@ -857,8 +851,8 @@ main (int argc, char *argv[]) | |||
857 | #endif | 851 | #endif |
858 | NULL); | 852 | NULL); |
859 | ret = check (); | 853 | ret = check (); |
860 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-1"); | 854 | GNUNET_DISK_directory_remove (p1.servicehome); |
861 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-2"); | 855 | GNUNET_DISK_directory_remove (p2.servicehome); |
862 | return ret; | 856 | return ret; |
863 | } | 857 | } |
864 | 858 | ||