diff options
-rw-r--r-- | po/es.po | 29 | ||||
-rw-r--r-- | src/topology/test_gnunet_daemon_topology.c | 227 |
2 files changed, 223 insertions, 33 deletions
@@ -2,6 +2,7 @@ | |||
2 | # Copyright (C) 2012 Christian Grothoff <christian@grothoff.org> | 2 | # Copyright (C) 2012 Christian Grothoff <christian@grothoff.org> |
3 | # This file is distributed under the same license as the GNUnet package. | 3 | # This file is distributed under the same license as the GNUnet package. |
4 | # Miguel Ángel Arruga Vivas <rosen644835@gmail.com>, 2006, 2013. | 4 | # Miguel Ángel Arruga Vivas <rosen644835@gmail.com>, 2006, 2013. |
5 | # xrs <xrs@mail36.net>, 2018 | ||
5 | # | 6 | # |
6 | msgid "" | 7 | msgid "" |
7 | msgstr "" | 8 | msgstr "" |
@@ -156,12 +157,12 @@ msgstr "Servicios en ejecución:\n" | |||
156 | #: src/arm/gnunet-arm.c:614 | 157 | #: src/arm/gnunet-arm.c:614 |
157 | #, c-format | 158 | #, c-format |
158 | msgid "Now only monitoring, press CTRL-C to stop.\n" | 159 | msgid "Now only monitoring, press CTRL-C to stop.\n" |
159 | msgstr "" | 160 | msgstr "Ahora solo monitorizando, pulsa CTRL-C para parar.\n" |
160 | 161 | ||
161 | #: src/arm/gnunet-arm.c:646 | 162 | #: src/arm/gnunet-arm.c:646 |
162 | #, c-format | 163 | #, c-format |
163 | msgid "Stopped %s.\n" | 164 | msgid "Stopped %s.\n" |
164 | msgstr "" | 165 | msgstr "%s detenido.\n" |
165 | 166 | ||
166 | #: src/arm/gnunet-arm.c:649 | 167 | #: src/arm/gnunet-arm.c:649 |
167 | #, fuzzy, c-format | 168 | #, fuzzy, c-format |
@@ -171,7 +172,7 @@ msgstr "Iniciando descarga «%s».\n" | |||
171 | #: src/arm/gnunet-arm.c:652 | 172 | #: src/arm/gnunet-arm.c:652 |
172 | #, c-format | 173 | #, c-format |
173 | msgid "Stopping %s...\n" | 174 | msgid "Stopping %s...\n" |
174 | msgstr "" | 175 | msgstr "Deteniendo %s...\n" |
175 | 176 | ||
176 | #: src/arm/gnunet-arm.c:666 | 177 | #: src/arm/gnunet-arm.c:666 |
177 | #, fuzzy, c-format | 178 | #, fuzzy, c-format |
@@ -204,7 +205,7 @@ msgstr "borrar el directorio y el fichero de configuración al salir" | |||
204 | 205 | ||
205 | #: src/arm/gnunet-arm.c:798 | 206 | #: src/arm/gnunet-arm.c:798 |
206 | msgid "monitor ARM activities" | 207 | msgid "monitor ARM activities" |
207 | msgstr "" | 208 | msgstr "monitoriza actividades de ARM" |
208 | 209 | ||
209 | #: src/arm/gnunet-arm.c:803 | 210 | #: src/arm/gnunet-arm.c:803 |
210 | msgid "don't print status messages" | 211 | msgid "don't print status messages" |
@@ -212,7 +213,7 @@ msgstr "no imprime mensajes de estado" | |||
212 | 213 | ||
213 | #: src/arm/gnunet-arm.c:809 | 214 | #: src/arm/gnunet-arm.c:809 |
214 | msgid "exit with error status if operation does not finish after DELAY" | 215 | msgid "exit with error status if operation does not finish after DELAY" |
215 | msgstr "" | 216 | msgstr "sale con estado de error si la operación no termina despues del DELAY" |
216 | 217 | ||
217 | #: src/arm/gnunet-arm.c:814 | 218 | #: src/arm/gnunet-arm.c:814 |
218 | msgid "list currently running services" | 219 | msgid "list currently running services" |
@@ -421,7 +422,7 @@ msgstr "valor a establecer" | |||
421 | #: src/ats/gnunet-ats-solver-eval.c:3297 src/ats-tests/gnunet-solver-eval.c:943 | 422 | #: src/ats/gnunet-ats-solver-eval.c:3297 src/ats-tests/gnunet-solver-eval.c:943 |
422 | #: src/ats-tests/gnunet-solver-eval.c:948 | 423 | #: src/ats-tests/gnunet-solver-eval.c:948 |
423 | msgid "experiment to use" | 424 | msgid "experiment to use" |
424 | msgstr "" | 425 | msgstr "experimento para usar" |
425 | 426 | ||
426 | #: src/ats/gnunet-ats-solver-eval.c:3304 | 427 | #: src/ats/gnunet-ats-solver-eval.c:3304 |
427 | #, fuzzy | 428 | #, fuzzy |
@@ -430,11 +431,11 @@ msgstr "Iniciando descarga «%s».\n" | |||
430 | 431 | ||
431 | #: src/ats/gnunet-ats-solver-eval.c:3309 | 432 | #: src/ats/gnunet-ats-solver-eval.c:3309 |
432 | msgid "save logging to disk" | 433 | msgid "save logging to disk" |
433 | msgstr "" | 434 | msgstr "guarda protocolo al fichero en disco" |
434 | 435 | ||
435 | #: src/ats/gnunet-ats-solver-eval.c:3314 | 436 | #: src/ats/gnunet-ats-solver-eval.c:3314 |
436 | msgid "disable normalization" | 437 | msgid "disable normalization" |
437 | msgstr "" | 438 | msgstr "deshabilita normalización" |
438 | 439 | ||
439 | #: src/ats/gnunet-service-ats_plugins.c:302 | 440 | #: src/ats/gnunet-service-ats_plugins.c:302 |
440 | #, fuzzy, c-format | 441 | #, fuzzy, c-format |
@@ -584,11 +585,11 @@ msgstr "" | |||
584 | 585 | ||
585 | #: src/ats-tool/gnunet-ats.c:400 | 586 | #: src/ats-tool/gnunet-ats.c:400 |
586 | msgid "active " | 587 | msgid "active " |
587 | msgstr "" | 588 | msgstr "activo " |
588 | 589 | ||
589 | #: src/ats-tool/gnunet-ats.c:400 | 590 | #: src/ats-tool/gnunet-ats.c:400 |
590 | msgid "inactive " | 591 | msgid "inactive " |
591 | msgstr "" | 592 | msgstr "inactivo " |
592 | 593 | ||
593 | #: src/ats-tool/gnunet-ats.c:510 | 594 | #: src/ats-tool/gnunet-ats.c:510 |
594 | #, fuzzy, c-format | 595 | #, fuzzy, c-format |
@@ -693,19 +694,19 @@ msgstr "Imprime información acerca del estado del ATS" | |||
693 | 694 | ||
694 | #: src/auction/gnunet-auction-create.c:161 | 695 | #: src/auction/gnunet-auction-create.c:161 |
695 | msgid "description of the item to be sold" | 696 | msgid "description of the item to be sold" |
696 | msgstr "" | 697 | msgstr "descripción del elemento que está por vender" |
697 | 698 | ||
698 | #: src/auction/gnunet-auction-create.c:167 | 699 | #: src/auction/gnunet-auction-create.c:167 |
699 | msgid "mapping of possible prices" | 700 | msgid "mapping of possible prices" |
700 | msgstr "" | 701 | msgstr "figurando posibles precios" |
701 | 702 | ||
702 | #: src/auction/gnunet-auction-create.c:173 | 703 | #: src/auction/gnunet-auction-create.c:173 |
703 | msgid "max duration per round" | 704 | msgid "max duration per round" |
704 | msgstr "" | 705 | msgstr "maxima duración del turno" |
705 | 706 | ||
706 | #: src/auction/gnunet-auction-create.c:179 | 707 | #: src/auction/gnunet-auction-create.c:179 |
707 | msgid "duration until auction starts" | 708 | msgid "duration until auction starts" |
708 | msgstr "" | 709 | msgstr "duración hasta que la caución empieza" |
709 | 710 | ||
710 | #: src/auction/gnunet-auction-create.c:184 | 711 | #: src/auction/gnunet-auction-create.c:184 |
711 | msgid "" | 712 | msgid "" |
diff --git a/src/topology/test_gnunet_daemon_topology.c b/src/topology/test_gnunet_daemon_topology.c index 7c75d1137..bf9121eb0 100644 --- a/src/topology/test_gnunet_daemon_topology.c +++ b/src/topology/test_gnunet_daemon_topology.c | |||
@@ -18,47 +18,202 @@ | |||
18 | /** | 18 | /** |
19 | * @file topology/test_gnunet_daemon_topology.c | 19 | * @file topology/test_gnunet_daemon_topology.c |
20 | * @brief testcase for topology maintenance code | 20 | * @brief testcase for topology maintenance code |
21 | * @author Christian Grothoff | ||
22 | * @author xrs | ||
21 | */ | 23 | */ |
22 | #include "platform.h" | 24 | #include "platform.h" |
23 | #include "gnunet_testbed_service.h" | 25 | #include "gnunet_testbed_service.h" |
26 | #include "gnunet_statistics_service.h" | ||
24 | 27 | ||
25 | 28 | ||
26 | #define NUM_PEERS 8 | 29 | #define NUM_PEERS 8 |
27 | 30 | ||
31 | /* | ||
32 | * The threshold defines the number of connection that are needed | ||
33 | * for one peer to pass the test. Be aware that setting NUM_PEERS | ||
34 | * too high can cause bandwidth problems for the testing peers. | ||
35 | * Normal should be 5KB/s per peer. See gnunet-config -s ats. | ||
36 | */ | ||
37 | #define THRESHOLD NUM_PEERS/2 | ||
38 | |||
28 | /** | 39 | /** |
29 | * How long until we give up on connecting the peers? | 40 | * How long until we give up on connecting the peers? |
30 | */ | 41 | */ |
31 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600) | 42 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) |
32 | 43 | ||
44 | /* | ||
45 | * Store manual connections. | ||
46 | */ | ||
47 | static unsigned int connect_left; | ||
33 | 48 | ||
34 | static int ok; | 49 | /* |
50 | * Result of the testcase. | ||
51 | */ | ||
52 | static int result; | ||
35 | 53 | ||
36 | static unsigned int connect_left; | 54 | /* |
55 | * Peers that reached the threshold of connections. | ||
56 | */ | ||
57 | static int checked_peers; | ||
58 | |||
59 | /* | ||
60 | * Testbed operations. | ||
61 | */ | ||
62 | struct GNUNET_TESTBED_Operation *op[NUM_PEERS]; | ||
63 | |||
64 | /* | ||
65 | * Timeout for testcase. | ||
66 | */ | ||
67 | static struct GNUNET_SCHEDULER_Task *timeout_tid; | ||
68 | |||
69 | /* | ||
70 | * Peer context for every testbed peer. | ||
71 | */ | ||
72 | struct peerctx | ||
73 | { | ||
74 | int index; | ||
75 | struct GNUNET_STATISTICS_Handle *statistics; | ||
76 | int connections; | ||
77 | int reported; /* GNUNET_NO | GNUNET_YES */ | ||
78 | }; | ||
79 | |||
80 | |||
81 | static void | ||
82 | shutdown_task (void *cls) | ||
83 | { | ||
84 | unsigned int i; | ||
85 | |||
86 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
87 | "Shutting down testcase\n"); | ||
37 | 88 | ||
89 | for (i=0;i<NUM_PEERS;i++) { | ||
90 | if (NULL != op[i]) | ||
91 | GNUNET_TESTBED_operation_done (op[i]); | ||
92 | } | ||
93 | |||
94 | if (NULL != timeout_tid) | ||
95 | GNUNET_SCHEDULER_cancel (timeout_tid); | ||
96 | } | ||
97 | |||
98 | static void | ||
99 | timeout_task (void *cls) | ||
100 | { | ||
101 | timeout_tid = NULL; | ||
102 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
103 | "Testcase timeout\n"); | ||
104 | |||
105 | result = GNUNET_SYSERR; | ||
106 | GNUNET_SCHEDULER_shutdown(); | ||
107 | } | ||
108 | |||
109 | /* | ||
110 | * The function is called every time the topology of connected | ||
111 | * peers to a peer changes. | ||
112 | */ | ||
113 | int | ||
114 | statistics_iterator (void *cls, | ||
115 | const char *subsystem, | ||
116 | const char *name, | ||
117 | uint64_t value, | ||
118 | int is_persistent) | ||
119 | { | ||
120 | struct peerctx *p_ctx = (struct peerctx*) cls; | ||
121 | |||
122 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
123 | "Peer %d: %s = %d\n", | ||
124 | p_ctx->index, | ||
125 | name, | ||
126 | value); | ||
127 | |||
128 | if (p_ctx->connections < value) | ||
129 | p_ctx->connections = value; | ||
130 | |||
131 | if (THRESHOLD <= value && GNUNET_NO == p_ctx->reported) { | ||
132 | p_ctx->reported = GNUNET_YES; | ||
133 | checked_peers++; | ||
134 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | ||
135 | "Peer %d successfully connected to at least %d peers once.\n", | ||
136 | p_ctx->index, | ||
137 | THRESHOLD); | ||
138 | |||
139 | if (checked_peers == NUM_PEERS) { | ||
140 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | ||
141 | "Test OK: All peers have connected to %d peers once.\n", | ||
142 | THRESHOLD); | ||
143 | result = GNUNET_YES; | ||
144 | GNUNET_SCHEDULER_shutdown(); | ||
145 | } | ||
146 | } | ||
147 | |||
148 | return GNUNET_YES; | ||
149 | } | ||
150 | |||
151 | static void * | ||
152 | ca_statistics (void *cls, | ||
153 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
154 | { | ||
155 | return GNUNET_STATISTICS_create ("topology", cfg); | ||
156 | } | ||
157 | |||
158 | |||
159 | void | ||
160 | da_statistics (void *cls, | ||
161 | void *op_result) | ||
162 | { | ||
163 | struct peerctx *p_ctx = (struct peerctx *) cls; | ||
164 | |||
165 | GNUNET_break (GNUNET_OK == GNUNET_STATISTICS_watch_cancel | ||
166 | (p_ctx->statistics, "topology", "# peers connected", | ||
167 | statistics_iterator, p_ctx)); | ||
168 | |||
169 | GNUNET_STATISTICS_destroy (p_ctx->statistics, GNUNET_NO); | ||
170 | p_ctx->statistics = NULL; | ||
171 | |||
172 | GNUNET_free (p_ctx); | ||
173 | } | ||
174 | |||
175 | |||
176 | static void | ||
177 | service_connect_complete (void *cls, | ||
178 | struct GNUNET_TESTBED_Operation *op, | ||
179 | void *ca_result, | ||
180 | const char *emsg) | ||
181 | { | ||
182 | int ret; | ||
183 | struct peerctx *p_ctx = (struct peerctx*) cls; | ||
184 | |||
185 | if (NULL == ca_result) | ||
186 | GNUNET_SCHEDULER_shutdown(); | ||
187 | |||
188 | p_ctx->statistics = ca_result; | ||
189 | |||
190 | ret = GNUNET_STATISTICS_watch (ca_result, | ||
191 | "topology", | ||
192 | "# peers connected", | ||
193 | statistics_iterator, | ||
194 | p_ctx); | ||
195 | |||
196 | if (GNUNET_NO == ret) | ||
197 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
198 | "call to GNUNET_STATISTICS_watch() failed\n"); | ||
199 | } | ||
38 | 200 | ||
39 | static void | 201 | static void |
40 | notify_connect_complete (void *cls, | 202 | notify_connect_complete (void *cls, |
41 | struct GNUNET_TESTBED_Operation *op, | 203 | struct GNUNET_TESTBED_Operation *op, |
42 | const char *emsg) | 204 | const char *emsg) |
43 | { | 205 | { |
44 | GNUNET_TESTBED_operation_done (op); | 206 | GNUNET_TESTBED_operation_done (op); |
45 | if (NULL != emsg) | 207 | if (NULL != emsg) |
46 | { | 208 | { |
47 | FPRINTF (stderr, "Failed to connect two peers: %s\n", emsg); | 209 | FPRINTF (stderr, "Failed to connect two peers: %s\n", emsg); |
210 | result = GNUNET_SYSERR; | ||
48 | GNUNET_SCHEDULER_shutdown (); | 211 | GNUNET_SCHEDULER_shutdown (); |
49 | ok = 1; | ||
50 | return; | 212 | return; |
51 | } | 213 | } |
52 | connect_left--; | 214 | connect_left--; |
53 | if (0 == connect_left) | ||
54 | { | ||
55 | /* FIXME: check that topology adds a few more links | ||
56 | * in addition to those that were seeded */ | ||
57 | GNUNET_SCHEDULER_shutdown (); | ||
58 | } | ||
59 | } | 215 | } |
60 | 216 | ||
61 | |||
62 | static void | 217 | static void |
63 | do_connect (void *cls, | 218 | do_connect (void *cls, |
64 | struct GNUNET_TESTBED_RunHandle *h, | 219 | struct GNUNET_TESTBED_RunHandle *h, |
@@ -68,28 +223,62 @@ do_connect (void *cls, | |||
68 | unsigned int links_failed) | 223 | unsigned int links_failed) |
69 | { | 224 | { |
70 | unsigned int i; | 225 | unsigned int i; |
226 | struct peerctx *p_ctx; | ||
227 | |||
228 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
229 | "Threshold is set to %d.\n", | ||
230 | THRESHOLD); | ||
71 | 231 | ||
72 | GNUNET_assert (NUM_PEERS == num_peers); | 232 | GNUNET_assert (NUM_PEERS == num_peers); |
73 | for (i=0;i<num_peers-1;i++) | 233 | |
234 | for (i=0;i<NUM_PEERS;i++) | ||
74 | { | 235 | { |
75 | connect_left++; | 236 | p_ctx = GNUNET_new (struct peerctx); |
76 | GNUNET_TESTBED_overlay_connect (NULL, | 237 | p_ctx->index = i; |
77 | ¬ify_connect_complete, NULL, | 238 | p_ctx->connections = 0; |
78 | peers[i], peers[i+1]); | 239 | p_ctx->reported = GNUNET_NO; |
240 | |||
241 | if (i<NUM_PEERS-1) { | ||
242 | connect_left++; | ||
243 | GNUNET_TESTBED_overlay_connect (NULL, | ||
244 | ¬ify_connect_complete, NULL, | ||
245 | peers[i], peers[i+1]); | ||
246 | } | ||
247 | |||
248 | op[i] = | ||
249 | GNUNET_TESTBED_service_connect (cls, | ||
250 | peers[i], | ||
251 | "statistics", | ||
252 | service_connect_complete, | ||
253 | p_ctx, /* cls of completion cb */ | ||
254 | ca_statistics, /* connect adapter */ | ||
255 | da_statistics, /* disconnect adapter */ | ||
256 | p_ctx); | ||
257 | |||
79 | } | 258 | } |
259 | |||
260 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | ||
261 | timeout_tid = | ||
262 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, | ||
263 | &timeout_task, | ||
264 | NULL); | ||
80 | } | 265 | } |
81 | 266 | ||
82 | 267 | ||
83 | int | 268 | int |
84 | main (int argc, char *argv[]) | 269 | main (int argc, char *argv[]) |
85 | { | 270 | { |
271 | result = GNUNET_SYSERR; | ||
272 | checked_peers = 0; | ||
273 | |||
86 | (void) GNUNET_TESTBED_test_run ("test-gnunet-daemon-topology", | 274 | (void) GNUNET_TESTBED_test_run ("test-gnunet-daemon-topology", |
87 | "test_gnunet_daemon_topology_data.conf", | 275 | "test_gnunet_daemon_topology_data.conf", |
88 | NUM_PEERS, | 276 | NUM_PEERS, |
89 | 0, NULL, NULL, | 277 | 0, NULL, NULL, |
90 | &do_connect, NULL); | 278 | &do_connect, NULL); |
91 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology"); | 279 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology"); |
92 | return ok; | 280 | |
281 | return (GNUNET_OK != result) ? 1 : 0; | ||
93 | } | 282 | } |
94 | 283 | ||
95 | /* end of test_gnunet_daemon_topology.c */ | 284 | /* end of test_gnunet_daemon_topology.c */ |