diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-09-06 14:38:24 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-09-06 14:38:24 +0000 |
commit | 2ca4b8a208f6f910c819bbaa6785a25ae2955501 (patch) | |
tree | 7328fb7cfc62189197dfa34035502a80b0acdcd3 /src/testbed | |
parent | 8d46a214ce11653b5160d32e330786fa487e3ae6 (diff) | |
download | gnunet-2ca4b8a208f6f910c819bbaa6785a25ae2955501.tar.gz gnunet-2ca4b8a208f6f910c819bbaa6785a25ae2955501.zip |
- give out run handle through which master controller's handle can be retrieved
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/gnunet-service-test-barriers.c | 4 | ||||
-rw-r--r-- | src/testbed/gnunet-testbed-profiler.c | 5 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_barriers.c | 68 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_peer_reconfiguration.c | 5 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_peers_manage_services.c | 5 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_statistics.c | 5 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_test.c | 5 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_test_timeout.c | 5 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_testbed_run.c | 5 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_topology.c | 11 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_topology_clique.c | 11 | ||||
-rw-r--r-- | src/testbed/testbed_api_testbed.c | 62 |
12 files changed, 144 insertions, 47 deletions
diff --git a/src/testbed/gnunet-service-test-barriers.c b/src/testbed/gnunet-service-test-barriers.c index 6c43ad4b3..84c6bde68 100644 --- a/src/testbed/gnunet-service-test-barriers.c +++ b/src/testbed/gnunet-service-test-barriers.c | |||
@@ -20,8 +20,8 @@ | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file testbed/gnunet-service-test-barriers.c | 22 | * @file testbed/gnunet-service-test-barriers.c |
23 | * @brief Service for testing testbed barriers. This service is started as a | 23 | * @brief Daemon acting as a service for testing testbed barriers. It is |
24 | * peer service and waits for a barrier to be crossed. | 24 | * started as a peer service and waits for a barrier to be crossed. |
25 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> | 25 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> |
26 | */ | 26 | */ |
27 | 27 | ||
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index bd3fe8afd..0b36fed9f 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c | |||
@@ -209,6 +209,7 @@ controller_event_cb (void *cls, | |||
209 | * Signature of a main function for a testcase. | 209 | * Signature of a main function for a testcase. |
210 | * | 210 | * |
211 | * @param cls closure | 211 | * @param cls closure |
212 | * @param h the run handle | ||
212 | * @param num_peers number of peers in 'peers' | 213 | * @param num_peers number of peers in 'peers' |
213 | * @param peers handle to peers run in the testbed | 214 | * @param peers handle to peers run in the testbed |
214 | * @param links_succeeded the number of overlay link connection attempts that | 215 | * @param links_succeeded the number of overlay link connection attempts that |
@@ -216,7 +217,9 @@ controller_event_cb (void *cls, | |||
216 | * @param links_failed the number of overlay link | 217 | * @param links_failed the number of overlay link |
217 | */ | 218 | */ |
218 | static void | 219 | static void |
219 | test_run (void *cls, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, | 220 | test_run (void *cls, |
221 | struct GNUNET_TESTBED_RunHandle *h, | ||
222 | unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, | ||
220 | unsigned int links_succeeded, | 223 | unsigned int links_succeeded, |
221 | unsigned int links_failed) | 224 | unsigned int links_failed) |
222 | { | 225 | { |
diff --git a/src/testbed/test_testbed_api_barriers.c b/src/testbed/test_testbed_api_barriers.c index 1e6a8012d..b40fbc87a 100644 --- a/src/testbed/test_testbed_api_barriers.c +++ b/src/testbed/test_testbed_api_barriers.c | |||
@@ -24,8 +24,74 @@ | |||
24 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> | 24 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "platform.h" | ||
28 | #include "gnunet_util_lib.h" | ||
29 | #include "gnunet_testbed_service.h" | ||
27 | 30 | ||
28 | int main () | 31 | /** |
32 | * Number of peers we start in this test case | ||
33 | */ | ||
34 | #define NUM_PEERS 3 | ||
35 | |||
36 | /** | ||
37 | * Result of this test case | ||
38 | */ | ||
39 | static int result; | ||
40 | |||
41 | |||
42 | /** | ||
43 | * Signature of a main function for a testcase. | ||
44 | * | ||
45 | * @param cls closure | ||
46 | * @param h the run handle | ||
47 | * @param num_peers number of peers in 'peers' | ||
48 | * @param peers_ handle to peers run in the testbed | ||
49 | * @param links_succeeded the number of overlay link connection attempts that | ||
50 | * succeeded | ||
51 | * @param links_failed the number of overlay link connection attempts that | ||
52 | * failed | ||
53 | */ | ||
54 | static void | ||
55 | test_master (void *cls, | ||
56 | struct GNUNET_TESTBED_RunHandle *h, | ||
57 | unsigned int num_peers, | ||
58 | struct GNUNET_TESTBED_Peer **peers_, | ||
59 | unsigned int links_succeeded, | ||
60 | unsigned int links_failed) | ||
29 | { | 61 | { |
62 | |||
63 | GNUNET_assert (NULL == cls); | ||
64 | if (NULL == peers_) | ||
65 | { | ||
66 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failing test due to timeout\n"); | ||
67 | return; | ||
68 | } | ||
69 | GNUNET_assert (NUM_PEERS == num_peers); | ||
70 | |||
71 | result = GNUNET_OK; | ||
72 | GNUNET_SCHEDULER_shutdown (); | ||
73 | /* shutdown_task = */ | ||
74 | /* GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply */ | ||
75 | /* (GNUNET_TIME_UNIT_SECONDS, 300), */ | ||
76 | /* do_shutdown, NULL); */ | ||
77 | } | ||
78 | |||
79 | |||
80 | /** | ||
81 | * Main function | ||
82 | */ | ||
83 | int | ||
84 | main (int argc, char **argv) | ||
85 | { | ||
86 | uint64_t event_mask; | ||
87 | |||
88 | result = GNUNET_SYSERR; | ||
89 | event_mask = 0; | ||
90 | (void) GNUNET_TESTBED_test_run ("test_testbed_api_test", | ||
91 | "test_testbed_api_barriers.conf", NUM_PEERS, | ||
92 | event_mask, NULL, NULL, | ||
93 | &test_master, NULL); | ||
94 | if (GNUNET_OK != result) | ||
95 | return 1; | ||
30 | return 0; | 96 | return 0; |
31 | } | 97 | } |
diff --git a/src/testbed/test_testbed_api_peer_reconfiguration.c b/src/testbed/test_testbed_api_peer_reconfiguration.c index e2aa2c140..7f7bf6473 100644 --- a/src/testbed/test_testbed_api_peer_reconfiguration.c +++ b/src/testbed/test_testbed_api_peer_reconfiguration.c | |||
@@ -143,6 +143,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | |||
143 | * Signature of a main function for a testcase. | 143 | * Signature of a main function for a testcase. |
144 | * | 144 | * |
145 | * @param cls closure | 145 | * @param cls closure |
146 | * @param h the run handle | ||
146 | * @param num_peers number of peers in 'peers' | 147 | * @param num_peers number of peers in 'peers' |
147 | * @param peers_ handle to peers run in the testbed | 148 | * @param peers_ handle to peers run in the testbed |
148 | * @param links_succeeded the number of overlay link connection attempts that | 149 | * @param links_succeeded the number of overlay link connection attempts that |
@@ -151,7 +152,9 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | |||
151 | * failed | 152 | * failed |
152 | */ | 153 | */ |
153 | static void | 154 | static void |
154 | test_master (void *cls, unsigned int num_peers, | 155 | test_master (void *cls, |
156 | struct GNUNET_TESTBED_RunHandle *h, | ||
157 | unsigned int num_peers, | ||
155 | struct GNUNET_TESTBED_Peer **peers_, | 158 | struct GNUNET_TESTBED_Peer **peers_, |
156 | unsigned int links_succeeded, | 159 | unsigned int links_succeeded, |
157 | unsigned int links_failed) | 160 | unsigned int links_failed) |
diff --git a/src/testbed/test_testbed_api_peers_manage_services.c b/src/testbed/test_testbed_api_peers_manage_services.c index 12af939fb..29eed3d12 100644 --- a/src/testbed/test_testbed_api_peers_manage_services.c +++ b/src/testbed/test_testbed_api_peers_manage_services.c | |||
@@ -164,6 +164,7 @@ op_comp_cb (void *cls, | |||
164 | * Signature of a main function for a testcase. | 164 | * Signature of a main function for a testcase. |
165 | * | 165 | * |
166 | * @param cls closure | 166 | * @param cls closure |
167 | * @param h the run handle | ||
167 | * @param num_peers number of peers in 'peers' | 168 | * @param num_peers number of peers in 'peers' |
168 | * @param peers_ handle to peers run in the testbed | 169 | * @param peers_ handle to peers run in the testbed |
169 | * @param links_succeeded the number of overlay link connection attempts that | 170 | * @param links_succeeded the number of overlay link connection attempts that |
@@ -172,7 +173,9 @@ op_comp_cb (void *cls, | |||
172 | * failed | 173 | * failed |
173 | */ | 174 | */ |
174 | static void | 175 | static void |
175 | test_master (void *cls, unsigned int num_peers, | 176 | test_master (void *cls, |
177 | struct GNUNET_TESTBED_RunHandle *h, | ||
178 | unsigned int num_peers, | ||
176 | struct GNUNET_TESTBED_Peer **peers_, | 179 | struct GNUNET_TESTBED_Peer **peers_, |
177 | unsigned int links_succeeded, | 180 | unsigned int links_succeeded, |
178 | unsigned int links_failed) | 181 | unsigned int links_failed) |
diff --git a/src/testbed/test_testbed_api_statistics.c b/src/testbed/test_testbed_api_statistics.c index 463dc736e..e0f48fcb5 100644 --- a/src/testbed/test_testbed_api_statistics.c +++ b/src/testbed/test_testbed_api_statistics.c | |||
@@ -159,6 +159,7 @@ op_comp_cb (void *cls, | |||
159 | * Signature of a main function for a testcase. | 159 | * Signature of a main function for a testcase. |
160 | * | 160 | * |
161 | * @param cls closure | 161 | * @param cls closure |
162 | * @param h the run handle | ||
162 | * @param num_peers number of peers in 'peers' | 163 | * @param num_peers number of peers in 'peers' |
163 | * @param peers_ handle to peers run in the testbed | 164 | * @param peers_ handle to peers run in the testbed |
164 | * @param links_succeeded the number of overlay link connection attempts that | 165 | * @param links_succeeded the number of overlay link connection attempts that |
@@ -167,7 +168,9 @@ op_comp_cb (void *cls, | |||
167 | * failed | 168 | * failed |
168 | */ | 169 | */ |
169 | static void | 170 | static void |
170 | test_master (void *cls, unsigned int num_peers, | 171 | test_master (void *cls, |
172 | struct GNUNET_TESTBED_RunHandle *h, | ||
173 | unsigned int num_peers, | ||
171 | struct GNUNET_TESTBED_Peer **peers_, | 174 | struct GNUNET_TESTBED_Peer **peers_, |
172 | unsigned int links_succeeded, | 175 | unsigned int links_succeeded, |
173 | unsigned int links_failed) | 176 | unsigned int links_failed) |
diff --git a/src/testbed/test_testbed_api_test.c b/src/testbed/test_testbed_api_test.c index 8eb2ba7f1..bd5ee28c4 100644 --- a/src/testbed/test_testbed_api_test.c +++ b/src/testbed/test_testbed_api_test.c | |||
@@ -193,6 +193,7 @@ controller_event_cb (void *cls, | |||
193 | * Signature of a main function for a testcase. | 193 | * Signature of a main function for a testcase. |
194 | * | 194 | * |
195 | * @param cls closure | 195 | * @param cls closure |
196 | * @param h the run handle | ||
196 | * @param num_peers number of peers in 'peers' | 197 | * @param num_peers number of peers in 'peers' |
197 | * @param peers- handle to peers run in the testbed | 198 | * @param peers- handle to peers run in the testbed |
198 | * @param links_succeeded the number of overlay link connection attempts that | 199 | * @param links_succeeded the number of overlay link connection attempts that |
@@ -201,7 +202,9 @@ controller_event_cb (void *cls, | |||
201 | * failed | 202 | * failed |
202 | */ | 203 | */ |
203 | static void | 204 | static void |
204 | test_master (void *cls, unsigned int num_peers, | 205 | test_master (void *cls, |
206 | struct GNUNET_TESTBED_RunHandle *h, | ||
207 | unsigned int num_peers, | ||
205 | struct GNUNET_TESTBED_Peer **peers_, | 208 | struct GNUNET_TESTBED_Peer **peers_, |
206 | unsigned int links_succeeded, | 209 | unsigned int links_succeeded, |
207 | unsigned int links_failed) | 210 | unsigned int links_failed) |
diff --git a/src/testbed/test_testbed_api_test_timeout.c b/src/testbed/test_testbed_api_test_timeout.c index 95bc30d38..ddc4dee0b 100644 --- a/src/testbed/test_testbed_api_test_timeout.c +++ b/src/testbed/test_testbed_api_test_timeout.c | |||
@@ -78,6 +78,7 @@ controller_event_cb (void *cls, | |||
78 | * Signature of a main function for a testcase. | 78 | * Signature of a main function for a testcase. |
79 | * | 79 | * |
80 | * @param cls closure | 80 | * @param cls closure |
81 | * @param h the run handle | ||
81 | * @param num_peers number of peers in 'peers' | 82 | * @param num_peers number of peers in 'peers' |
82 | * @param peers- handle to peers run in the testbed | 83 | * @param peers- handle to peers run in the testbed |
83 | * @param links_succeeded the number of overlay link connection attempts that | 84 | * @param links_succeeded the number of overlay link connection attempts that |
@@ -86,7 +87,9 @@ controller_event_cb (void *cls, | |||
86 | * failed | 87 | * failed |
87 | */ | 88 | */ |
88 | static void | 89 | static void |
89 | test_master (void *cls, unsigned int num_peers, | 90 | test_master (void *cls, |
91 | struct GNUNET_TESTBED_RunHandle *h, | ||
92 | unsigned int num_peers, | ||
90 | struct GNUNET_TESTBED_Peer **peers_, | 93 | struct GNUNET_TESTBED_Peer **peers_, |
91 | unsigned int links_succeeded, | 94 | unsigned int links_succeeded, |
92 | unsigned int links_failed) | 95 | unsigned int links_failed) |
diff --git a/src/testbed/test_testbed_api_testbed_run.c b/src/testbed/test_testbed_api_testbed_run.c index b22905757..b7cff2ec7 100644 --- a/src/testbed/test_testbed_api_testbed_run.c +++ b/src/testbed/test_testbed_api_testbed_run.c | |||
@@ -98,6 +98,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
98 | * Signature of a main function for a testcase. | 98 | * Signature of a main function for a testcase. |
99 | * | 99 | * |
100 | * @param cls closure | 100 | * @param cls closure |
101 | * @param h the run handle | ||
101 | * @param num_peers number of peers in 'peers' | 102 | * @param num_peers number of peers in 'peers' |
102 | * @param peers_ handle to peers run in the testbed | 103 | * @param peers_ handle to peers run in the testbed |
103 | * @param links_succeeded the number of overlay link connection attempts that | 104 | * @param links_succeeded the number of overlay link connection attempts that |
@@ -106,7 +107,9 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
106 | * failed | 107 | * failed |
107 | */ | 108 | */ |
108 | static void | 109 | static void |
109 | test_master (void *cls, unsigned int num_peers, | 110 | test_master (void *cls, |
111 | struct GNUNET_TESTBED_RunHandle *h, | ||
112 | unsigned int num_peers, | ||
110 | struct GNUNET_TESTBED_Peer **peers_, | 113 | struct GNUNET_TESTBED_Peer **peers_, |
111 | unsigned int links_succeeded, | 114 | unsigned int links_succeeded, |
112 | unsigned int links_failed) | 115 | unsigned int links_failed) |
diff --git a/src/testbed/test_testbed_api_topology.c b/src/testbed/test_testbed_api_topology.c index e8f1c55be..a435ce0f7 100644 --- a/src/testbed/test_testbed_api_topology.c +++ b/src/testbed/test_testbed_api_topology.c | |||
@@ -119,6 +119,7 @@ controller_event_cb (void *cls, | |||
119 | * Signature of a main function for a testcase. | 119 | * Signature of a main function for a testcase. |
120 | * | 120 | * |
121 | * @param cls closure | 121 | * @param cls closure |
122 | * @param h the run handle | ||
122 | * @param num_peers number of peers in 'peers' | 123 | * @param num_peers number of peers in 'peers' |
123 | * @param peers_ handle to peers run in the testbed | 124 | * @param peers_ handle to peers run in the testbed |
124 | * @param links_succeeded the number of overlay link connection attempts that | 125 | * @param links_succeeded the number of overlay link connection attempts that |
@@ -127,7 +128,9 @@ controller_event_cb (void *cls, | |||
127 | * failed | 128 | * failed |
128 | */ | 129 | */ |
129 | static void | 130 | static void |
130 | test_master (void *cls, unsigned int num_peers, | 131 | test_master (void *cls, |
132 | struct GNUNET_TESTBED_RunHandle *h, | ||
133 | unsigned int num_peers, | ||
131 | struct GNUNET_TESTBED_Peer **peers_, | 134 | struct GNUNET_TESTBED_Peer **peers_, |
132 | unsigned int links_succeeded, | 135 | unsigned int links_succeeded, |
133 | unsigned int links_failed) | 136 | unsigned int links_failed) |
@@ -135,8 +138,12 @@ test_master (void *cls, unsigned int num_peers, | |||
135 | unsigned int peer; | 138 | unsigned int peer; |
136 | 139 | ||
137 | GNUNET_assert (NULL == cls); | 140 | GNUNET_assert (NULL == cls); |
141 | if (NULL == peers_) | ||
142 | { | ||
143 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failing test due to timeout\n"); | ||
144 | return; | ||
145 | } | ||
138 | GNUNET_assert (NUM_PEERS == num_peers); | 146 | GNUNET_assert (NUM_PEERS == num_peers); |
139 | GNUNET_assert (NULL != peers_); | ||
140 | for (peer = 0; peer < num_peers; peer++) | 147 | for (peer = 0; peer < num_peers; peer++) |
141 | GNUNET_assert (NULL != peers_[peer]); | 148 | GNUNET_assert (NULL != peers_[peer]); |
142 | peers = peers_; | 149 | peers = peers_; |
diff --git a/src/testbed/test_testbed_api_topology_clique.c b/src/testbed/test_testbed_api_topology_clique.c index 30cce6c0d..9270f8f78 100644 --- a/src/testbed/test_testbed_api_topology_clique.c +++ b/src/testbed/test_testbed_api_topology_clique.c | |||
@@ -114,6 +114,7 @@ controller_event_cb (void *cls, | |||
114 | * Signature of a main function for a testcase. | 114 | * Signature of a main function for a testcase. |
115 | * | 115 | * |
116 | * @param cls closure | 116 | * @param cls closure |
117 | * @param h the run handle | ||
117 | * @param num_peers number of peers in 'peers' | 118 | * @param num_peers number of peers in 'peers' |
118 | * @param peers_ handle to peers run in the testbed | 119 | * @param peers_ handle to peers run in the testbed |
119 | * @param links_succeeded the number of overlay link connection attempts that | 120 | * @param links_succeeded the number of overlay link connection attempts that |
@@ -122,7 +123,9 @@ controller_event_cb (void *cls, | |||
122 | * failed | 123 | * failed |
123 | */ | 124 | */ |
124 | static void | 125 | static void |
125 | test_master (void *cls, unsigned int num_peers, | 126 | test_master (void *cls, |
127 | struct GNUNET_TESTBED_RunHandle *h, | ||
128 | unsigned int num_peers, | ||
126 | struct GNUNET_TESTBED_Peer **peers_, | 129 | struct GNUNET_TESTBED_Peer **peers_, |
127 | unsigned int links_succeeded, | 130 | unsigned int links_succeeded, |
128 | unsigned int links_failed) | 131 | unsigned int links_failed) |
@@ -130,8 +133,12 @@ test_master (void *cls, unsigned int num_peers, | |||
130 | unsigned int peer; | 133 | unsigned int peer; |
131 | 134 | ||
132 | GNUNET_assert (NULL == cls); | 135 | GNUNET_assert (NULL == cls); |
136 | if (NULL == peers_) | ||
137 | { | ||
138 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failing test due to timeout\n"); | ||
139 | return; | ||
140 | } | ||
133 | GNUNET_assert (NUM_PEERS == num_peers); | 141 | GNUNET_assert (NUM_PEERS == num_peers); |
134 | GNUNET_assert (NULL != peers_); | ||
135 | for (peer = 0; peer < num_peers; peer++) | 142 | for (peer = 0; peer < num_peers; peer++) |
136 | GNUNET_assert (NULL != peers_[peer]); | 143 | GNUNET_assert (NULL != peers_[peer]); |
137 | peers = peers_; | 144 | peers = peers_; |
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index 3da5f9058..b00e2825c 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c | |||
@@ -50,10 +50,6 @@ | |||
50 | */ | 50 | */ |
51 | #define DEFAULT_SETUP_TIMEOUT 300 | 51 | #define DEFAULT_SETUP_TIMEOUT 300 |
52 | 52 | ||
53 | /** | ||
54 | * Testbed Run Handle | ||
55 | */ | ||
56 | struct RunContext; | ||
57 | 53 | ||
58 | /** | 54 | /** |
59 | * Context information for the operation we start | 55 | * Context information for the operation we start |
@@ -68,7 +64,7 @@ struct RunContextOperation | |||
68 | /** | 64 | /** |
69 | * Context information for GNUNET_TESTBED_run() | 65 | * Context information for GNUNET_TESTBED_run() |
70 | */ | 66 | */ |
71 | struct RunContext *rc; | 67 | struct GNUNET_TESTBED_RunHandle *rc; |
72 | 68 | ||
73 | /** | 69 | /** |
74 | * Closure | 70 | * Closure |
@@ -130,7 +126,7 @@ struct CompatibilityCheckContext | |||
130 | /** | 126 | /** |
131 | * The run context | 127 | * The run context |
132 | */ | 128 | */ |
133 | struct RunContext *rc; | 129 | struct GNUNET_TESTBED_RunHandle *rc; |
134 | 130 | ||
135 | /** | 131 | /** |
136 | * Handle for the compability check | 132 | * Handle for the compability check |
@@ -147,7 +143,7 @@ struct CompatibilityCheckContext | |||
147 | /** | 143 | /** |
148 | * Testbed Run Handle | 144 | * Testbed Run Handle |
149 | */ | 145 | */ |
150 | struct RunContext | 146 | struct GNUNET_TESTBED_RunHandle |
151 | { | 147 | { |
152 | /** | 148 | /** |
153 | * The controller handle | 149 | * The controller handle |
@@ -381,7 +377,7 @@ search_iterator (void *cls, uint32_t key, void *value) | |||
381 | * @return the matching RunContextOperation if found; NULL if not | 377 | * @return the matching RunContextOperation if found; NULL if not |
382 | */ | 378 | */ |
383 | static struct RunContextOperation * | 379 | static struct RunContextOperation * |
384 | search_rcop (struct RunContext *rc, struct GNUNET_TESTBED_Operation *op) | 380 | search_rcop (struct GNUNET_TESTBED_RunHandle *rc, struct GNUNET_TESTBED_Operation *op) |
385 | { | 381 | { |
386 | struct SearchContext sc; | 382 | struct SearchContext sc; |
387 | 383 | ||
@@ -407,7 +403,7 @@ search_rcop (struct RunContext *rc, struct GNUNET_TESTBED_Operation *op) | |||
407 | * @param rcop the RunContextOperation to insert | 403 | * @param rcop the RunContextOperation to insert |
408 | */ | 404 | */ |
409 | static void | 405 | static void |
410 | insert_rcop (struct RunContext *rc, struct RunContextOperation *rcop) | 406 | insert_rcop (struct GNUNET_TESTBED_RunHandle *rc, struct RunContextOperation *rcop) |
411 | { | 407 | { |
412 | GNUNET_assert (GNUNET_OK == | 408 | GNUNET_assert (GNUNET_OK == |
413 | GNUNET_CONTAINER_multihashmap32_put (rc->rcop_map, | 409 | GNUNET_CONTAINER_multihashmap32_put (rc->rcop_map, |
@@ -424,7 +420,7 @@ insert_rcop (struct RunContext *rc, struct RunContextOperation *rcop) | |||
424 | * @param rcop the RunContextOperation | 420 | * @param rcop the RunContextOperation |
425 | */ | 421 | */ |
426 | static void | 422 | static void |
427 | remove_rcop (struct RunContext *rc, struct RunContextOperation *rcop) | 423 | remove_rcop (struct GNUNET_TESTBED_RunHandle *rc, struct RunContextOperation *rcop) |
428 | { | 424 | { |
429 | GNUNET_assert (GNUNET_YES == | 425 | GNUNET_assert (GNUNET_YES == |
430 | GNUNET_CONTAINER_multihashmap32_remove (rc->rcop_map, | 426 | GNUNET_CONTAINER_multihashmap32_remove (rc->rcop_map, |
@@ -440,7 +436,7 @@ remove_rcop (struct RunContext *rc, struct RunContextOperation *rcop) | |||
440 | static void | 436 | static void |
441 | cleanup (void *cls) | 437 | cleanup (void *cls) |
442 | { | 438 | { |
443 | struct RunContext *rc = cls; | 439 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
444 | unsigned int hid; | 440 | unsigned int hid; |
445 | 441 | ||
446 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rc->register_hosts_task); | 442 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rc->register_hosts_task); |
@@ -478,7 +474,7 @@ cleanup (void *cls) | |||
478 | static int | 474 | static int |
479 | rcop_cleanup_iterator (void *cls, uint32_t key, void *value) | 475 | rcop_cleanup_iterator (void *cls, uint32_t key, void *value) |
480 | { | 476 | { |
481 | struct RunContext *rc = cls; | 477 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
482 | struct RunContextOperation *rcop = value; | 478 | struct RunContextOperation *rcop = value; |
483 | 479 | ||
484 | GNUNET_assert (rc == rcop->rc); | 480 | GNUNET_assert (rc == rcop->rc); |
@@ -495,7 +491,7 @@ rcop_cleanup_iterator (void *cls, uint32_t key, void *value) | |||
495 | * @param rc the RunContext | 491 | * @param rc the RunContext |
496 | */ | 492 | */ |
497 | static void | 493 | static void |
498 | rc_cleanup_operations (struct RunContext *rc) | 494 | rc_cleanup_operations (struct GNUNET_TESTBED_RunHandle *rc) |
499 | { | 495 | { |
500 | struct CompatibilityCheckContext *hc; | 496 | struct CompatibilityCheckContext *hc; |
501 | unsigned int nhost; | 497 | unsigned int nhost; |
@@ -546,7 +542,7 @@ rc_cleanup_operations (struct RunContext *rc) | |||
546 | * @param rc the run context | 542 | * @param rc the run context |
547 | */ | 543 | */ |
548 | static void | 544 | static void |
549 | cancel_interrupt_task (struct RunContext *rc) | 545 | cancel_interrupt_task (struct GNUNET_TESTBED_RunHandle *rc) |
550 | { | 546 | { |
551 | GNUNET_SCHEDULER_cancel (rc->interrupt_task); | 547 | GNUNET_SCHEDULER_cancel (rc->interrupt_task); |
552 | rc->interrupt_task = GNUNET_SCHEDULER_NO_TASK; | 548 | rc->interrupt_task = GNUNET_SCHEDULER_NO_TASK; |
@@ -562,7 +558,7 @@ cancel_interrupt_task (struct RunContext *rc) | |||
562 | static void | 558 | static void |
563 | wait_op_completion (void *cls) | 559 | wait_op_completion (void *cls) |
564 | { | 560 | { |
565 | struct RunContext *rc = cls; | 561 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
566 | struct RunContextOperation *rcop; | 562 | struct RunContextOperation *rcop; |
567 | 563 | ||
568 | if ( (NULL == rc->cproc) | 564 | if ( (NULL == rc->cproc) |
@@ -604,7 +600,7 @@ wait_op_completion (void *cls) | |||
604 | static void | 600 | static void |
605 | interrupt (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 601 | interrupt (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
606 | { | 602 | { |
607 | struct RunContext *rc = cls; | 603 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
608 | struct GNUNET_TESTBED_Controller *c = rc->c; | 604 | struct GNUNET_TESTBED_Controller *c = rc->c; |
609 | unsigned int size; | 605 | unsigned int size; |
610 | 606 | ||
@@ -634,7 +630,7 @@ interrupt (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
634 | * @return the representation string; this is NOT reentrant | 630 | * @return the representation string; this is NOT reentrant |
635 | */ | 631 | */ |
636 | static const char * | 632 | static const char * |
637 | prof_time (struct RunContext *rc) | 633 | prof_time (struct GNUNET_TESTBED_RunHandle *rc) |
638 | { | 634 | { |
639 | struct GNUNET_TIME_Relative ptime; | 635 | struct GNUNET_TIME_Relative ptime; |
640 | 636 | ||
@@ -652,7 +648,7 @@ prof_time (struct RunContext *rc) | |||
652 | static void | 648 | static void |
653 | start_peers_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 649 | start_peers_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
654 | { | 650 | { |
655 | struct RunContext *rc = cls; | 651 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
656 | struct RunContextOperation *rcop; | 652 | struct RunContextOperation *rcop; |
657 | unsigned int peer; | 653 | unsigned int peer; |
658 | 654 | ||
@@ -684,7 +680,7 @@ static void | |||
684 | peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | 680 | peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) |
685 | { | 681 | { |
686 | struct RunContextOperation *rcop = cls; | 682 | struct RunContextOperation *rcop = cls; |
687 | struct RunContext *rc; | 683 | struct GNUNET_TESTBED_RunHandle *rc; |
688 | 684 | ||
689 | GNUNET_assert (NULL != rcop); | 685 | GNUNET_assert (NULL != rcop); |
690 | GNUNET_assert (NULL != (rc = rcop->rc)); | 686 | GNUNET_assert (NULL != (rc = rcop->rc)); |
@@ -715,12 +711,12 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
715 | * @param rc the RunContext | 711 | * @param rc the RunContext |
716 | */ | 712 | */ |
717 | static void | 713 | static void |
718 | call_master (struct RunContext *rc) | 714 | call_master (struct GNUNET_TESTBED_RunHandle *rc) |
719 | { | 715 | { |
720 | GNUNET_SCHEDULER_cancel (rc->timeout_task); | 716 | GNUNET_SCHEDULER_cancel (rc->timeout_task); |
721 | rc->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 717 | rc->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
722 | if (NULL != rc->test_master) | 718 | if (NULL != rc->test_master) |
723 | rc->test_master (rc->test_master_cls, rc->num_peers, rc->peers, | 719 | rc->test_master (rc->test_master_cls, rc, rc->num_peers, rc->peers, |
724 | rc->links_succeeded, rc->links_failed); | 720 | rc->links_succeeded, rc->links_failed); |
725 | } | 721 | } |
726 | 722 | ||
@@ -738,7 +734,7 @@ static void | |||
738 | topology_completion_callback (void *cls, unsigned int nsuccess, | 734 | topology_completion_callback (void *cls, unsigned int nsuccess, |
739 | unsigned int nfailures) | 735 | unsigned int nfailures) |
740 | { | 736 | { |
741 | struct RunContext *rc = cls; | 737 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
742 | 738 | ||
743 | DEBUG ("Overlay topology generated in %s\n", prof_time (rc)); | 739 | DEBUG ("Overlay topology generated in %s\n", prof_time (rc)); |
744 | GNUNET_TESTBED_operation_done (rc->topology_operation); | 740 | GNUNET_TESTBED_operation_done (rc->topology_operation); |
@@ -756,7 +752,7 @@ topology_completion_callback (void *cls, unsigned int nsuccess, | |||
756 | * @param rc the RunContext | 752 | * @param rc the RunContext |
757 | */ | 753 | */ |
758 | static void | 754 | static void |
759 | create_peers (struct RunContext *rc) | 755 | create_peers (struct GNUNET_TESTBED_RunHandle *rc) |
760 | { | 756 | { |
761 | struct RunContextOperation *rcop; | 757 | struct RunContextOperation *rcop; |
762 | unsigned int peer; | 758 | unsigned int peer; |
@@ -793,7 +789,7 @@ create_peers (struct RunContext *rc) | |||
793 | static void | 789 | static void |
794 | event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | 790 | event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) |
795 | { | 791 | { |
796 | struct RunContext *rc = cls; | 792 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
797 | struct RunContextOperation *rcop; | 793 | struct RunContextOperation *rcop; |
798 | 794 | ||
799 | if (RC_INIT == rc->state) | 795 | if (RC_INIT == rc->state) |
@@ -940,7 +936,7 @@ register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | |||
940 | static void | 936 | static void |
941 | host_registration_completion (void *cls, const char *emsg) | 937 | host_registration_completion (void *cls, const char *emsg) |
942 | { | 938 | { |
943 | struct RunContext *rc = cls; | 939 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
944 | 940 | ||
945 | rc->reg_handle = NULL; | 941 | rc->reg_handle = NULL; |
946 | if (NULL != emsg) | 942 | if (NULL != emsg) |
@@ -963,7 +959,7 @@ host_registration_completion (void *cls, const char *emsg) | |||
963 | static void | 959 | static void |
964 | register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 960 | register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
965 | { | 961 | { |
966 | struct RunContext *rc = cls; | 962 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
967 | struct RunContextOperation *rcop; | 963 | struct RunContextOperation *rcop; |
968 | unsigned int slave; | 964 | unsigned int slave; |
969 | 965 | ||
@@ -1005,7 +1001,7 @@ static void | |||
1005 | controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, | 1001 | controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, |
1006 | int status) | 1002 | int status) |
1007 | { | 1003 | { |
1008 | struct RunContext *rc = cls; | 1004 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
1009 | uint64_t event_mask; | 1005 | uint64_t event_mask; |
1010 | 1006 | ||
1011 | if (status != GNUNET_OK) | 1007 | if (status != GNUNET_OK) |
@@ -1052,7 +1048,7 @@ netint_proc (void *cls, const char *name, int isDefault, | |||
1052 | const struct sockaddr *addr, const struct sockaddr *broadcast_addr, | 1048 | const struct sockaddr *addr, const struct sockaddr *broadcast_addr, |
1053 | const struct sockaddr *netmask, socklen_t addrlen) | 1049 | const struct sockaddr *netmask, socklen_t addrlen) |
1054 | { | 1050 | { |
1055 | struct RunContext *rc = cls; | 1051 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
1056 | char hostip[NI_MAXHOST]; | 1052 | char hostip[NI_MAXHOST]; |
1057 | char *buf; | 1053 | char *buf; |
1058 | 1054 | ||
@@ -1088,7 +1084,7 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, | |||
1088 | int status) | 1084 | int status) |
1089 | { | 1085 | { |
1090 | struct CompatibilityCheckContext *hc = cls; | 1086 | struct CompatibilityCheckContext *hc = cls; |
1091 | struct RunContext *rc; | 1087 | struct GNUNET_TESTBED_RunHandle *rc; |
1092 | struct GNUNET_TESTBED_Host **old_hosts; | 1088 | struct GNUNET_TESTBED_Host **old_hosts; |
1093 | unsigned int nhost; | 1089 | unsigned int nhost; |
1094 | 1090 | ||
@@ -1157,13 +1153,13 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, | |||
1157 | static void | 1153 | static void |
1158 | timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1154 | timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
1159 | { | 1155 | { |
1160 | struct RunContext *rc = cls; | 1156 | struct GNUNET_TESTBED_RunHandle *rc = cls; |
1161 | 1157 | ||
1162 | rc->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 1158 | rc->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
1163 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Shutting down testbed due to timeout while setup.\n")); | 1159 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Shutting down testbed due to timeout while setup.\n")); |
1164 | GNUNET_SCHEDULER_shutdown (); | 1160 | GNUNET_SCHEDULER_shutdown (); |
1165 | if (NULL != rc->test_master) | 1161 | if (NULL != rc->test_master) |
1166 | rc->test_master (rc->test_master_cls, 0, NULL, 0, 0); | 1162 | rc->test_master (rc->test_master_cls, rc, 0, NULL, 0, 0); |
1167 | rc->test_master = NULL; | 1163 | rc->test_master = NULL; |
1168 | } | 1164 | } |
1169 | 1165 | ||
@@ -1203,7 +1199,7 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
1203 | GNUNET_TESTBED_TestMaster test_master, | 1199 | GNUNET_TESTBED_TestMaster test_master, |
1204 | void *test_master_cls) | 1200 | void *test_master_cls) |
1205 | { | 1201 | { |
1206 | struct RunContext *rc; | 1202 | struct GNUNET_TESTBED_RunHandle *rc; |
1207 | char *topology; | 1203 | char *topology; |
1208 | struct CompatibilityCheckContext *hc; | 1204 | struct CompatibilityCheckContext *hc; |
1209 | struct GNUNET_TIME_Relative timeout; | 1205 | struct GNUNET_TIME_Relative timeout; |
@@ -1212,7 +1208,7 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
1212 | unsigned int nhost; | 1208 | unsigned int nhost; |
1213 | 1209 | ||
1214 | GNUNET_assert (num_peers > 0); | 1210 | GNUNET_assert (num_peers > 0); |
1215 | rc = GNUNET_malloc (sizeof (struct RunContext)); | 1211 | rc = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_RunHandle)); |
1216 | rc->cfg = GNUNET_CONFIGURATION_dup (cfg); | 1212 | rc->cfg = GNUNET_CONFIGURATION_dup (cfg); |
1217 | #if ENABLE_LL | 1213 | #if ENABLE_LL |
1218 | rc->num_hosts = GNUNET_TESTBED_hosts_load_from_loadleveler (rc->cfg, | 1214 | rc->num_hosts = GNUNET_TESTBED_hosts_load_from_loadleveler (rc->cfg, |