aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_testing_group_remote.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-08-17 09:41:13 +0000
committerNathan S. Evans <evans@in.tum.de>2010-08-17 09:41:13 +0000
commit3320e39dc2f8d5a7640919699a7ad090157c13b8 (patch)
treee06875d4a7bffd87ce91ec29fcdd3b9a4cd8606b /src/testing/test_testing_group_remote.c
parentf9352a8d4b25831e3b890890a364bfe35f3f07fe (diff)
downloadgnunet-3320e39dc2f8d5a7640919699a7ad090157c13b8.tar.gz
gnunet-3320e39dc2f8d5a7640919699a7ad090157c13b8.zip
fixing unused testcase
Diffstat (limited to 'src/testing/test_testing_group_remote.c')
-rw-r--r--src/testing/test_testing_group_remote.c66
1 files changed, 59 insertions, 7 deletions
diff --git a/src/testing/test_testing_group_remote.c b/src/testing/test_testing_group_remote.c
index 806d45042..b4d04fdd8 100644
--- a/src/testing/test_testing_group_remote.c
+++ b/src/testing/test_testing_group_remote.c
@@ -48,7 +48,6 @@ static struct GNUNET_SCHEDULER_Handle *sched;
48 48
49static unsigned long long num_peers; 49static unsigned long long num_peers;
50 50
51static char *hostnames;
52 51
53/** 52/**
54 * Check whether peers successfully shut down. 53 * Check whether peers successfully shut down.
@@ -106,6 +105,13 @@ run (void *cls,
106 char *const *args, 105 char *const *args,
107 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) 106 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
108{ 107{
108 struct GNUNET_TESTING_Host *hosts;
109 struct GNUNET_TESTING_Host *temphost;
110 char *hostfile;
111 struct stat frstat;
112 char *buf;
113 char *data;
114 int count;
109 sched = s; 115 sched = s;
110 ok = 1; 116 ok = 1;
111#if VERBOSE 117#if VERBOSE
@@ -117,12 +123,58 @@ run (void *cls,
117 &num_peers)) 123 &num_peers))
118 num_peers = DEFAULT_NUM_PEERS; 124 num_peers = DEFAULT_NUM_PEERS;
119 125
120 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "hosts", 126 if (GNUNET_OK !=
121 &hostnames)) 127 GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "hostfile",
122 { 128 &hostfile))
123 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "No hosts specified, running all tests on localhost\n"); 129 hostfile = NULL;
124 }
125 130
131 hosts = NULL;
132 if (hostfile != NULL)
133 {
134 if (GNUNET_OK != GNUNET_DISK_file_test (hostfile))
135 GNUNET_DISK_fn_write (hostfile, NULL, 0, GNUNET_DISK_PERM_USER_READ
136 | GNUNET_DISK_PERM_USER_WRITE);
137 if ((0 != STAT (hostfile, &frstat)) || (frstat.st_size == 0))
138 {
139 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
140 "Could not open file specified for host list, ending test!");
141 ok = 1119;
142 GNUNET_free(hostfile);
143 return;
144 }
145
146 data = GNUNET_malloc_large (frstat.st_size);
147 GNUNET_assert(data != NULL);
148 if (frstat.st_size !=
149 GNUNET_DISK_fn_read (hostfile, data, frstat.st_size))
150 {
151 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
152 "Could not read file %s specified for host list, ending test!", hostfile);
153 GNUNET_free (hostfile);
154 GNUNET_free (data);
155 return;
156 }
157
158 GNUNET_free_non_null(hostfile);
159
160 buf = data;
161 count = 0;
162 while (count < frstat.st_size)
163 {
164 count++;
165 if (((data[count] == '\n') || (data[count] == '\0')) && (buf != &data[count]))
166 {
167 data[count] = '\0';
168 temphost = GNUNET_malloc(sizeof(struct GNUNET_TESTING_Host));
169 temphost->hostname = buf;
170 temphost->next = hosts;
171 hosts = temphost;
172 buf = &data[count + 1];
173 }
174 else if ((data[count] == '\n') || (data[count] == '\0'))
175 buf = &data[count + 1];
176 }
177 }
126 178
127 peers_left = num_peers; 179 peers_left = num_peers;
128 pg = GNUNET_TESTING_daemons_start (sched, 180 pg = GNUNET_TESTING_daemons_start (sched,
@@ -135,7 +187,7 @@ run (void *cls,
135 NULL, 187 NULL,
136 NULL, 188 NULL,
137 NULL, 189 NULL,
138 hostnames); 190 hosts);
139 GNUNET_assert (pg != NULL); 191 GNUNET_assert (pg != NULL);
140} 192}
141 193