diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-08-31 13:48:59 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-08-31 13:48:59 +0000 |
commit | 721db5457eebf6e0d713cde2585ba298dbcfe1b7 (patch) | |
tree | 26c601343f30f3447fcc3a33f5eccec1d3373b64 /src/transport/test_transport_api.c | |
parent | c0d23c3d48800d92773a7e65cf1eb19998da98b5 (diff) | |
download | gnunet-721db5457eebf6e0d713cde2585ba298dbcfe1b7.tar.gz gnunet-721db5457eebf6e0d713cde2585ba298dbcfe1b7.zip |
moving code to generate cfg name used in every test to testing lib
Diffstat (limited to 'src/transport/test_transport_api.c')
-rw-r--r-- | src/transport/test_transport_api.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 365b833da..15f490947 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c | |||
@@ -233,6 +233,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
233 | NULL); | 233 | NULL); |
234 | } | 234 | } |
235 | 235 | ||
236 | |||
236 | static int | 237 | static int |
237 | check () | 238 | check () |
238 | { | 239 | { |
@@ -273,30 +274,8 @@ main (int argc, char *argv[]) | |||
273 | #endif | 274 | #endif |
274 | NULL); | 275 | NULL); |
275 | 276 | ||
276 | char *pch = strdup (argv[0]); | ||
277 | char *backup = pch; | ||
278 | char *filename = NULL; | ||
279 | char *dotexe; | ||
280 | int nat_res; | 277 | int nat_res; |
281 | 278 | ||
282 | /* get executable filename */ | ||
283 | pch = strtok (pch, "/"); | ||
284 | while (pch != NULL) | ||
285 | { | ||
286 | pch = strtok (NULL, "/"); | ||
287 | if (pch != NULL) | ||
288 | filename = pch; | ||
289 | } | ||
290 | /* remove "lt-" */ | ||
291 | filename = strstr (filename, "tes"); | ||
292 | if (NULL != (dotexe = strstr (filename, ".exe"))) | ||
293 | dotexe[0] = '\0'; | ||
294 | |||
295 | /* create cfg filename */ | ||
296 | GNUNET_asprintf (&cfg_file_p1, "%s_peer1.conf", filename); | ||
297 | GNUNET_asprintf (&cfg_file_p2, "%s_peer2.conf", filename); | ||
298 | GNUNET_free (backup); | ||
299 | |||
300 | if ((strstr (argv[0], "tcp_nat") != NULL) || | 279 | if ((strstr (argv[0], "tcp_nat") != NULL) || |
301 | (strstr (argv[0], "udp_nat") != NULL)) | 280 | (strstr (argv[0], "udp_nat") != NULL)) |
302 | { | 281 | { |
@@ -315,6 +294,10 @@ main (int argc, char *argv[]) | |||
315 | } | 294 | } |
316 | 295 | ||
317 | } | 296 | } |
297 | |||
298 | GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1); | ||
299 | GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p2, 2); | ||
300 | |||
318 | ret = check (); | 301 | ret = check (); |
319 | 302 | ||
320 | GNUNET_free (cfg_file_p1); | 303 | GNUNET_free (cfg_file_p1); |