diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-08-05 14:26:28 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-08-05 14:26:28 +0000 |
commit | 8668628b998f2f40e8466d4d6d92faf1617abe08 (patch) | |
tree | 95629051cac46451e827ee073e606b6b0a2d60f0 /src | |
parent | c61d3be2409ff04f763fbd5729c959171fdf8ba7 (diff) | |
download | gnunet-8668628b998f2f40e8466d4d6d92faf1617abe08.tar.gz gnunet-8668628b998f2f40e8466d4d6d92faf1617abe08.zip |
add testbed
disable all connections in conf
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/Makefile.am | 7 | ||||
-rw-r--r-- | src/ats/perf_ats.c | 92 | ||||
-rw-r--r-- | src/ats/perf_ats_simplistic_bandwidth.conf | 9 | ||||
-rw-r--r-- | src/ats/perf_ats_simplistic_delay.conf | 8 |
4 files changed, 93 insertions, 23 deletions
diff --git a/src/ats/Makefile.am b/src/ats/Makefile.am index 40450d7f0..63593f7c0 100644 --- a/src/ats/Makefile.am +++ b/src/ats/Makefile.am | |||
@@ -252,14 +252,15 @@ perf_ats_simplistic_bandwidth_SOURCES = \ | |||
252 | perf_ats.c | 252 | perf_ats.c |
253 | perf_ats_simplistic_bandwidth_LDADD = \ | 253 | perf_ats_simplistic_bandwidth_LDADD = \ |
254 | $(top_builddir)/src/util/libgnunetutil.la \ | 254 | $(top_builddir)/src/util/libgnunetutil.la \ |
255 | $(top_builddir)/src/ats/libgnunetats.la | 255 | $(top_builddir)/src/ats/libgnunetats.la \ |
256 | $(top_builddir)/src/testbed/libgnunettestbed.la | ||
256 | 257 | ||
257 | perf_ats_simplistic_delay_SOURCES = \ | 258 | perf_ats_simplistic_delay_SOURCES = \ |
258 | perf_ats.c | 259 | perf_ats.c |
259 | perf_ats_simplistic_delay_LDADD = \ | 260 | perf_ats_simplistic_delay_LDADD = \ |
260 | $(top_builddir)/src/util/libgnunetutil.la \ | 261 | $(top_builddir)/src/util/libgnunetutil.la \ |
261 | $(top_builddir)/src/ats/libgnunetats.la | 262 | $(top_builddir)/src/ats/libgnunetats.la \ |
262 | 263 | $(top_builddir)/src/testbed/libgnunettestbed.la | |
263 | 264 | ||
264 | EXTRA_DIST = \ | 265 | EXTRA_DIST = \ |
265 | ats.h \ | 266 | ats.h \ |
diff --git a/src/ats/perf_ats.c b/src/ats/perf_ats.c index 5072c30a5..c131025bd 100644 --- a/src/ats/perf_ats.c +++ b/src/ats/perf_ats.c | |||
@@ -25,19 +25,71 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_testbed_service.h" | ||
28 | 29 | ||
30 | #define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) | ||
29 | #define TESTNAME_PREFIX "perf_ats_" | 31 | #define TESTNAME_PREFIX "perf_ats_" |
30 | 32 | ||
31 | static int ret; | 33 | |
34 | /** | ||
35 | * Shutdown task | ||
36 | */ | ||
37 | static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; | ||
38 | |||
39 | static int result; | ||
32 | static char *solver; | 40 | static char *solver; |
33 | static char *preference; | 41 | static char *preference; |
34 | 42 | ||
43 | /** | ||
44 | * Shutdown nicely | ||
45 | * | ||
46 | * @param cls NULL | ||
47 | * @param tc the task context | ||
48 | */ | ||
35 | static void | 49 | static void |
36 | check (void *cls, char *const *args, const char *cfgfile, | 50 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
37 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 51 | { |
52 | shutdown_task = GNUNET_SCHEDULER_NO_TASK; | ||
53 | |||
54 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Benchmarking done\n")); | ||
55 | |||
56 | |||
57 | GNUNET_SCHEDULER_shutdown(); | ||
58 | } | ||
59 | |||
60 | /** | ||
61 | * Controller event callback | ||
62 | * | ||
63 | * @param cls NULL | ||
64 | * @param event the controller event | ||
65 | */ | ||
66 | static void | ||
67 | controller_event_cb (void *cls, | ||
68 | const struct GNUNET_TESTBED_EventInformation *event) | ||
69 | { | ||
70 | |||
71 | } | ||
72 | |||
73 | /** | ||
74 | * Signature of a main function for a testcase. | ||
75 | * | ||
76 | * @param cls closure | ||
77 | * @param num_peers number of peers in 'peers' | ||
78 | * @param peers_ handle to peers run in the testbed | ||
79 | * @param links_succeeded the number of overlay link connection attempts that | ||
80 | * succeeded | ||
81 | * @param links_failed the number of overlay link connection attempts that | ||
82 | * failed | ||
83 | */ | ||
84 | static void | ||
85 | test_master (void *cls, unsigned int num_peers, | ||
86 | struct GNUNET_TESTBED_Peer **peers_, | ||
87 | unsigned int links_succeeded, | ||
88 | unsigned int links_failed) | ||
38 | { | 89 | { |
39 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Benchmarking solver `%s' on preference `%s'\n"), solver, preference); | 90 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Benchmarking solver `%s' on preference `%s'\n"), solver, preference); |
40 | ret = 0; | 91 | |
92 | shutdown_task = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, &do_shutdown, NULL); | ||
41 | } | 93 | } |
42 | 94 | ||
43 | 95 | ||
@@ -46,13 +98,10 @@ main (int argc, char *argv[]) | |||
46 | { | 98 | { |
47 | char *tmp; | 99 | char *tmp; |
48 | char *tmp_sep; | 100 | char *tmp_sep; |
101 | char *test_name; | ||
49 | char *conf_name; | 102 | char *conf_name; |
50 | 103 | ||
51 | ret = 1; | 104 | result = 1; |
52 | |||
53 | static struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
54 | GNUNET_GETOPT_OPTION_END | ||
55 | }; | ||
56 | 105 | ||
57 | /* figure out testname */ | 106 | /* figure out testname */ |
58 | tmp = strstr (argv[0], TESTNAME_PREFIX); | 107 | tmp = strstr (argv[0], TESTNAME_PREFIX); |
@@ -74,22 +123,25 @@ main (int argc, char *argv[]) | |||
74 | preference = GNUNET_strdup(tmp_sep + 1); | 123 | preference = GNUNET_strdup(tmp_sep + 1); |
75 | 124 | ||
76 | GNUNET_asprintf(&conf_name, "%s%s_%s.conf", TESTNAME_PREFIX, solver, preference); | 125 | GNUNET_asprintf(&conf_name, "%s%s_%s.conf", TESTNAME_PREFIX, solver, preference); |
77 | 126 | GNUNET_asprintf(&test_name, "%s%s_%s", TESTNAME_PREFIX, solver, preference); | |
78 | char *argv2[] = { "perf_ats", | 127 | |
79 | "-c", | 128 | /* Start topology */ |
80 | conf_name, | 129 | uint64_t event_mask; |
81 | "-L", "WARNING", | 130 | result = GNUNET_SYSERR; |
82 | NULL | 131 | event_mask = 0; |
83 | }; | 132 | event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); |
84 | GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, | 133 | event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); |
85 | "perf_ats", "nohelp", options, | 134 | (void) GNUNET_TESTBED_test_run (test_name, |
86 | &check, NULL); | 135 | conf_name, 5, |
136 | event_mask, &controller_event_cb, NULL, | ||
137 | &test_master, NULL); | ||
87 | 138 | ||
88 | GNUNET_free (solver); | 139 | GNUNET_free (solver); |
89 | GNUNET_free (preference); | 140 | GNUNET_free (preference); |
90 | GNUNET_free (conf_name); | 141 | GNUNET_free (conf_name); |
142 | GNUNET_free (test_name); | ||
91 | 143 | ||
92 | return ret; | 144 | return result; |
93 | } | 145 | } |
94 | 146 | ||
95 | /* end of file perf_ats.c */ | 147 | /* end of file perf_ats.c */ |
diff --git a/src/ats/perf_ats_simplistic_bandwidth.conf b/src/ats/perf_ats_simplistic_bandwidth.conf index e69de29bb..4d13e5444 100644 --- a/src/ats/perf_ats_simplistic_bandwidth.conf +++ b/src/ats/perf_ats_simplistic_bandwidth.conf | |||
@@ -0,0 +1,9 @@ | |||
1 | [hostlist] | ||
2 | SERVERS = | ||
3 | |||
4 | [transport-udp] | ||
5 | BROADCAST = NO | ||
6 | |||
7 | [peerinfo] | ||
8 | USE_INCLUDED_HELLOS = NO | ||
9 | |||
diff --git a/src/ats/perf_ats_simplistic_delay.conf b/src/ats/perf_ats_simplistic_delay.conf index e69de29bb..a5127d25f 100644 --- a/src/ats/perf_ats_simplistic_delay.conf +++ b/src/ats/perf_ats_simplistic_delay.conf | |||
@@ -0,0 +1,8 @@ | |||
1 | [hostlist] | ||
2 | SERVERS = | ||
3 | |||
4 | [transport-udp] | ||
5 | BROADCAST = NO | ||
6 | |||
7 | [peerinfo] | ||
8 | USE_INCLUDED_HELLOS = NO | ||