aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/gnunet_testing_netjail_lib.h2
-rw-r--r--src/testing/testing_api_cmd_netjail_start_testsystem.c5
-rw-r--r--src/testing/testing_api_cmd_netjail_stop_testsystem.c11
-rw-r--r--src/testing/testing_api_loop.c4
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send.c21
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_dv.c25
-rw-r--r--src/transport/test_transport_plugin_cmd_udp_backchannel.c15
-rwxr-xr-xsrc/transport/test_transport_udp_backchannel.sh2
8 files changed, 46 insertions, 39 deletions
diff --git a/src/include/gnunet_testing_netjail_lib.h b/src/include/gnunet_testing_netjail_lib.h
index 7ec6b294b..011db00f8 100644
--- a/src/include/gnunet_testing_netjail_lib.h
+++ b/src/include/gnunet_testing_netjail_lib.h
@@ -483,7 +483,7 @@ GNUNET_TESTING_cmd_local_test_prepared (const char *label,
483#define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op) \ 483#define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op) \
484 op (test_system, const struct GNUNET_TESTING_System) \ 484 op (test_system, const struct GNUNET_TESTING_System) \
485 op (async_context, const struct GNUNET_TESTING_AsyncContext) \ 485 op (async_context, const struct GNUNET_TESTING_AsyncContext) \
486 op (helper_handles, const void *) \ 486 op (helper_handles, const struct GNUNET_HELPER_Handle *) \
487 op (local_prepared_state, const struct LocalPreparedState) \ 487 op (local_prepared_state, const struct LocalPreparedState) \
488 op (block_state, const struct BlockState) 488 op (block_state, const struct BlockState)
489 489
diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem.c b/src/testing/testing_api_cmd_netjail_start_testsystem.c
index d24ad3d28..04d7eef44 100644
--- a/src/testing/testing_api_cmd_netjail_start_testsystem.c
+++ b/src/testing/testing_api_cmd_netjail_start_testsystem.c
@@ -222,7 +222,7 @@ netjail_exec_traits (void *cls,
222 222
223 223
224 struct GNUNET_TESTING_Trait traits[] = { 224 struct GNUNET_TESTING_Trait traits[] = {
225 GNUNET_TESTING_make_trait_helper_handles ((const void **) helper), 225 GNUNET_TESTING_make_trait_helper_handles (helper),
226 GNUNET_TESTING_trait_end () 226 GNUNET_TESTING_trait_end ()
227 }; 227 };
228 228
@@ -262,7 +262,6 @@ send_message_to_locals (
262 struct GNUNET_MessageHeader *header 262 struct GNUNET_MessageHeader *header
263 ) 263 )
264{ 264{
265 // unsigned int total_number = ns->local_m * ns->global_n + ns->known;
266 const struct GNUNET_HELPER_Handle *helper; 265 const struct GNUNET_HELPER_Handle *helper;
267 struct TestingSystemCount *tbc; 266 struct TestingSystemCount *tbc;
268 267
@@ -282,7 +281,7 @@ send_message_to_locals (
282 281
283 282
284 struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send ( 283 struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send (
285 helper, 284 (struct GNUNET_HELPER_Handle *) helper,
286 header, 285 header,
287 GNUNET_NO, 286 GNUNET_NO,
288 &clear_msg, 287 &clear_msg,
diff --git a/src/testing/testing_api_cmd_netjail_stop_testsystem.c b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
index caf83ab0e..2e42056dc 100644
--- a/src/testing/testing_api_cmd_netjail_stop_testsystem.c
+++ b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
@@ -100,8 +100,9 @@ stop_testing_system_run (void *cls,
100 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 100 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
101 "i: %u\n", 101 "i: %u\n",
102 i); 102 i);
103 GNUNET_HELPER_stop (helper[i - 1], 103 GNUNET_HELPER_stop (
104 GNUNET_YES); 104 (struct GNUNET_HELPER_Handle *) helper[i - 1],
105 GNUNET_YES);
105 } 106 }
106 107
107 for (int i = 1; i <= shs->global_n; i++) 108 for (int i = 1; i <= shs->global_n; i++)
@@ -112,7 +113,11 @@ stop_testing_system_run (void *cls,
112 "i: %u j: %u\n", 113 "i: %u j: %u\n",
113 i, 114 i,
114 j); 115 j);
115 GNUNET_HELPER_stop (helper[(i - 1) * shs->local_m + j + shs->known - 1], 116 GNUNET_HELPER_stop ((struct GNUNET_HELPER_Handle *) helper[(i - 1)
117 * shs->local_m
118 + j
119 + shs->known
120 - 1],
116 GNUNET_YES); 121 GNUNET_YES);
117 } 122 }
118 } 123 }
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 290311c59..36e9da220 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -123,9 +123,9 @@ get_command (struct GNUNET_TESTING_Interpreter *is,
123 if (GNUNET_TESTING_cmd_is_batch_ (cmd)) 123 if (GNUNET_TESTING_cmd_is_batch_ (cmd))
124 { 124 {
125#define BATCH_INDEX 1 125#define BATCH_INDEX 1
126 struct GNUNET_TESTING_Command *batch; 126 const struct GNUNET_TESTING_Command *batch;
127 struct GNUNET_TESTING_Command *current; 127 struct GNUNET_TESTING_Command *current;
128 struct GNUNET_TESTING_Command *icmd; 128 const struct GNUNET_TESTING_Command *icmd;
129 const struct GNUNET_TESTING_Command *match; 129 const struct GNUNET_TESTING_Command *match;
130 130
131 current = GNUNET_TESTING_cmd_batch_get_current_ (cmd); 131 current = GNUNET_TESTING_cmd_batch_get_current_ (cmd);
diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c
index 6a6861d77..154c0abca 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send.c
@@ -97,15 +97,15 @@ static void
97handle_test (void *cls, 97handle_test (void *cls,
98 const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) 98 const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
99{ 99{
100 struct GNUNET_TESTING_AsyncContext *ac; 100 const struct GNUNET_TESTING_AsyncContext *ac;
101 101
102 GNUNET_TESTING_get_trait_async_context (&block_receive, 102 GNUNET_TESTING_get_trait_async_context (&block_receive,
103 &ac); 103 &ac);
104 GNUNET_assert (NULL != ac); 104 GNUNET_assert (NULL != ac);
105 if (NULL == ac->cont) 105 if (NULL == ac->cont)
106 GNUNET_TESTING_async_fail (ac); 106 GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac);
107 else 107 else
108 GNUNET_TESTING_async_finish (ac); 108 GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac);
109} 109}
110 110
111 111
@@ -116,15 +116,15 @@ handle_test (void *cls,
116static void 116static void
117all_peers_started () 117all_peers_started ()
118{ 118{
119 struct GNUNET_TESTING_AsyncContext *ac; 119 const struct GNUNET_TESTING_AsyncContext *ac;
120 120
121 GNUNET_TESTING_get_trait_async_context (&block_send, 121 GNUNET_TESTING_get_trait_async_context (&block_send,
122 &ac); 122 &ac);
123 GNUNET_assert (NULL != ac); 123 GNUNET_assert (NULL != ac);
124 if (NULL == ac->cont) 124 if (NULL == ac->cont)
125 GNUNET_TESTING_async_fail (ac); 125 GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac);
126 else 126 else
127 GNUNET_TESTING_async_finish (ac); 127 GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac);
128} 128}
129 129
130 130
@@ -167,7 +167,7 @@ static void *
167notify_connect (struct GNUNET_TESTING_Interpreter *is, 167notify_connect (struct GNUNET_TESTING_Interpreter *is,
168 const struct GNUNET_PeerIdentity *peer) 168 const struct GNUNET_PeerIdentity *peer)
169{ 169{
170 struct ConnectPeersState *cps; 170 const struct ConnectPeersState *cps;
171 const struct GNUNET_TESTING_Command *cmd; 171 const struct GNUNET_TESTING_Command *cmd;
172 172
173 cmd = GNUNET_TESTING_interpreter_lookup_command (is, 173 cmd = GNUNET_TESTING_interpreter_lookup_command (is,
@@ -188,15 +188,16 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
188static void 188static void
189all_local_tests_prepared () 189all_local_tests_prepared ()
190{ 190{
191 struct LocalPreparedState *lfs; 191 const struct LocalPreparedState *lfs;
192 192
193 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared, 193 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared,
194 &lfs); 194 &lfs);
195 GNUNET_assert (NULL != &lfs->ac); 195 GNUNET_assert (NULL != &lfs->ac);
196 if (NULL == lfs->ac.cont) 196 if (NULL == lfs->ac.cont)
197 GNUNET_TESTING_async_fail (&lfs->ac); 197 GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) &lfs->ac);
198 else 198 else
199 GNUNET_TESTING_async_finish (&lfs->ac); 199 GNUNET_TESTING_async_finish ((struct
200 GNUNET_TESTING_AsyncContext *) &lfs->ac);
200} 201}
201 202
202 203
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_dv.c b/src/transport/test_transport_plugin_cmd_simple_send_dv.c
index 6a3492705..e73e5a0b2 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send_dv.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send_dv.c
@@ -96,7 +96,7 @@ static void
96handle_test (void *cls, 96handle_test (void *cls,
97 const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) 97 const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
98{ 98{
99 struct GNUNET_TESTING_AsyncContext *ac; 99 const struct GNUNET_TESTING_AsyncContext *ac;
100 100
101 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 101 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
102 "Received test message\n"); 102 "Received test message\n");
@@ -104,9 +104,9 @@ handle_test (void *cls,
104 &ac); 104 &ac);
105 GNUNET_assert (NULL != ac); 105 GNUNET_assert (NULL != ac);
106 if (NULL == ac->cont) 106 if (NULL == ac->cont)
107 GNUNET_TESTING_async_fail (ac); 107 GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac);
108 else 108 else
109 GNUNET_TESTING_async_finish (ac); 109 GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac);
110} 110}
111 111
112 112
@@ -117,7 +117,7 @@ handle_test (void *cls,
117static void 117static void
118all_peers_started () 118all_peers_started ()
119{ 119{
120 struct GNUNET_TESTING_AsyncContext *ac; 120 const struct GNUNET_TESTING_AsyncContext *ac;
121 121
122 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 122 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
123 "Received message\n"); 123 "Received message\n");
@@ -125,9 +125,9 @@ all_peers_started ()
125 &ac); 125 &ac);
126 GNUNET_assert (NULL != ac); 126 GNUNET_assert (NULL != ac);
127 if (NULL == ac->cont) 127 if (NULL == ac->cont)
128 GNUNET_TESTING_async_fail (ac); 128 GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac);
129 else 129 else
130 GNUNET_TESTING_async_finish (ac); 130 GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac);
131} 131}
132 132
133 133
@@ -170,7 +170,7 @@ static void *
170notify_connect (struct GNUNET_TESTING_Interpreter *is, 170notify_connect (struct GNUNET_TESTING_Interpreter *is,
171 const struct GNUNET_PeerIdentity *peer) 171 const struct GNUNET_PeerIdentity *peer)
172{ 172{
173 struct ConnectPeersState *cps; 173 const struct ConnectPeersState *cps;
174 const struct GNUNET_TESTING_Command *cmd; 174 const struct GNUNET_TESTING_Command *cmd;
175 void *ret = NULL; 175 void *ret = NULL;
176 176
@@ -178,12 +178,12 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
178 "notify_connect peer %s\n", 178 "notify_connect peer %s\n",
179 GNUNET_i2s (peer)); 179 GNUNET_i2s (peer));
180 cmd = GNUNET_TESTING_interpreter_lookup_command_all (is, 180 cmd = GNUNET_TESTING_interpreter_lookup_command_all (is,
181 "connect-peers"); 181 "connect-peers");
182 GNUNET_TRANSPORT_get_trait_connect_peer_state (cmd, 182 GNUNET_TRANSPORT_get_trait_connect_peer_state (cmd,
183 &cps); 183 &cps);
184 cps->notify_connect (is, 184 cps->notify_connect (is,
185 peer); 185 peer);
186 186
187 return ret; 187 return ret;
188} 188}
189 189
@@ -194,15 +194,16 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
194static void 194static void
195all_local_tests_prepared () 195all_local_tests_prepared ()
196{ 196{
197 struct LocalPreparedState *lfs; 197 const struct LocalPreparedState *lfs;
198 198
199 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared, 199 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared,
200 &lfs); 200 &lfs);
201 GNUNET_assert (NULL != &lfs->ac); 201 GNUNET_assert (NULL != &lfs->ac);
202 if (NULL == lfs->ac.cont) 202 if (NULL == lfs->ac.cont)
203 GNUNET_TESTING_async_fail (&lfs->ac); 203 GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) &lfs->ac);
204 else 204 else
205 GNUNET_TESTING_async_finish (&lfs->ac); 205 GNUNET_TESTING_async_finish ((struct
206 GNUNET_TESTING_AsyncContext *) &lfs->ac);
206} 207}
207 208
208 209
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
index b594049c9..537832e61 100644
--- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c
+++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
@@ -113,15 +113,15 @@ handle_test (void *cls,
113static void 113static void
114all_peers_started () 114all_peers_started ()
115{ 115{
116 struct GNUNET_TESTING_AsyncContext *ac; 116 const struct GNUNET_TESTING_AsyncContext *ac;
117 117
118 GNUNET_TESTING_get_trait_async_context (&block_send, 118 GNUNET_TESTING_get_trait_async_context (&block_send,
119 &ac); 119 &ac);
120 GNUNET_assert (NULL != ac); 120 GNUNET_assert (NULL != ac);
121 if ((NULL == ac->cont)) 121 if ((NULL == ac->cont))
122 GNUNET_TESTING_async_fail (ac); 122 GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac);
123 else 123 else
124 GNUNET_TESTING_async_finish (ac); 124 GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac);
125} 125}
126 126
127 127
@@ -163,7 +163,7 @@ static void *
163notify_connect (struct GNUNET_TESTING_Interpreter *is, 163notify_connect (struct GNUNET_TESTING_Interpreter *is,
164 const struct GNUNET_PeerIdentity *peer) 164 const struct GNUNET_PeerIdentity *peer)
165{ 165{
166 struct ConnectPeersState *cps; 166 const struct ConnectPeersState *cps;
167 167
168 GNUNET_TRANSPORT_get_trait_connect_peer_state (&connect_peers, 168 GNUNET_TRANSPORT_get_trait_connect_peer_state (&connect_peers,
169 &cps); 169 &cps);
@@ -180,15 +180,16 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
180static void 180static void
181all_local_tests_prepared () 181all_local_tests_prepared ()
182{ 182{
183 struct LocalPreparedState *lfs; 183 const struct LocalPreparedState *lfs;
184 184
185 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared, 185 GNUNET_TESTING_get_trait_local_prepared_state (&local_prepared,
186 &lfs); 186 &lfs);
187 GNUNET_assert (NULL != &lfs->ac); 187 GNUNET_assert (NULL != &lfs->ac);
188 if (NULL == lfs->ac.cont) 188 if (NULL == lfs->ac.cont)
189 GNUNET_TESTING_async_fail (&lfs->ac); 189 GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) &lfs->ac);
190 else 190 else
191 GNUNET_TESTING_async_finish (&lfs->ac); 191 GNUNET_TESTING_async_finish ((struct
192 GNUNET_TESTING_AsyncContext *) &lfs->ac);
192} 193}
193 194
194/** 195/**
diff --git a/src/transport/test_transport_udp_backchannel.sh b/src/transport/test_transport_udp_backchannel.sh
index b42186307..1b0e283b5 100755
--- a/src/transport/test_transport_udp_backchannel.sh
+++ b/src/transport/test_transport_udp_backchannel.sh
@@ -4,7 +4,7 @@ if ! [ -d "/run/netns" ]; then
4fi 4fi
5if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" == 1 ]; then 5if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" == 1 ]; then
6#exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; valgrind --leak-check=full --track-origins=yes --trace-children=yes --trace-children-skip=/usr/bin/awk,/usr/bin/cut,/usr/bin/seq,/sbin/ip ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf" 6#exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; valgrind --leak-check=full --track-origins=yes --trace-children=yes --trace-children-skip=/usr/bin/awk,/usr/bin/cut,/usr/bin/seq,/sbin/ip ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf"
7exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf" 7exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; GNUNET_FORCE_LOG='transport;;;;DEBUG' GNUNET_FORCE_LOGFILE='test.out' ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf"
8# exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; valgrind --leak-check=full --track-origins=yes ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf" 8# exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; valgrind --leak-check=full --track-origins=yes ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf"
9else 9else
10 echo -e "Error during test setup: The kernel parameter kernel.unprivileged_userns_clone has to be set to 1! One has to execute\n\n sysctl kernel.unprivileged_userns_clone=1\n" 10 echo -e "Error during test setup: The kernel parameter kernel.unprivileged_userns_clone has to be set to 1! One has to execute\n\n sysctl kernel.unprivileged_userns_clone=1\n"