diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-04-28 13:59:11 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-04-28 13:59:11 +0000 |
commit | 43365f0c4f03ffa75b5018e3a7899fc338b40b29 (patch) | |
tree | f0133659e1e95c1ee13d97ac5c8659ab5966823a /src/testing | |
parent | 2213e374c96c97d9682073e2c3e6ed5a6700d554 (diff) | |
download | gnunet-43365f0c4f03ffa75b5018e3a7899fc338b40b29.tar.gz gnunet-43365f0c4f03ffa75b5018e3a7899fc338b40b29.zip |
minor testing changes
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/Makefile.am | 24 | ||||
-rw-r--r-- | src/testing/test_testing_data_remote.conf | 33 | ||||
-rw-r--r-- | src/testing/test_testing_data_topology_small_world_ring.conf | 2 | ||||
-rw-r--r-- | src/testing/test_testing_group.c | 2 | ||||
-rw-r--r-- | src/testing/test_testing_group_remote.c | 139 | ||||
-rw-r--r-- | src/testing/test_testing_topology.c | 13 | ||||
-rw-r--r-- | src/testing/testing_group.c | 165 |
7 files changed, 288 insertions, 90 deletions
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index 1041dd901..2cfa330b3 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am | |||
@@ -25,28 +25,29 @@ check_PROGRAMS = \ | |||
25 | test_testing \ | 25 | test_testing \ |
26 | test_testing_connect \ | 26 | test_testing_connect \ |
27 | test_testing_group \ | 27 | test_testing_group \ |
28 | test_testing_topology_clique | 28 | test_testing_topology_clique |
29 | # test_testing_group_remote | 29 | # test_testing_group_remote \ |
30 | # test_testing_topology_ring \ | 30 | # test_testing_topology_ring \ |
31 | # test_testing_topology_2d_torus \ | 31 | # test_testing_topology_2d_torus \ |
32 | # test_testing_topology_small_world_ring \ | 32 | # test_testing_topology_small_world_ring \ |
33 | # test_testing_topology_small_world_torus \ | 33 | # test_testing_topology_small_world_torus \ |
34 | # test_testing_topology_erdos_renyi \ | 34 | # test_testing_topology_erdos_renyi \ |
35 | # test_testing_topology_internat | 35 | # test_testing_topology_internat \ |
36 | # test_testing_topology_scale_free | ||
36 | 37 | ||
37 | TESTS = \ | 38 | TESTS = \ |
38 | test_testing \ | 39 | test_testing \ |
39 | test_testing_connect \ | 40 | test_testing_connect \ |
40 | test_testing_group \ | 41 | test_testing_group \ |
41 | test_testing_topology_clique | 42 | test_testing_topology_clique |
42 | # test_testing_group_remote | 43 | # test_testing_group_remote \ |
43 | # test_testing_topology_ring \ | 44 | # test_testing_topology_ring \ |
44 | # test_testing_topology_2d_torus \ | 45 | # test_testing_topology_2d_torus \ |
45 | # test_testing_topology_small_world_ring \ | 46 | # test_testing_topology_small_world_ring \ |
46 | # test_testing_topology_small_world_torus \ | 47 | # test_testing_topology_small_world_torus \ |
47 | # test_testing_topology_erdos_renyi \ | 48 | # test_testing_topology_erdos_renyi \ |
48 | # test_testing_topology_internat | 49 | # test_testing_topology_internat \ |
49 | #$(check_PROGRAMS) | 50 | # test_testing_topology_scale_free |
50 | 51 | ||
51 | test_testing_SOURCES = \ | 52 | test_testing_SOURCES = \ |
52 | test_testing.c | 53 | test_testing.c |
@@ -114,6 +115,12 @@ test_testing_topology_clique_LDADD = \ | |||
114 | # $(top_builddir)/src/testing/libgnunettesting.la \ | 115 | # $(top_builddir)/src/testing/libgnunettesting.la \ |
115 | # $(top_builddir)/src/util/libgnunetutil.la | 116 | # $(top_builddir)/src/util/libgnunetutil.la |
116 | 117 | ||
118 | #test_testing_topology_scale_free_SOURCES = \ | ||
119 | # test_testing_topology.c | ||
120 | #test_testing_topology_scale_free_LDADD = \ | ||
121 | # $(top_builddir)/src/testing/libgnunettesting.la \ | ||
122 | # $(top_builddir)/src/util/libgnunetutil.la | ||
123 | |||
117 | 124 | ||
118 | EXTRA_DIST = \ | 125 | EXTRA_DIST = \ |
119 | test_testing_data.conf \ | 126 | test_testing_data.conf \ |
@@ -125,5 +132,6 @@ EXTRA_DIST = \ | |||
125 | test_testing_data_topology_small_world_ring.conf \ | 132 | test_testing_data_topology_small_world_ring.conf \ |
126 | test_testing_data_topology_small_world_torus.conf \ | 133 | test_testing_data_topology_small_world_torus.conf \ |
127 | test_testing_data_topology_erdos_renyi.conf \ | 134 | test_testing_data_topology_erdos_renyi.conf \ |
128 | test_testing_data_topology_internat.conf | 135 | test_testing_data_topology_internat.conf \ |
136 | test_testing_data_topology_scale_free.conf | ||
129 | 137 | ||
diff --git a/src/testing/test_testing_data_remote.conf b/src/testing/test_testing_data_remote.conf new file mode 100644 index 000000000..26de59a85 --- /dev/null +++ b/src/testing/test_testing_data_remote.conf | |||
@@ -0,0 +1,33 @@ | |||
1 | [PATHS] | ||
2 | SERVICEHOME = /tmp/test-gnunet-testing/ | ||
3 | DEFAULTCONFIG = test_testing_data.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 -x cmd --args | ||
12 | #PREFIX = valgrind --tool=memcheck --log-file=logs%p | ||
13 | |||
14 | [arm] | ||
15 | PORT = 2566 | ||
16 | DEFAULTSERVICES = peerinfo transport core | ||
17 | |||
18 | [statistics] | ||
19 | PORT = 2567 | ||
20 | |||
21 | [transport-tcp] | ||
22 | PORT = 2568 | ||
23 | |||
24 | [peerinfo] | ||
25 | PORT = 2569 | ||
26 | |||
27 | [core] | ||
28 | PORT = 2570 | ||
29 | |||
30 | [testing] | ||
31 | CONTROL_HOST = 131.159.20.42 | ||
32 | HOSTS = 127.0.0.1 | ||
33 | WEAKRANDOM = YES | ||
diff --git a/src/testing/test_testing_data_topology_small_world_ring.conf b/src/testing/test_testing_data_topology_small_world_ring.conf index f97723ff2..3883f1bee 100644 --- a/src/testing/test_testing_data_topology_small_world_ring.conf +++ b/src/testing/test_testing_data_topology_small_world_ring.conf | |||
@@ -30,7 +30,7 @@ PORT = 2570 | |||
30 | #DEBUG = YES | 30 | #DEBUG = YES |
31 | 31 | ||
32 | [testing] | 32 | [testing] |
33 | NUM_PEERS = 5 | 33 | NUM_PEERS = 25 |
34 | WEAKRANDOM = YES | 34 | WEAKRANDOM = YES |
35 | TOPOLOGY = 2 | 35 | TOPOLOGY = 2 |
36 | F2F = YES | 36 | F2F = YES |
diff --git a/src/testing/test_testing_group.c b/src/testing/test_testing_group.c index 61ef82449..d9d22dd02 100644 --- a/src/testing/test_testing_group.c +++ b/src/testing/test_testing_group.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_testing_lib.h" | 25 | #include "gnunet_testing_lib.h" |
26 | 26 | ||
27 | #define VERBOSE GNUNET_YES | 27 | #define VERBOSE GNUNET_NO |
28 | 28 | ||
29 | #define NUM_PEERS 4 | 29 | #define NUM_PEERS 4 |
30 | 30 | ||
diff --git a/src/testing/test_testing_group_remote.c b/src/testing/test_testing_group_remote.c new file mode 100644 index 000000000..c1bd2c8a6 --- /dev/null +++ b/src/testing/test_testing_group_remote.c | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @file testing/test_testing_group_remote.c | ||
22 | * @brief testcase for testing remote and local starting and connecting | ||
23 | * of hosts from the testing library. The test_testing_data_remote.conf | ||
24 | * file should be modified if this testcase is intended to be used. | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_testing_lib.h" | ||
28 | |||
29 | #define VERBOSE GNUNET_YES | ||
30 | |||
31 | |||
32 | /** | ||
33 | * How long until we give up on connecting the peers? | ||
34 | */ | ||
35 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) | ||
36 | |||
37 | #define DEFAULT_NUM_PEERS 8; | ||
38 | |||
39 | static int ok; | ||
40 | |||
41 | static int peers_left; | ||
42 | |||
43 | static struct GNUNET_TESTING_PeerGroup *pg; | ||
44 | |||
45 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
46 | |||
47 | static unsigned long long num_peers; | ||
48 | |||
49 | static char *hostnames; | ||
50 | |||
51 | |||
52 | static void | ||
53 | my_cb (void *cls, | ||
54 | const struct GNUNET_PeerIdentity *id, | ||
55 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
56 | struct GNUNET_TESTING_Daemon *d, const char *emsg) | ||
57 | { | ||
58 | GNUNET_assert (id != NULL); | ||
59 | peers_left--; | ||
60 | if (peers_left == 0) | ||
61 | { | ||
62 | GNUNET_TESTING_daemons_stop (pg); | ||
63 | ok = 0; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | |||
68 | static void | ||
69 | run (void *cls, | ||
70 | struct GNUNET_SCHEDULER_Handle *s, | ||
71 | char *const *args, | ||
72 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
73 | { | ||
74 | sched = s; | ||
75 | ok = 1; | ||
76 | #if VERBOSE | ||
77 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n"); | ||
78 | #endif | ||
79 | |||
80 | if (GNUNET_SYSERR == | ||
81 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", | ||
82 | &num_peers)) | ||
83 | num_peers = DEFAULT_NUM_PEERS; | ||
84 | |||
85 | GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "hosts", | ||
86 | &hostnames); | ||
87 | |||
88 | peers_left = num_peers; | ||
89 | pg = GNUNET_TESTING_daemons_start (sched, cfg, | ||
90 | peers_left, | ||
91 | &my_cb, NULL, NULL, NULL, hostnames); | ||
92 | GNUNET_assert (pg != NULL); | ||
93 | } | ||
94 | |||
95 | static int | ||
96 | check () | ||
97 | { | ||
98 | char *const argv[] = { "test-testing", | ||
99 | "-c", | ||
100 | "test_testing_data_remote.conf", | ||
101 | #if VERBOSE | ||
102 | "-L", "DEBUG", | ||
103 | #endif | ||
104 | NULL | ||
105 | }; | ||
106 | struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
107 | GNUNET_GETOPT_OPTION_END | ||
108 | }; | ||
109 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | ||
110 | argv, "test-testing-group", "nohelp", | ||
111 | options, &run, &ok); | ||
112 | return ok; | ||
113 | } | ||
114 | |||
115 | int | ||
116 | main (int argc, char *argv[]) | ||
117 | { | ||
118 | int ret; | ||
119 | |||
120 | GNUNET_log_setup ("test-testing-group", | ||
121 | #if VERBOSE | ||
122 | "DEBUG", | ||
123 | #else | ||
124 | "WARNING", | ||
125 | #endif | ||
126 | NULL); | ||
127 | ret = check (); | ||
128 | /** | ||
129 | * Still need to remove the base testing directory here, | ||
130 | * because group starts will create subdirectories under this | ||
131 | * main dir. However, we no longer need to sleep, as the | ||
132 | * shutdown sequence won't return until everything is cleaned | ||
133 | * up. | ||
134 | */ | ||
135 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing"); | ||
136 | return ret; | ||
137 | } | ||
138 | |||
139 | /* end of test_testing_group.c */ | ||
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index 2006cc468..446cd4dfb 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "gnunet_testing_lib.h" | 25 | #include "gnunet_testing_lib.h" |
26 | #include "gnunet_core_service.h" | 26 | #include "gnunet_core_service.h" |
27 | 27 | ||
28 | #define VERBOSE GNUNET_YES | 28 | #define VERBOSE GNUNET_NO |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * How long until we fail the whole testcase? | 31 | * How long until we fail the whole testcase? |
@@ -81,6 +81,8 @@ static int transmit_ready_failed; | |||
81 | 81 | ||
82 | static int transmit_ready_called; | 82 | static int transmit_ready_called; |
83 | 83 | ||
84 | static enum GNUNET_TESTING_Topology topology; | ||
85 | |||
84 | #define MTYPE 12345 | 86 | #define MTYPE 12345 |
85 | 87 | ||
86 | struct GNUNET_TestMessage | 88 | struct GNUNET_TestMessage |
@@ -518,7 +520,7 @@ create_topology () | |||
518 | maybe this way is best so that the client can know both | 520 | maybe this way is best so that the client can know both |
519 | when peers are started, and when they are connected. | 521 | when peers are started, and when they are connected. |
520 | */ | 522 | */ |
521 | expected_connections = GNUNET_TESTING_create_topology (pg); | 523 | expected_connections = GNUNET_TESTING_create_topology (pg, topology); |
522 | #if VERBOSE | 524 | #if VERBOSE |
523 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 525 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
524 | "Have %d expected connections\n", expected_connections); | 526 | "Have %d expected connections\n", expected_connections); |
@@ -575,6 +577,7 @@ run (void *cls, | |||
575 | char *const *args, | 577 | char *const *args, |
576 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | 578 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
577 | { | 579 | { |
580 | unsigned long long topology_num; | ||
578 | sched = s; | 581 | sched = s; |
579 | ok = 1; | 582 | ok = 1; |
580 | 583 | ||
@@ -588,6 +591,12 @@ run (void *cls, | |||
588 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 591 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
589 | "Starting daemons based on config file %s\n", cfgfile); | 592 | "Starting daemons based on config file %s\n", cfgfile); |
590 | #endif | 593 | #endif |
594 | |||
595 | if (GNUNET_YES == | ||
596 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "topology", | ||
597 | &topology_num)) | ||
598 | topology = topology_num; | ||
599 | |||
591 | if (GNUNET_SYSERR == | 600 | if (GNUNET_SYSERR == |
592 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", | 601 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", |
593 | &num_peers)) | 602 | &num_peers)) |
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 43ebd5e25..e617bc113 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "gnunet_arm_service.h" | 27 | #include "gnunet_arm_service.h" |
28 | #include "gnunet_testing_lib.h" | 28 | #include "gnunet_testing_lib.h" |
29 | 29 | ||
30 | #define VERBOSE_TESTING GNUNET_NO | 30 | #define VERBOSE_TESTING GNUNET_YES |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Lowest port used for GNUnet testing. Should be high enough to not | 33 | * Lowest port used for GNUnet testing. Should be high enough to not |
@@ -354,14 +354,28 @@ add_connections(struct GNUNET_TESTING_PeerGroup *pg, unsigned int first, unsigne | |||
354 | return added; | 354 | return added; |
355 | } | 355 | } |
356 | 356 | ||
357 | /** | ||
358 | * Scale free network construction as described in: | ||
359 | * | ||
360 | * "Emergence of Scaling in Random Networks." Science 286, 509-512, 1999. | ||
361 | * | ||
362 | * Start with a network of "one" peer, then progressively add | ||
363 | * peers up to the total number. At each step, iterate over | ||
364 | * all possible peers and connect new peer based on number of | ||
365 | * existing connections of the target peer. | ||
366 | * | ||
367 | * @param pg the peer group we are dealing with | ||
368 | * | ||
369 | * @return the number of connections created | ||
370 | */ | ||
357 | static int | 371 | static int |
358 | create_scale_free (struct GNUNET_TESTING_PeerGroup *pg) | 372 | create_scale_free (struct GNUNET_TESTING_PeerGroup *pg) |
359 | { | 373 | { |
360 | 374 | ||
361 | int total_connections; | 375 | unsigned int total_connections; |
362 | int outer_count; | 376 | unsigned int outer_count; |
363 | int i; | 377 | unsigned int i; |
364 | int previous_total_connections; | 378 | unsigned int previous_total_connections; |
365 | double random; | 379 | double random; |
366 | double probability; | 380 | double probability; |
367 | 381 | ||
@@ -370,14 +384,19 @@ create_scale_free (struct GNUNET_TESTING_PeerGroup *pg) | |||
370 | /* Add a connection between the first two nodes */ | 384 | /* Add a connection between the first two nodes */ |
371 | total_connections = add_connections(pg, 0, 1); | 385 | total_connections = add_connections(pg, 0, 1); |
372 | 386 | ||
373 | for (outer_count = 1; outer_count < pg->total - 1; outer_count++) | 387 | for (outer_count = 1; outer_count < pg->total; outer_count++) |
374 | { | 388 | { |
375 | previous_total_connections = total_connections; | 389 | previous_total_connections = total_connections; |
376 | for (i = 0; i < outer_count; i++) | 390 | for (i = 0; i < outer_count; i++) |
377 | { | 391 | { |
378 | probability = pg->peers[i].num_connections / previous_total_connections; | 392 | probability = pg->peers[i].num_connections / (double)previous_total_connections; |
379 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, | 393 | random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, |
380 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); | 394 | (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL); |
395 | #if VERBOSE_TESTING | ||
396 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
397 | "Considering connecting peer %d to peer %d\n", | ||
398 | outer_count, i); | ||
399 | #endif | ||
381 | if (random < probability) | 400 | if (random < probability) |
382 | { | 401 | { |
383 | #if VERBOSE_TESTING | 402 | #if VERBOSE_TESTING |
@@ -1099,109 +1118,99 @@ connect_topology (struct GNUNET_TESTING_PeerGroup *pg) | |||
1099 | * the connection actually happened. | 1118 | * the connection actually happened. |
1100 | * | 1119 | * |
1101 | * @param pg the peer group struct representing the running peers | 1120 | * @param pg the peer group struct representing the running peers |
1121 | * @param topology which topology to connect the peers in | ||
1102 | * | 1122 | * |
1103 | * @return the number of connections should be created by the topology, so the | 1123 | * @return the number of connections should be created by the topology, so the |
1104 | * caller knows how many to wait for (if it so chooses) | 1124 | * caller knows how many to wait for (if it so chooses) |
1105 | * | 1125 | * |
1106 | */ | 1126 | */ |
1107 | int | 1127 | int |
1108 | GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg) | 1128 | GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg, enum GNUNET_TESTING_Topology topology) |
1109 | { | 1129 | { |
1110 | unsigned long long topology_num; | ||
1111 | int ret; | 1130 | int ret; |
1112 | int num_connections; | 1131 | int num_connections; |
1113 | 1132 | ||
1114 | GNUNET_assert (pg->notify_connection != NULL); | 1133 | GNUNET_assert (pg->notify_connection != NULL); |
1115 | ret = GNUNET_OK; | 1134 | ret = GNUNET_OK; |
1116 | if (GNUNET_YES == | 1135 | |
1117 | GNUNET_CONFIGURATION_get_value_number (pg->cfg, "testing", "topology", | 1136 | switch (topology) |
1118 | &topology_num)) | ||
1119 | { | 1137 | { |
1120 | switch (topology_num) | 1138 | case GNUNET_TESTING_TOPOLOGY_CLIQUE: |
1121 | { | ||
1122 | case GNUNET_TESTING_TOPOLOGY_CLIQUE: | ||
1123 | #if VERBOSE_TESTING | 1139 | #if VERBOSE_TESTING |
1124 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1140 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1125 | _("Creating clique topology\n")); | 1141 | _("Creating clique topology\n")); |
1126 | #endif | 1142 | #endif |
1127 | num_connections = create_clique (pg); | 1143 | num_connections = create_clique (pg); |
1128 | break; | 1144 | break; |
1129 | case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING: | 1145 | case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING: |
1130 | #if VERBOSE_TESTING | 1146 | #if VERBOSE_TESTING |
1131 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1147 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1132 | _("Creating small world (ring) topology\n")); | 1148 | _("Creating small world (ring) topology\n")); |
1133 | #endif | ||
1134 | num_connections = create_small_world_ring (pg); | ||
1135 | break; | ||
1136 | case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD: | ||
1137 | #if VERBOSE_TESTING | ||
1138 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1139 | _("Creating small world (2d-torus) topology\n")); | ||
1140 | #endif | 1149 | #endif |
1141 | num_connections = create_small_world (pg); | 1150 | num_connections = create_small_world_ring (pg); |
1142 | break; | 1151 | break; |
1143 | case GNUNET_TESTING_TOPOLOGY_RING: | 1152 | case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD: |
1144 | #if VERBOSE_TESTING | 1153 | #if VERBOSE_TESTING |
1145 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1154 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1146 | _("Creating ring topology\n")); | 1155 | _("Creating small world (2d-torus) topology\n")); |
1147 | #endif | 1156 | #endif |
1148 | num_connections = create_ring (pg); | 1157 | num_connections = create_small_world (pg); |
1149 | break; | 1158 | break; |
1150 | case GNUNET_TESTING_TOPOLOGY_2D_TORUS: | 1159 | case GNUNET_TESTING_TOPOLOGY_RING: |
1151 | #if VERBOSE_TESTING | 1160 | #if VERBOSE_TESTING |
1152 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1161 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1153 | _("Creating 2d torus topology\n")); | 1162 | _("Creating ring topology\n")); |
1154 | #endif | 1163 | #endif |
1155 | num_connections = create_2d_torus (pg); | 1164 | num_connections = create_ring (pg); |
1156 | break; | 1165 | break; |
1157 | case GNUNET_TESTING_TOPOLOGY_ERDOS_RENYI: | 1166 | case GNUNET_TESTING_TOPOLOGY_2D_TORUS: |
1158 | #if VERBOSE_TESTING | 1167 | #if VERBOSE_TESTING |
1159 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1168 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1160 | _("Creating Erdos-Renyi topology\n")); | 1169 | _("Creating 2d torus topology\n")); |
1161 | #endif | 1170 | #endif |
1162 | num_connections = create_erdos_renyi (pg); | 1171 | num_connections = create_2d_torus (pg); |
1163 | break; | 1172 | break; |
1164 | case GNUNET_TESTING_TOPOLOGY_INTERNAT: | 1173 | case GNUNET_TESTING_TOPOLOGY_ERDOS_RENYI: |
1165 | #if VERBOSE_TESTING | 1174 | #if VERBOSE_TESTING |
1166 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1175 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1167 | _("Creating InterNAT topology\n")); | 1176 | _("Creating Erdos-Renyi topology\n")); |
1168 | #endif | 1177 | #endif |
1169 | num_connections = create_nated_internet (pg); | 1178 | num_connections = create_erdos_renyi (pg); |
1170 | break; | 1179 | break; |
1171 | case GNUNET_TESTING_TOPOLOGY_SCALE_FREE: | 1180 | case GNUNET_TESTING_TOPOLOGY_INTERNAT: |
1172 | #if VERBOSE_TESTING | 1181 | #if VERBOSE_TESTING |
1173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1182 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1174 | _("Creating Scale Free topology\n")); | 1183 | _("Creating InterNAT topology\n")); |
1175 | #endif | 1184 | #endif |
1176 | num_connections = create_scale_free (pg); | 1185 | num_connections = create_nated_internet (pg); |
1177 | break; | 1186 | break; |
1178 | case GNUNET_TESTING_TOPOLOGY_NONE: | 1187 | case GNUNET_TESTING_TOPOLOGY_SCALE_FREE: |
1179 | num_connections = 0; | ||
1180 | break; | ||
1181 | default: | ||
1182 | num_connections = 0; | ||
1183 | break; | ||
1184 | } | ||
1185 | if (num_connections < 1) | ||
1186 | return GNUNET_SYSERR; | ||
1187 | |||
1188 | if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (pg->cfg, "TESTING", "F2F")) | ||
1189 | ret = create_and_copy_friend_files(pg); | ||
1190 | if (ret == GNUNET_OK) | ||
1191 | connect_topology(pg); | ||
1192 | else | ||
1193 | { | ||
1194 | #if VERBOSE_TESTING | 1188 | #if VERBOSE_TESTING |
1195 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1189 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1196 | _("Failed during friend file copying!\n")); | 1190 | _("Creating Scale Free topology\n")); |
1197 | #endif | 1191 | #endif |
1198 | return GNUNET_SYSERR; | 1192 | num_connections = create_scale_free (pg); |
1199 | } | 1193 | break; |
1194 | case GNUNET_TESTING_TOPOLOGY_NONE: | ||
1195 | num_connections = 0; | ||
1196 | break; | ||
1197 | default: | ||
1198 | num_connections = 0; | ||
1199 | break; | ||
1200 | } | 1200 | } |
1201 | if (num_connections < 1) | ||
1202 | return GNUNET_SYSERR; | ||
1203 | |||
1204 | if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (pg->cfg, "TESTING", "F2F")) | ||
1205 | ret = create_and_copy_friend_files(pg); | ||
1206 | if (ret == GNUNET_OK) | ||
1207 | connect_topology(pg); | ||
1201 | else | 1208 | else |
1202 | { | 1209 | { |
1203 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1210 | #if VERBOSE_TESTING |
1204 | _("No topology specified, was one intended?\n")); | 1211 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1212 | _("Failed during friend file copying!\n")); | ||
1213 | #endif | ||
1205 | return GNUNET_SYSERR; | 1214 | return GNUNET_SYSERR; |
1206 | } | 1215 | } |
1207 | 1216 | ||