-updated documentation
authorSree Harsha Totakura <totakura@in.tum.de>
Sun, 10 Jun 2012 17:28:57 +0000 (17:28 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Sun, 10 Jun 2012 17:28:57 +0000 (17:28 +0000)
src/include/gnunet_testing_lib-new.h
src/testing/testing.c

index 9bd6c3b25835c6f9e5cbd80872436845bc0f95ee..c3d17c48d4a1d373be48907d7e8a3ae252af78ce 100644 (file)
@@ -62,14 +62,16 @@ struct GNUNET_TESTING_Peer;
  * Create a system handle.  There must only be one system
  * handle per operating system.
  *
- * @param tmppath prefix path to use for all service homes
+ ** @param testdir only the directory name without any path. This is used for
+ *          all service homes; the directory will be created in a temporary
+ *          location depending on the underlying OS
  * @param controller hostname of the controlling host, 
  *        service configurations are modified to allow 
  *        control connections from this host; can be NULL
  * @return handle to this system, NULL on error
  */
 struct GNUNET_TESTING_System *
-GNUNET_TESTING_system_create (const char *tmppath,
+GNUNET_TESTING_system_create (const char *testdir,
                              const char *controller);
 
 
@@ -77,7 +79,7 @@ GNUNET_TESTING_system_create (const char *tmppath,
  * Free system resources.
  *
  * @param system system to be freed
- * @param remove_paths should the 'tmppath' and all subdirectories
+ * @param remove_paths should the 'testdir' and all subdirectories
  *        be removed (clean up on shutdown)?
  */
 void
@@ -223,8 +225,9 @@ typedef void (*GNUNET_TESTING_TestMain)(void *cls,
  * and should thus be called directly from "main".  The testcase
  * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'.
  *
- * @param tmppath path for storing temporary data for the test
- *        also used to setup the program name for logging
+ * @param testdir only the directory name without any path. This is used for
+ *          all service homes; the directory will be created in a temporary
+ *          location depending on the underlying OS
  * @param cfgfilename name of the configuration file to use;
  *         use NULL to only run with defaults
  * @param tm main function of the testcase
@@ -232,7 +235,7 @@ typedef void (*GNUNET_TESTING_TestMain)(void *cls,
  * @return 0 on success, 1 on error
  */
 int
-GNUNET_TESTING_peer_run (const char *tmppath,
+GNUNET_TESTING_peer_run (const char *testdir,
                         const char *cfgfilename,
                         GNUNET_TESTING_TestMain tm,
                         void *tm_cls);
@@ -249,8 +252,9 @@ GNUNET_TESTING_peer_run (const char *tmppath,
  * This function is useful if the testcase is for a single service
  * and if that service doesn't itself depend on other services.
  *
- * @param tmppath path for storing temporary data for the test
- *        also used to setup the program name for logging
+ * @param testdir only the directory name without any path. This is used for
+ *          all service homes; the directory will be created in a temporary
+ *          location depending on the underlying OS
  * @param service_name name of the service to run
  * @param cfgfilename name of the configuration file to use;
  *         use NULL to only run with defaults
@@ -259,7 +263,7 @@ GNUNET_TESTING_peer_run (const char *tmppath,
  * @return 0 on success, 1 on error
  */
 int
-GNUNET_TESTING_service_run (const char *tmppath,
+GNUNET_TESTING_service_run (const char *testdir,
                            const char *service_name,
                            const char *cfgfilename,
                            GNUNET_TESTING_TestMain tm,
index 39d7b717dd525a9f564624270ae1e160f0a7f509..9e18628c1031b42832a3e5dd10186107085b0570 100644 (file)
@@ -237,21 +237,24 @@ hostkeys_unload (struct GNUNET_TESTING_System *system)
  * Create a system handle.  There must only be one system
  * handle per operating system.
  *
- * @param tmppath prefix path to use for all service homes
+ * @param testdir only the directory name without any path. This is used for
+ *          all service homes; the directory will be created in a temporary
+ *          location depending on the underlying OS
+ *
  * @param controller hostname of the controlling host, 
  *        service configurations are modified to allow 
  *        control connections from this host; can be NULL
  * @return handle to this system, NULL on error
  */
 struct GNUNET_TESTING_System *
-GNUNET_TESTING_system_create (const char *tmppath,
+GNUNET_TESTING_system_create (const char *testdir,
                              const char *controller)
 {
   struct GNUNET_TESTING_System *system;
 
-  GNUNET_assert (NULL != tmppath);
+  GNUNET_assert (NULL != testdir);
   system = GNUNET_malloc (sizeof (struct GNUNET_TESTING_System));
-  system->tmppath = GNUNET_DISK_mkdtemp (tmppath);
+  system->tmppath = GNUNET_DISK_mkdtemp (testdir);
   if (NULL == system->tmppath)
   {
     GNUNET_free (system);
@@ -272,7 +275,7 @@ GNUNET_TESTING_system_create (const char *tmppath,
  * Free system resources.
  *
  * @param system system to be freed
- * @param remove_paths should the 'tmppath' and all subdirectories
+ * @param remove_paths should the 'testdir' and all subdirectories
  *        be removed (clean up on shutdown)?
  */
 void
@@ -876,8 +879,9 @@ GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer)
  * and should thus be called directly from "main".  The testcase
  * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'.
  *
- * @param tmppath path for storing temporary data for the test
- *        also used to setup the program name for logging
+ * @param testdir only the directory name without any path. This is used for
+ *          all service homes; the directory will be created in a temporary
+ *          location depending on the underlying OS
  * @param cfgfilename name of the configuration file to use;
  *         use NULL to only run with defaults
  * @param tm main function of the testcase
@@ -885,12 +889,12 @@ GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer)
  * @return 0 on success, 1 on error
  */
 int
-GNUNET_TESTING_peer_run (const char *tmppath,
+GNUNET_TESTING_peer_run (const char *testdir,
                         const char *cfgfilename,
                         GNUNET_TESTING_TestMain tm,
                         void *tm_cls)
 {
-  return GNUNET_TESTING_service_run (tmppath, "arm",
+  return GNUNET_TESTING_service_run (testdir, "arm",
                                     cfgfilename, tm, tm_cls);
 }
 
@@ -944,8 +948,9 @@ service_run_main (void *cls,
  * This function is useful if the testcase is for a single service
  * and if that service doesn't itself depend on other services.
  *
- * @param tmppath path for storing temporary data for the test,
- *        also used to setup the program name for logging
+ * @param testdir only the directory name without any path. This is used for
+ *          all service homes; the directory will be created in a temporary
+ *          location depending on the underlying OS
  * @param service_name name of the service to run
  * @param cfgfilename name of the configuration file to use;
  *         use NULL to only run with defaults
@@ -954,7 +959,7 @@ service_run_main (void *cls,
  * @return 0 on success, 1 on error
  */
 int
-GNUNET_TESTING_service_run (const char *tmppath,
+GNUNET_TESTING_service_run (const char *testdir,
                            const char *service_name,
                            const char *cfgfilename,
                            GNUNET_TESTING_TestMain tm,
@@ -965,10 +970,10 @@ GNUNET_TESTING_service_run (const char *tmppath,
   struct GNUNET_TESTING_Peer *peer;
   struct GNUNET_CONFIGURATION_Handle *cfg;
 
-  GNUNET_log_setup (tmppath,
+  GNUNET_log_setup (testdir,
                     "WARNING",
                     NULL);
-  system = GNUNET_TESTING_system_create (tmppath, "127.0.0.1");
+  system = GNUNET_TESTING_system_create (testdir, "127.0.0.1");
   if (NULL == system)
     return 1;
   cfg = GNUNET_CONFIGURATION_create ();