diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-08-05 12:11:41 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-08-05 12:11:41 +0000 |
commit | 88c11d3a2219762a919e49872d6d24108b06b987 (patch) | |
tree | 3e8a04cd9f5c4015221827621b95343dd1743b5b /src | |
parent | 86a9316f0f9b422e6b3fae8c75255a92e326dd51 (diff) | |
download | gnunet-88c11d3a2219762a919e49872d6d24108b06b987.tar.gz gnunet-88c11d3a2219762a919e49872d6d24108b06b987.zip |
topology stability testcase
Diffstat (limited to 'src')
-rw-r--r-- | src/testing/Makefile.am | 10 | ||||
-rw-r--r-- | src/testing/test_testing_data_topology_none.conf | 2 | ||||
-rw-r--r-- | src/testing/test_testing_data_topology_stability.conf | 55 | ||||
-rw-r--r-- | src/testing/test_testing_topology.c | 47 |
4 files changed, 103 insertions, 11 deletions
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index 77d3e8cbe..fa56e1726 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am | |||
@@ -19,11 +19,14 @@ libgnunettesting_la_LIBADD = $(XLIB) \ | |||
19 | $(top_builddir)/src/transport/libgnunettransport.la \ | 19 | $(top_builddir)/src/transport/libgnunettransport.la \ |
20 | -lm \ | 20 | -lm \ |
21 | $(top_builddir)/src/util/libgnunetutil.la | 21 | $(top_builddir)/src/util/libgnunetutil.la |
22 | |||
23 | #noinst_PROGRAMS = ${check_PROGRAMS} | ||
22 | 24 | ||
23 | check_PROGRAMS = \ | 25 | check_PROGRAMS = \ |
24 | test_testing \ | 26 | test_testing \ |
25 | test_testing_connect \ | 27 | test_testing_connect \ |
26 | test_testing_group \ | 28 | test_testing_group \ |
29 | test_testing_topology_stability \ | ||
27 | test_testing_topology_clique \ | 30 | test_testing_topology_clique \ |
28 | test_testing_topology_clique_random \ | 31 | test_testing_topology_clique_random \ |
29 | test_testing_topology_clique_minimum \ | 32 | test_testing_topology_clique_minimum \ |
@@ -47,6 +50,7 @@ TESTS = \ | |||
47 | test_testing_connect \ | 50 | test_testing_connect \ |
48 | test_testing_group \ | 51 | test_testing_group \ |
49 | test_testing_topology_clique | 52 | test_testing_topology_clique |
53 | # test_testing_topology_stability \ | ||
50 | # test_testing_topology_clique_random \ | 54 | # test_testing_topology_clique_random \ |
51 | # test_testing_topology_clique_minimum \ | 55 | # test_testing_topology_clique_minimum \ |
52 | # test_testing_topology_clique_dfs \ | 56 | # test_testing_topology_clique_dfs \ |
@@ -87,6 +91,12 @@ test_testing_topology_clique_LDADD = \ | |||
87 | $(top_builddir)/src/testing/libgnunettesting.la \ | 91 | $(top_builddir)/src/testing/libgnunettesting.la \ |
88 | $(top_builddir)/src/util/libgnunetutil.la | 92 | $(top_builddir)/src/util/libgnunetutil.la |
89 | 93 | ||
94 | test_testing_topology_stability_SOURCES = \ | ||
95 | test_testing_topology.c | ||
96 | test_testing_topology_stability_LDADD = \ | ||
97 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
98 | $(top_builddir)/src/util/libgnunetutil.la | ||
99 | |||
90 | test_testing_topology_blacklist_SOURCES = \ | 100 | test_testing_topology_blacklist_SOURCES = \ |
91 | test_testing_topology_blacklist.c | 101 | test_testing_topology_blacklist.c |
92 | test_testing_topology_blacklist_LDADD = \ | 102 | test_testing_topology_blacklist_LDADD = \ |
diff --git a/src/testing/test_testing_data_topology_none.conf b/src/testing/test_testing_data_topology_none.conf index d63b99ba4..6a2d023dc 100644 --- a/src/testing/test_testing_data_topology_none.conf +++ b/src/testing/test_testing_data_topology_none.conf | |||
@@ -40,7 +40,7 @@ PORT = 0 | |||
40 | PORT = 0 | 40 | PORT = 0 |
41 | 41 | ||
42 | [testing] | 42 | [testing] |
43 | NUM_PEERS = 50 | 43 | NUM_PEERS = 1000 |
44 | WEAKRANDOM = YES | 44 | WEAKRANDOM = YES |
45 | TOPOLOGY = NONE | 45 | TOPOLOGY = NONE |
46 | F2F = NO | 46 | F2F = NO |
diff --git a/src/testing/test_testing_data_topology_stability.conf b/src/testing/test_testing_data_topology_stability.conf new file mode 100644 index 000000000..47e0a18df --- /dev/null +++ b/src/testing/test_testing_data_topology_stability.conf | |||
@@ -0,0 +1,55 @@ | |||
1 | [PATHS] | ||
2 | SERVICEHOME = /tmp/test-gnunet-testing/ | ||
3 | DEFAULTCONFIG = test_testing_data_topology_clique.conf | ||
4 | |||
5 | [resolver] | ||
6 | PORT = 2564 | ||
7 | |||
8 | [transport] | ||
9 | PORT = 2565 | ||
10 | PLUGINS = tcp | ||
11 | #PREFIX = xterm -e xterm -T transport -e gdb --args | ||
12 | #BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/transport/.libs/gnunet-service-transport | ||
13 | #PREFIX = valgrind --tool=memcheck --log-file=logs%p | ||
14 | #PREFIX = valgrind --tool=callgrind --log-file=callgrind.%p | ||
15 | #DEBUG = YES | ||
16 | |||
17 | [arm] | ||
18 | PORT = 2566 | ||
19 | DEFAULTSERVICES = | ||
20 | |||
21 | [statistics] | ||
22 | PORT = 2567 | ||
23 | |||
24 | [transport-tcp] | ||
25 | PORT = 2568 | ||
26 | |||
27 | [transport-udp] | ||
28 | PORT = 2568 | ||
29 | |||
30 | [peerinfo] | ||
31 | PORT = 2569 | ||
32 | #DEBUG = YES | ||
33 | #PREFIX = xterm -e xterm -T peerinfo -e gdb --args | ||
34 | #BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/peerinfo/.libs/gnunet-service-peerinfo | ||
35 | #PREFIX = valgrind --tool=memcheck --log-file=peerinfo%p | ||
36 | |||
37 | [core] | ||
38 | PORT = 2570 | ||
39 | #PREFIX = xterm -e xterm -T CORE -e gdb --args | ||
40 | #PREFIX = valgrind --tool=memcheck --log-file=logs%p | ||
41 | #DEBUG = YES | ||
42 | |||
43 | [testing] | ||
44 | SETTLE_TIME = 600 | ||
45 | NUM_PEERS = 10 | ||
46 | WEAKRANDOM = YES | ||
47 | #CONNECT_TOPOLOGY = CLIQUE | ||
48 | TOPOLOGY = CLIQUE | ||
49 | F2F = YES | ||
50 | #DEBUG = YES | ||
51 | |||
52 | [dht] | ||
53 | AUTOSTART = NO | ||
54 | |||
55 | |||
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index a2bb350f0..f357862c5 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c | |||
@@ -33,7 +33,7 @@ | |||
33 | /** | 33 | /** |
34 | * How long until we fail the whole testcase? | 34 | * How long until we fail the whole testcase? |
35 | */ | 35 | */ |
36 | #define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600) | 36 | #define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 240) |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * How long until we give up on starting the peers? | 39 | * How long until we give up on starting the peers? |
@@ -52,6 +52,8 @@ static int ok; | |||
52 | 52 | ||
53 | static unsigned long long num_peers; | 53 | static unsigned long long num_peers; |
54 | 54 | ||
55 | static unsigned int topology_connections; | ||
56 | |||
55 | static unsigned int total_connections; | 57 | static unsigned int total_connections; |
56 | 58 | ||
57 | static unsigned int failed_connections; | 59 | static unsigned int failed_connections; |
@@ -76,6 +78,8 @@ GNUNET_SCHEDULER_TaskIdentifier die_task; | |||
76 | 78 | ||
77 | static char *dotOutFileName; | 79 | static char *dotOutFileName; |
78 | 80 | ||
81 | static struct GNUNET_TIME_Relative settle_time; | ||
82 | |||
79 | static FILE *dotOutFile; | 83 | static FILE *dotOutFile; |
80 | 84 | ||
81 | static char *topology_string; | 85 | static char *topology_string; |
@@ -184,6 +188,7 @@ static void gather_log_data () | |||
184 | } | 188 | } |
185 | 189 | ||
186 | #endif | 190 | #endif |
191 | |||
187 | static void | 192 | static void |
188 | finish_testing () | 193 | finish_testing () |
189 | { | 194 | { |
@@ -219,8 +224,8 @@ finish_testing () | |||
219 | GNUNET_free(free_pos); | 224 | GNUNET_free(free_pos); |
220 | } | 225 | } |
221 | #if VERBOSE | 226 | #if VERBOSE |
222 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 227 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
223 | "Transmit_ready's scheduled %d, failed %d, transmit_ready's called %d\n", transmit_ready_scheduled, transmit_ready_failed, transmit_ready_called); | 228 | "Transmit_ready's scheduled %d, failed %d, transmit_ready's called %d\n", transmit_ready_scheduled, transmit_ready_failed, transmit_ready_called); |
224 | #endif | 229 | #endif |
225 | 230 | ||
226 | #if VERBOSE | 231 | #if VERBOSE |
@@ -276,23 +281,22 @@ void topology_cb (void *cls, | |||
276 | outfile = cls; | 281 | outfile = cls; |
277 | if (first != NULL) | 282 | if (first != NULL) |
278 | { | 283 | { |
279 | if (outfile == NULL) | 284 | if (outfile != NULL) |
280 | fprintf(stderr, "Peer %s connected to %s\n", GNUNET_i2s(first), GNUNET_h2s(&second->hashPubKey)); | ||
281 | else | ||
282 | { | 285 | { |
283 | fprintf(outfile, "\t\"%s\" -- ", GNUNET_i2s(first)); | 286 | fprintf(outfile, "\t\"%s\" -- ", GNUNET_i2s(first)); |
284 | fprintf(outfile, "\"%s\";\n", GNUNET_i2s(second)); | 287 | fprintf(outfile, "\"%s\";\n", GNUNET_i2s(second)); |
285 | } | 288 | } |
289 | topology_connections++; | ||
286 | } | 290 | } |
287 | else | 291 | else |
288 | { | 292 | { |
289 | fprintf(stderr, "Finished iterating over topology!\n"); | 293 | fprintf(stderr, "Finished iterating over topology, %d total connections!\n", topology_connections); |
290 | if (outfile != NULL) | 294 | if (outfile != NULL) |
291 | { | 295 | { |
292 | fprintf(outfile, "}\n"); | 296 | fprintf(outfile, "}\n"); |
293 | fclose(outfile); | 297 | fclose(outfile); |
298 | GNUNET_SCHEDULER_add_now (sched, &finish_testing, NULL); | ||
294 | } | 299 | } |
295 | GNUNET_SCHEDULER_add_now (sched, &finish_testing, NULL); | ||
296 | } | 300 | } |
297 | } | 301 | } |
298 | 302 | ||
@@ -348,6 +352,7 @@ process_mtype (void *cls, | |||
348 | { | 352 | { |
349 | fprintf(dotOutFileFinished, "strict graph G {\n"); | 353 | fprintf(dotOutFileFinished, "strict graph G {\n"); |
350 | } | 354 | } |
355 | topology_connections = 0; | ||
351 | GNUNET_TESTING_get_topology (pg, &topology_cb, dotOutFileFinished); | 356 | GNUNET_TESTING_get_topology (pg, &topology_cb, dotOutFileFinished); |
352 | //GNUNET_SCHEDULER_add_now (sched, &finish_testing, NULL); | 357 | //GNUNET_SCHEDULER_add_now (sched, &finish_testing, NULL); |
353 | } | 358 | } |
@@ -386,6 +391,13 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
386 | GNUNET_free(free_pos); | 391 | GNUNET_free(free_pos); |
387 | } | 392 | } |
388 | 393 | ||
394 | #if VERBOSE | ||
395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
396 | "Transmit_ready's scheduled %d, failed %d, transmit_ready's called %d\n", transmit_ready_scheduled, transmit_ready_failed, transmit_ready_called); | ||
397 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
398 | "Total messages received %d, expected %d.\n", total_messages_received, expected_messages); | ||
399 | #endif | ||
400 | |||
389 | if (pg != NULL) | 401 | if (pg != NULL) |
390 | { | 402 | { |
391 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 403 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
@@ -500,6 +512,11 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
500 | { | 512 | { |
501 | struct TestMessageContext *pos = cls; | 513 | struct TestMessageContext *pos = cls; |
502 | 514 | ||
515 | if ((pos == test_messages) && (settle_time.value > 0)) | ||
516 | { | ||
517 | topology_connections = 0; | ||
518 | GNUNET_TESTING_get_topology (pg, &topology_cb, NULL); | ||
519 | } | ||
503 | if ((tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) || (cls == NULL)) | 520 | if ((tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) || (cls == NULL)) |
504 | return; | 521 | return; |
505 | 522 | ||
@@ -507,7 +524,7 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
507 | { | 524 | { |
508 | die_task = GNUNET_SCHEDULER_add_delayed (sched, | 525 | die_task = GNUNET_SCHEDULER_add_delayed (sched, |
509 | TEST_TIMEOUT, | 526 | TEST_TIMEOUT, |
510 | &end_badly, "from create topology (timeout)"); | 527 | &end_badly, "from send test messages (timeout)"); |
511 | } | 528 | } |
512 | 529 | ||
513 | if (total_server_connections >= MAX_OUTSTANDING_CONNECTIONS) | 530 | if (total_server_connections >= MAX_OUTSTANDING_CONNECTIONS) |
@@ -626,7 +643,11 @@ topology_callback (void *cls, | |||
626 | &send_test_messages, test_messages); | 643 | &send_test_messages, test_messages); |
627 | gather_log_data(); | 644 | gather_log_data(); |
628 | #else | 645 | #else |
629 | GNUNET_SCHEDULER_add_now (sched, &send_test_messages, test_messages); | 646 | if (settle_time.value > 0) |
647 | { | ||
648 | GNUNET_TESTING_get_topology (pg, &topology_cb, NULL); | ||
649 | } | ||
650 | GNUNET_SCHEDULER_add_delayed (sched, settle_time, &send_test_messages, test_messages); | ||
630 | #endif | 651 | #endif |
631 | #if VERBOSE | 652 | #if VERBOSE |
632 | fprintf(stdout, "Test message progress: ["); | 653 | fprintf(stdout, "Test message progress: ["); |
@@ -852,6 +873,7 @@ run (void *cls, | |||
852 | char * blacklist_topology_str; | 873 | char * blacklist_topology_str; |
853 | char * connect_topology_option_str; | 874 | char * connect_topology_option_str; |
854 | char * connect_topology_option_modifier_string; | 875 | char * connect_topology_option_modifier_string; |
876 | unsigned long long temp_settle; | ||
855 | sched = s; | 877 | sched = s; |
856 | ok = 1; | 878 | ok = 1; |
857 | 879 | ||
@@ -927,6 +949,11 @@ run (void *cls, | |||
927 | GNUNET_free_non_null(topology_str); | 949 | GNUNET_free_non_null(topology_str); |
928 | GNUNET_free_non_null(blacklist_topology_str); | 950 | GNUNET_free_non_null(blacklist_topology_str); |
929 | 951 | ||
952 | if (GNUNET_OK == | ||
953 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "settle_time", | ||
954 | &temp_settle)) | ||
955 | settle_time = GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, temp_settle); | ||
956 | |||
930 | if (GNUNET_SYSERR == | 957 | if (GNUNET_SYSERR == |
931 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", | 958 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", |
932 | &num_peers)) | 959 | &num_peers)) |