aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/testbed_api_test.c')
-rw-r--r--src/testbed/testbed_api_test.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/testbed/testbed_api_test.c b/src/testbed/testbed_api_test.c
index 3f9400bda..7294a137e 100644
--- a/src/testbed/testbed_api_test.c
+++ b/src/testbed/testbed_api_test.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -31,8 +31,7 @@
31/** 31/**
32 * Context information for test run 32 * Context information for test run
33 */ 33 */
34struct TestRunContext 34struct TestRunContext {
35{
36 /** 35 /**
37 * Test master callback 36 * Test master callback
38 */ 37 */
@@ -74,13 +73,13 @@ struct TestRunContext
74 * @param config the configuration file handle 73 * @param config the configuration file handle
75 */ 74 */
76static void 75static void
77run (void *cls, char *const *args, const char *cfgfile, 76run(void *cls, char *const *args, const char *cfgfile,
78 const struct GNUNET_CONFIGURATION_Handle *config) 77 const struct GNUNET_CONFIGURATION_Handle *config)
79{ 78{
80 struct TestRunContext *rc = cls; 79 struct TestRunContext *rc = cls;
81 80
82 GNUNET_TESTBED_run (NULL, config, rc->num_peers, rc->event_mask, rc->cc, 81 GNUNET_TESTBED_run(NULL, config, rc->num_peers, rc->event_mask, rc->cc,
83 rc->cc_cls, rc->test_master, rc->test_master_cls); 82 rc->cc_cls, rc->test_master, rc->test_master_cls);
84} 83}
85 84
86 85
@@ -118,14 +117,14 @@ run (void *cls, char *const *args, const char *cfgfile,
118 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 117 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
119 */ 118 */
120int 119int
121GNUNET_TESTBED_test_run (const char *testname, 120GNUNET_TESTBED_test_run(const char *testname,
122 const char *cfg_filename, 121 const char *cfg_filename,
123 unsigned int num_peers, 122 unsigned int num_peers,
124 uint64_t event_mask, 123 uint64_t event_mask,
125 GNUNET_TESTBED_ControllerCallback cc, 124 GNUNET_TESTBED_ControllerCallback cc,
126 void *cc_cls, 125 void *cc_cls,
127 GNUNET_TESTBED_TestMaster test_master, 126 GNUNET_TESTBED_TestMaster test_master,
128 void *test_master_cls) 127 void *test_master_cls)
129{ 128{
130 char *argv2[] = { 129 char *argv2[] = {
131 NULL, 130 NULL,
@@ -139,23 +138,23 @@ GNUNET_TESTBED_test_run (const char *testname,
139 struct TestRunContext *rc; 138 struct TestRunContext *rc;
140 int ret; 139 int ret;
141 140
142 argv2[0] = GNUNET_strdup (testname); 141 argv2[0] = GNUNET_strdup(testname);
143 argv2[2] = GNUNET_strdup (cfg_filename); 142 argv2[2] = GNUNET_strdup(cfg_filename);
144 GNUNET_assert (NULL != test_master); 143 GNUNET_assert(NULL != test_master);
145 GNUNET_assert (num_peers > 0); 144 GNUNET_assert(num_peers > 0);
146 rc = GNUNET_malloc (sizeof (struct TestRunContext) + 145 rc = GNUNET_malloc(sizeof(struct TestRunContext) +
147 (num_peers * sizeof (struct GNUNET_TESTBED_Peer *))); 146 (num_peers * sizeof(struct GNUNET_TESTBED_Peer *)));
148 rc->test_master = test_master; 147 rc->test_master = test_master;
149 rc->test_master_cls = test_master_cls; 148 rc->test_master_cls = test_master_cls;
150 rc->num_peers = num_peers; 149 rc->num_peers = num_peers;
151 rc->event_mask = event_mask; 150 rc->event_mask = event_mask;
152 rc->cc = cc; 151 rc->cc = cc;
153 rc->cc_cls = cc_cls; 152 rc->cc_cls = cc_cls;
154 ret = GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, 153 ret = GNUNET_PROGRAM_run((sizeof(argv2) / sizeof(char *)) - 1, argv2,
155 testname, "nohelp", options, &run, rc); 154 testname, "nohelp", options, &run, rc);
156 GNUNET_free (rc); 155 GNUNET_free(rc);
157 GNUNET_free (argv2[0]); 156 GNUNET_free(argv2[0]);
158 GNUNET_free (argv2[2]); 157 GNUNET_free(argv2[2]);
159 return ret; 158 return ret;
160} 159}
161 160