diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-06-10 17:28:57 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-06-10 17:28:57 +0000 |
commit | 06911f8500b00a945947ca8eae6f7fbb758f5efb (patch) | |
tree | 40497dba09013b6eed9eb7c895ee3a5dfb136dae /src/testing | |
parent | bb8ba0f0be8bfd477b35b30c58be8e572945139c (diff) | |
download | gnunet-06911f8500b00a945947ca8eae6f7fbb758f5efb.tar.gz gnunet-06911f8500b00a945947ca8eae6f7fbb758f5efb.zip |
-updated documentation
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/testing.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c index 39d7b717d..9e18628c1 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -237,21 +237,24 @@ hostkeys_unload (struct GNUNET_TESTING_System *system) | |||
237 | * Create a system handle. There must only be one system | 237 | * Create a system handle. There must only be one system |
238 | * handle per operating system. | 238 | * handle per operating system. |
239 | * | 239 | * |
240 | * @param tmppath prefix path to use for all service homes | 240 | * @param testdir only the directory name without any path. This is used for |
241 | * all service homes; the directory will be created in a temporary | ||
242 | * location depending on the underlying OS | ||
243 | * | ||
241 | * @param controller hostname of the controlling host, | 244 | * @param controller hostname of the controlling host, |
242 | * service configurations are modified to allow | 245 | * service configurations are modified to allow |
243 | * control connections from this host; can be NULL | 246 | * control connections from this host; can be NULL |
244 | * @return handle to this system, NULL on error | 247 | * @return handle to this system, NULL on error |
245 | */ | 248 | */ |
246 | struct GNUNET_TESTING_System * | 249 | struct GNUNET_TESTING_System * |
247 | GNUNET_TESTING_system_create (const char *tmppath, | 250 | GNUNET_TESTING_system_create (const char *testdir, |
248 | const char *controller) | 251 | const char *controller) |
249 | { | 252 | { |
250 | struct GNUNET_TESTING_System *system; | 253 | struct GNUNET_TESTING_System *system; |
251 | 254 | ||
252 | GNUNET_assert (NULL != tmppath); | 255 | GNUNET_assert (NULL != testdir); |
253 | system = GNUNET_malloc (sizeof (struct GNUNET_TESTING_System)); | 256 | system = GNUNET_malloc (sizeof (struct GNUNET_TESTING_System)); |
254 | system->tmppath = GNUNET_DISK_mkdtemp (tmppath); | 257 | system->tmppath = GNUNET_DISK_mkdtemp (testdir); |
255 | if (NULL == system->tmppath) | 258 | if (NULL == system->tmppath) |
256 | { | 259 | { |
257 | GNUNET_free (system); | 260 | GNUNET_free (system); |
@@ -272,7 +275,7 @@ GNUNET_TESTING_system_create (const char *tmppath, | |||
272 | * Free system resources. | 275 | * Free system resources. |
273 | * | 276 | * |
274 | * @param system system to be freed | 277 | * @param system system to be freed |
275 | * @param remove_paths should the 'tmppath' and all subdirectories | 278 | * @param remove_paths should the 'testdir' and all subdirectories |
276 | * be removed (clean up on shutdown)? | 279 | * be removed (clean up on shutdown)? |
277 | */ | 280 | */ |
278 | void | 281 | void |
@@ -876,8 +879,9 @@ GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer) | |||
876 | * and should thus be called directly from "main". The testcase | 879 | * and should thus be called directly from "main". The testcase |
877 | * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'. | 880 | * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'. |
878 | * | 881 | * |
879 | * @param tmppath path for storing temporary data for the test | 882 | * @param testdir only the directory name without any path. This is used for |
880 | * also used to setup the program name for logging | 883 | * all service homes; the directory will be created in a temporary |
884 | * location depending on the underlying OS | ||
881 | * @param cfgfilename name of the configuration file to use; | 885 | * @param cfgfilename name of the configuration file to use; |
882 | * use NULL to only run with defaults | 886 | * use NULL to only run with defaults |
883 | * @param tm main function of the testcase | 887 | * @param tm main function of the testcase |
@@ -885,12 +889,12 @@ GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer) | |||
885 | * @return 0 on success, 1 on error | 889 | * @return 0 on success, 1 on error |
886 | */ | 890 | */ |
887 | int | 891 | int |
888 | GNUNET_TESTING_peer_run (const char *tmppath, | 892 | GNUNET_TESTING_peer_run (const char *testdir, |
889 | const char *cfgfilename, | 893 | const char *cfgfilename, |
890 | GNUNET_TESTING_TestMain tm, | 894 | GNUNET_TESTING_TestMain tm, |
891 | void *tm_cls) | 895 | void *tm_cls) |
892 | { | 896 | { |
893 | return GNUNET_TESTING_service_run (tmppath, "arm", | 897 | return GNUNET_TESTING_service_run (testdir, "arm", |
894 | cfgfilename, tm, tm_cls); | 898 | cfgfilename, tm, tm_cls); |
895 | } | 899 | } |
896 | 900 | ||
@@ -944,8 +948,9 @@ service_run_main (void *cls, | |||
944 | * This function is useful if the testcase is for a single service | 948 | * This function is useful if the testcase is for a single service |
945 | * and if that service doesn't itself depend on other services. | 949 | * and if that service doesn't itself depend on other services. |
946 | * | 950 | * |
947 | * @param tmppath path for storing temporary data for the test, | 951 | * @param testdir only the directory name without any path. This is used for |
948 | * also used to setup the program name for logging | 952 | * all service homes; the directory will be created in a temporary |
953 | * location depending on the underlying OS | ||
949 | * @param service_name name of the service to run | 954 | * @param service_name name of the service to run |
950 | * @param cfgfilename name of the configuration file to use; | 955 | * @param cfgfilename name of the configuration file to use; |
951 | * use NULL to only run with defaults | 956 | * use NULL to only run with defaults |
@@ -954,7 +959,7 @@ service_run_main (void *cls, | |||
954 | * @return 0 on success, 1 on error | 959 | * @return 0 on success, 1 on error |
955 | */ | 960 | */ |
956 | int | 961 | int |
957 | GNUNET_TESTING_service_run (const char *tmppath, | 962 | GNUNET_TESTING_service_run (const char *testdir, |
958 | const char *service_name, | 963 | const char *service_name, |
959 | const char *cfgfilename, | 964 | const char *cfgfilename, |
960 | GNUNET_TESTING_TestMain tm, | 965 | GNUNET_TESTING_TestMain tm, |
@@ -965,10 +970,10 @@ GNUNET_TESTING_service_run (const char *tmppath, | |||
965 | struct GNUNET_TESTING_Peer *peer; | 970 | struct GNUNET_TESTING_Peer *peer; |
966 | struct GNUNET_CONFIGURATION_Handle *cfg; | 971 | struct GNUNET_CONFIGURATION_Handle *cfg; |
967 | 972 | ||
968 | GNUNET_log_setup (tmppath, | 973 | GNUNET_log_setup (testdir, |
969 | "WARNING", | 974 | "WARNING", |
970 | NULL); | 975 | NULL); |
971 | system = GNUNET_TESTING_system_create (tmppath, "127.0.0.1"); | 976 | system = GNUNET_TESTING_system_create (testdir, "127.0.0.1"); |
972 | if (NULL == system) | 977 | if (NULL == system) |
973 | return 1; | 978 | return 1; |
974 | cfg = GNUNET_CONFIGURATION_create (); | 979 | cfg = GNUNET_CONFIGURATION_create (); |