input checks
authorSree Harsha Totakura <totakura@in.tum.de>
Sun, 2 Sep 2012 11:17:10 +0000 (11:17 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Sun, 2 Sep 2012 11:17:10 +0000 (11:17 +0000)
src/include/gnunet_testbed_service.h
src/testbed/testbed_api_test.c
src/testbed/testbed_api_testbed.c

index b8e0cf3f7ccb4fbc7fe07fae660a9000cb621e21..39b356fa0fc6db4c70b3bcc0bd72eea0faa50dbb 100644 (file)
@@ -1127,7 +1127,8 @@ GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed);
  * @param host_filename name of the file with the 'hosts', NULL
  *        to run everything on 'localhost'
  * @param cfg configuration to use (for testbed, controller and peers)
- * @param num_peers number of peers to start; FIXME: maybe put that ALSO into cfg?
+ * @param num_peers number of peers to start; FIXME: maybe put that ALSO into
+ *        cfg?; should be greater than 0
  * @param event_mask bit mask with set of events to call 'cc' for;
  *                   or-ed values of "1LL" shifted by the
  *                   respective 'enum GNUNET_TESTBED_EventType'
@@ -1182,7 +1183,7 @@ typedef void (*GNUNET_TESTBED_TestMaster)(void *cls,
  * @param testname name of the testcase (to configure logging, etc.)
  * @param cfg_filename configuration filename to use
  *              (for testbed, controller and peers)
- * @param num_peers number of peers to start
+ * @param num_peers number of peers to start; should be greter than 0
  * @param test_master task to run once the test is ready
  * @param test_master_cls closure for 'task'.
  */
index 1d49e706d8e79944a1aa612127bd166c6adb8d4b..c040e1c790496cf883b710b1ade5b0475603822a 100644 (file)
@@ -159,6 +159,7 @@ GNUNET_TESTBED_test_run (const char *testname, const char *cfg_filename,
   argv2[0] = GNUNET_strdup (testname);
   argv2[2] = GNUNET_strdup (cfg_filename);
   GNUNET_assert (NULL != test_master);
+  GNUNET_assert (num_peers > 0);
   rc = GNUNET_malloc (sizeof (struct TestRunContext) +
                       (num_peers * sizeof (struct GNUNET_TESTBED_Peer *)));
   rc->test_master = test_master;
index 6fa5d6dd4d26b976530b607e6cb2233961f4de8b..6e6145aaa3e2bfd370058e48910cef90b62bb027 100644 (file)
@@ -483,11 +483,12 @@ GNUNET_TESTBED_run (const char *host_filename,
 {
   struct RunContext *rc;
 
-  rc = GNUNET_malloc (sizeof (struct RunContext));
   GNUNET_break (NULL == host_filename); /* Currently we do not support host
                                          * files */
   GNUNET_assert (NULL != cc);
+  GNUNET_assert (num_peers > 0);
   host_filename = NULL;
+  rc = GNUNET_malloc (sizeof (struct RunContext));
   rc->h = GNUNET_TESTBED_host_create (NULL, NULL, 0);
   GNUNET_assert (NULL != rc->h);
   rc->cproc =