aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/test_testbed_api_hosts.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/test_testbed_api_hosts.c')
-rw-r--r--src/testbed/test_testbed_api_hosts.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/testbed/test_testbed_api_hosts.c b/src/testbed/test_testbed_api_hosts.c
index 51284eaab..85677b2b8 100644
--- a/src/testbed/test_testbed_api_hosts.c
+++ b/src/testbed/test_testbed_api_hosts.c
@@ -34,6 +34,11 @@
34 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec) 34 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec)
35 35
36/** 36/**
37 * configuration handle to use as template configuration while creating hosts
38 */
39static struct GNUNET_CONFIGURATION_Handle *cfg;
40
41/**
37 * Host we are creating and using 42 * Host we are creating and using
38 */ 43 */
39static struct GNUNET_TESTBED_Host *host; 44static struct GNUNET_TESTBED_Host *host;
@@ -74,6 +79,11 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
74 num_hosts--; 79 num_hosts--;
75 } 80 }
76 GNUNET_free (hosts); 81 GNUNET_free (hosts);
82 if (NULL != cfg)
83 {
84 GNUNET_CONFIGURATION_destroy (cfg);
85 cfg = NULL;
86 }
77} 87}
78 88
79 89
@@ -87,18 +97,19 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
87 */ 97 */
88static void 98static void
89run (void *cls, char *const *args, const char *cfgfile, 99run (void *cls, char *const *args, const char *cfgfile,
90 const struct GNUNET_CONFIGURATION_Handle *cfg) 100 const struct GNUNET_CONFIGURATION_Handle *config)
91{ 101{
92 host = GNUNET_TESTBED_host_create ("localhost", NULL, 0); 102 cfg = GNUNET_CONFIGURATION_dup (config);
103 host = GNUNET_TESTBED_host_create ("localhost", NULL, cfg, 0);
93 GNUNET_assert (NULL != host); 104 GNUNET_assert (NULL != host);
94 GNUNET_assert (0 != GNUNET_TESTBED_host_get_id_ (host)); 105 GNUNET_assert (0 != GNUNET_TESTBED_host_get_id_ (host));
95 GNUNET_TESTBED_host_destroy (host); 106 GNUNET_TESTBED_host_destroy (host);
96 host = GNUNET_TESTBED_host_create (NULL, NULL, 0); 107 host = GNUNET_TESTBED_host_create (NULL, NULL, cfg, 0);
97 GNUNET_assert (NULL != host); 108 GNUNET_assert (NULL != host);
98 GNUNET_assert (0 == GNUNET_TESTBED_host_get_id_ (host)); 109 GNUNET_assert (0 == GNUNET_TESTBED_host_get_id_ (host));
99 GNUNET_assert (host == GNUNET_TESTBED_host_lookup_by_id_ (0)); 110 GNUNET_assert (host == GNUNET_TESTBED_host_lookup_by_id_ (0));
100 hosts = NULL; 111 hosts = NULL;
101 num_hosts = GNUNET_TESTBED_hosts_load_from_file ("sample_hosts.txt", &hosts); 112 num_hosts = GNUNET_TESTBED_hosts_load_from_file ("sample_hosts.txt", cfg, &hosts);
102 GNUNET_assert (15 == num_hosts); 113 GNUNET_assert (15 == num_hosts);
103 GNUNET_assert (NULL != hosts); 114 GNUNET_assert (NULL != hosts);
104 status = GNUNET_YES; 115 status = GNUNET_YES;