aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-06-16 12:35:26 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-06-16 12:35:26 +0000
commit33cbde487152c775a38628ae7b12e8f5e8040a52 (patch)
tree3edafc6f153c9cf47f92d71bcb3d2f64b1ddc6f9 /src/transport/test_transport_api.c
parent2aff944f4bce448c67c576d384926c2ffe8c8c5a (diff)
downloadgnunet-33cbde487152c775a38628ae7b12e8f5e8040a52.tar.gz
gnunet-33cbde487152c775a38628ae7b12e8f5e8040a52.zip
clean up in transport tests
Diffstat (limited to 'src/transport/test_transport_api.c')
-rw-r--r--src/transport/test_transport_api.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c
index 8b057d513..853ce9aa5 100644
--- a/src/transport/test_transport_api.c
+++ b/src/transport/test_transport_api.c
@@ -35,6 +35,7 @@
35#include "gnunet_scheduler_lib.h" 35#include "gnunet_scheduler_lib.h"
36#include "gnunet_transport_service.h" 36#include "gnunet_transport_service.h"
37#include "transport.h" 37#include "transport.h"
38#include "transport-testing.h"
38 39
39#define VERBOSE GNUNET_NO 40#define VERBOSE GNUNET_NO
40 41
@@ -54,16 +55,6 @@
54 55
55#define MTYPE 12345 56#define MTYPE 12345
56 57
57struct PeerContext
58{
59 struct GNUNET_CONFIGURATION_Handle *cfg;
60 struct GNUNET_TRANSPORT_Handle *th;
61 struct GNUNET_PeerIdentity id;
62#if START_ARM
63 struct GNUNET_OS_Process *arm_proc;
64#endif
65};
66
67static struct PeerContext p1; 58static struct PeerContext p1;
68 59
69static struct PeerContext p2; 60static struct PeerContext p2;
@@ -276,6 +267,12 @@ setup_peer (struct PeerContext *p,
276 const char *cfgname) 267 const char *cfgname)
277{ 268{
278 p->cfg = GNUNET_CONFIGURATION_create (); 269 p->cfg = GNUNET_CONFIGURATION_create ();
270
271 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
272 if (GNUNET_CONFIGURATION_have_value (p->cfg,"PATHS", "SERVICEHOME"))
273 GNUNET_CONFIGURATION_get_value_string (p->cfg, "PATHS", "SERVICEHOME", &p->servicehome);
274 GNUNET_DISK_directory_remove (p->servicehome);
275
279#if START_ARM 276#if START_ARM
280 p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", 277 p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
281 "gnunet-service-arm", 278 "gnunet-service-arm",
@@ -284,7 +281,10 @@ setup_peer (struct PeerContext *p,
284#endif 281#endif
285 "-c", cfgname, NULL); 282 "-c", cfgname, NULL);
286#endif 283#endif
287 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 284
285
286 if (GNUNET_CONFIGURATION_have_value (p->cfg,"PATHS", "SERVICEHOME"))
287 GNUNET_CONFIGURATION_get_value_string (p->cfg, "PATHS", "SERVICEHOME", &p->servicehome);
288 288
289 if (is_https) 289 if (is_https)
290 { 290 {
@@ -514,6 +514,14 @@ check ()
514 GNUNET_free(cert_file_p1); 514 GNUNET_free(cert_file_p1);
515 GNUNET_free(cert_file_p2); 515 GNUNET_free(cert_file_p2);
516 } 516 }
517
518 if ((p1.servicehome != NULL) && (p2.servicehome != NULL))
519 {
520 GNUNET_DISK_directory_remove (p1.servicehome);
521 GNUNET_DISK_directory_remove (p2.servicehome);
522 GNUNET_free(p1.servicehome);
523 GNUNET_free(p2.servicehome);
524 }
517 return ok; 525 return ok;
518} 526}
519 527
@@ -668,7 +676,8 @@ main (int argc, char *argv[])
668 "`%s' not properly installed, cannot run NAT test!\n", 676 "`%s' not properly installed, cannot run NAT test!\n",
669 "gnunet-nat-server"); 677 "gnunet-nat-server");
670 return 0; 678 return 0;
671 } 679 } GNUNET_free(p1.servicehome);
680 GNUNET_free(p2.servicehome);
672 } 681 }
673 else if (strstr(argv[0], "udp") != NULL) 682 else if (strstr(argv[0], "udp") != NULL)
674 { 683 {
@@ -696,16 +705,6 @@ main (int argc, char *argv[])
696 } 705 }
697 706
698 ret = check (); 707 ret = check ();
699 if (is_multi_protocol)
700 {
701 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-multi-peer-1/");
702 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-multi-peer-2/");
703 }
704 else
705 {
706 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-1");
707 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-2");
708 }
709 708
710 return ret; 709 return ret;
711} 710}