diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-10-10 09:59:29 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-10-10 09:59:29 +0000 |
commit | 7a351c8fb4240e9ccaef55816aa47fc0a5e553ce (patch) | |
tree | b1bb657c6ee0ab24bf892428d44545dddcb67ada /src | |
parent | df70bc0951a8789441170770096c537666ba0c99 (diff) | |
download | gnunet-7a351c8fb4240e9ccaef55816aa47fc0a5e553ce.tar.gz gnunet-7a351c8fb4240e9ccaef55816aa47fc0a5e553ce.zip |
- ignore GNUNET_TESTING_PREFIX in testbed helper
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_testing_lib.h | 7 | ||||
-rw-r--r-- | src/testbed/gnunet-helper-testbed.c | 22 | ||||
-rw-r--r-- | src/testing/testing.c | 2 |
3 files changed, 29 insertions, 2 deletions
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h index c15116876..910662d3f 100644 --- a/src/include/gnunet_testing_lib.h +++ b/src/include/gnunet_testing_lib.h | |||
@@ -51,6 +51,13 @@ extern "C" | |||
51 | #define GNUNET_TESTING_HOSTKEYFILESIZE sizeof (struct GNUNET_CRYPTO_EccPrivateKey) | 51 | #define GNUNET_TESTING_HOSTKEYFILESIZE sizeof (struct GNUNET_CRYPTO_EccPrivateKey) |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * The environmental variable, if set, that dictates where testing should place | ||
55 | * generated peer configurations | ||
56 | */ | ||
57 | #define GNUNET_TESTING_PREFIX "GNUNET_TESTING_PREFIX" | ||
58 | |||
59 | |||
60 | /** | ||
54 | * Handle for a system on which GNUnet peers are executed; | 61 | * Handle for a system on which GNUnet peers are executed; |
55 | * a system is used for reserving unique paths and ports. | 62 | * a system is used for reserving unique paths and ports. |
56 | */ | 63 | */ |
diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c index f49789a80..0bc6986ab 100644 --- a/src/testbed/gnunet-helper-testbed.c +++ b/src/testbed/gnunet-helper-testbed.c | |||
@@ -338,6 +338,7 @@ tokenizer_cb (void *cls, void *client, | |||
338 | char *config; | 338 | char *config; |
339 | char *xconfig; | 339 | char *xconfig; |
340 | char *evstr; | 340 | char *evstr; |
341 | char *str; | ||
341 | size_t config_size; | 342 | size_t config_size; |
342 | uLongf ul_config_size; | 343 | uLongf ul_config_size; |
343 | size_t xconfig_size; | 344 | size_t xconfig_size; |
@@ -401,8 +402,27 @@ tokenizer_cb (void *cls, void *client, | |||
401 | hostname_size); | 402 | hostname_size); |
402 | hostname[hostname_size] = '\0'; | 403 | hostname[hostname_size] = '\0'; |
403 | } | 404 | } |
405 | /* unset GNUNET_TESTING_PREFIX if present as it is more relevant for testbed */ | ||
406 | evstr = getenv (GNUNET_TESTING_PREFIX); | ||
407 | if (NULL != evstr) | ||
408 | { | ||
409 | #if WINDOWS | ||
410 | GNUNET_break (0 == putenv (GNUNET_TESTING_PREFIX "=")); | ||
411 | #else | ||
412 | gnunet_break (0 == unsetenv (GNUNET_TESTING_PREFIX)); | ||
413 | #endif | ||
414 | } | ||
404 | test_system = | 415 | test_system = |
405 | GNUNET_TESTING_system_create ("testbed-helper", trusted_ip, hostname, NULL); | 416 | GNUNET_TESTING_system_create ("testbed-helper", trusted_ip, hostname, |
417 | NULL); | ||
418 | if (NULL != evstr) | ||
419 | { | ||
420 | GNUNET_assert (0 < GNUNET_asprintf (&str, | ||
421 | GNUNET_TESTING_PREFIX "=%s", evstr)); | ||
422 | putenv (str); | ||
423 | /* do not free str will be consumed by putenv */ | ||
424 | GNUNET_free (evstr); | ||
425 | } | ||
406 | GNUNET_free_non_null (hostname); | 426 | GNUNET_free_non_null (hostname); |
407 | hostname = NULL; | 427 | hostname = NULL; |
408 | GNUNET_assert (NULL != test_system); | 428 | GNUNET_assert (NULL != test_system); |
diff --git a/src/testing/testing.c b/src/testing/testing.c index 4e60ae0f7..89d4c0f50 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -388,7 +388,7 @@ GNUNET_TESTING_system_create_with_portrange (const char *testdir, | |||
388 | 388 | ||
389 | GNUNET_assert (NULL != testdir); | 389 | GNUNET_assert (NULL != testdir); |
390 | system = GNUNET_malloc (sizeof (struct GNUNET_TESTING_System)); | 390 | system = GNUNET_malloc (sizeof (struct GNUNET_TESTING_System)); |
391 | if (NULL == (system->tmppath = getenv ("GNUNET_TESTING_PREFIX"))) | 391 | if (NULL == (system->tmppath = getenv (GNUNET_TESTING_PREFIX))) |
392 | system->tmppath = GNUNET_DISK_mkdtemp (testdir); | 392 | system->tmppath = GNUNET_DISK_mkdtemp (testdir); |
393 | else | 393 | else |
394 | system->tmppath = GNUNET_strdup (system->tmppath); | 394 | system->tmppath = GNUNET_strdup (system->tmppath); |