diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-07-19 11:59:34 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-07-19 11:59:34 +0000 |
commit | 50e7453045035b43f2a412e21f0cca2a5fd62b84 (patch) | |
tree | fd959ec45be58eae675437b1ed6eb97c6e328b68 /src | |
parent | 0e688ba4f7430b63acdac289077e406480498297 (diff) | |
download | gnunet-50e7453045035b43f2a412e21f0cca2a5fd62b84.tar.gz gnunet-50e7453045035b43f2a412e21f0cca2a5fd62b84.zip |
run glpk code and tests only if gplk installed, fewer ifdefs
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/Makefile.am | 28 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_ats.h | 4 | ||||
-rw-r--r-- | src/transport/perf_transport_ats.c | 40 | ||||
-rw-r--r-- | src/transport/test_transport_ats.c | 128 | ||||
-rw-r--r-- | src/transport/test_transport_ats_multiple_peers.c | 12 |
5 files changed, 82 insertions, 130 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 51f8447ee..4121206c7 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -21,6 +21,14 @@ endif | |||
21 | 21 | ||
22 | if HAVE_LIBGLPK | 22 | if HAVE_LIBGLPK |
23 | TRANSPORT_ATS_SRC = gnunet-service-transport_ats.c | 23 | TRANSPORT_ATS_SRC = gnunet-service-transport_ats.c |
24 | TEST_TRANSPORT_ATS = \ | ||
25 | test_transport_ats \ | ||
26 | test_transport_ats_multiple_peers | ||
27 | GN_GLPK = -lglpk | ||
28 | if HAVE_BENCHMARKS | ||
29 | ATS_TRANSPORT_BENCHMARKS = \ | ||
30 | perf_transport_ats | ||
31 | endif | ||
24 | endif | 32 | endif |
25 | 33 | ||
26 | if USE_COVERAGE | 34 | if USE_COVERAGE |
@@ -139,10 +147,6 @@ gnunet_transport_LDADD = \ | |||
139 | gnunet_transport_DEPENDENCIES = \ | 147 | gnunet_transport_DEPENDENCIES = \ |
140 | libgnunettransportnew.la | 148 | libgnunettransportnew.la |
141 | 149 | ||
142 | if HAVE_LIBGLPK | ||
143 | GN_GLPK = -lglpk | ||
144 | endif | ||
145 | |||
146 | gnunet_service_transport_SOURCES = \ | 150 | gnunet_service_transport_SOURCES = \ |
147 | gnunet-service-transport.c $(TRANSPORT_ATS_SRC) | 151 | gnunet-service-transport.c $(TRANSPORT_ATS_SRC) |
148 | gnunet_service_transport_LDADD = \ | 152 | gnunet_service_transport_LDADD = \ |
@@ -246,15 +250,10 @@ libgnunet_plugin_transport_https_la_CFLAGS = \ | |||
246 | libgnunet_plugin_transport_https_la_CPPFLAGS = \ | 250 | libgnunet_plugin_transport_https_la_CPPFLAGS = \ |
247 | @LIBCURL_CPPFLAGS@ | 251 | @LIBCURL_CPPFLAGS@ |
248 | 252 | ||
249 | if HAVE_BENCHMARKS | ||
250 | TRANSPORT_BENCHMARKS = \ | ||
251 | perf_transport_ats | ||
252 | endif | ||
253 | 253 | ||
254 | check_PROGRAMS = \ | 254 | check_PROGRAMS = \ |
255 | test_transport_ats \ | 255 | $(TEST_TRANSPORT_ATS) \ |
256 | test_transport_ats_multiple_peers \ | 256 | $(ATS_TRANSPORT_BENCHMARKS) \ |
257 | $(TRANSPORT_BENCHMARKS) \ | ||
258 | test_transport_api_tcp \ | 257 | test_transport_api_tcp \ |
259 | test_transport_api_tcp_nat \ | 258 | test_transport_api_tcp_nat \ |
260 | test_transport_api_udp \ | 259 | test_transport_api_udp \ |
@@ -285,8 +284,7 @@ check_PROGRAMS = \ | |||
285 | 284 | ||
286 | if ENABLE_TEST_RUN | 285 | if ENABLE_TEST_RUN |
287 | TESTS = \ | 286 | TESTS = \ |
288 | test_transport_ats \ | 287 | $(TEST_TRANSPORT_ATS) \ |
289 | test_transport_ats_multiple_peers \ | ||
290 | perf_transport_ats \ | 288 | perf_transport_ats \ |
291 | test_transport_api_tcp \ | 289 | test_transport_api_tcp \ |
292 | test_transport_api_tcp_nat \ | 290 | test_transport_api_tcp_nat \ |
@@ -327,7 +325,7 @@ test_transport_ats_LDADD = -lm \ | |||
327 | $(GN_GLPK) | 325 | $(GN_GLPK) |
328 | 326 | ||
329 | test_transport_ats_multiple_peers_SOURCES = \ | 327 | test_transport_ats_multiple_peers_SOURCES = \ |
330 | test_transport_ats_multiple_peers.c | 328 | test_transport_ats_multiple_peers.c $(TRANSPORT_ATS_SRC) |
331 | test_transport_ats_multiple_peers_LDADD = -lm \ | 329 | test_transport_ats_multiple_peers_LDADD = -lm \ |
332 | $(top_builddir)/src/transport/libgnunettransportnew.la \ | 330 | $(top_builddir)/src/transport/libgnunettransportnew.la \ |
333 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 331 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
@@ -337,7 +335,7 @@ test_transport_ats_multiple_peers_LDADD = -lm \ | |||
337 | perf_transport_ats_SOURCES = \ | 335 | perf_transport_ats_SOURCES = \ |
338 | perf_transport_ats.c | 336 | perf_transport_ats.c |
339 | perf_transport_ats_LDADD = \ | 337 | perf_transport_ats_LDADD = \ |
340 | $(GN_GLPK) \ | 338 | -lglpk \ |
341 | $(top_builddir)/src/util/libgnunetutil.la | 339 | $(top_builddir)/src/util/libgnunetutil.la |
342 | 340 | ||
343 | test_transport_api_tcp_SOURCES = \ | 341 | test_transport_api_tcp_SOURCES = \ |
diff --git a/src/transport/gnunet-service-transport_ats.h b/src/transport/gnunet-service-transport_ats.h index 997014e7a..0e4427dc6 100644 --- a/src/transport/gnunet-service-transport_ats.h +++ b/src/transport/gnunet-service-transport_ats.h | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file transport/transport_ats.h | 22 | * @file transport/gnunet-service-transport_ats.h |
23 | * @brief common internal definitions for transport service's ats code | 23 | * @brief common internal definitions for transport service's ats code |
24 | * @author Matthias Wachs | 24 | * @author Matthias Wachs |
25 | */ | 25 | */ |
@@ -512,4 +512,4 @@ ats_set_logging_options (struct ATS_Handle * ats, | |||
512 | int log_problem); | 512 | int log_problem); |
513 | 513 | ||
514 | #endif | 514 | #endif |
515 | /* end of file transport_ats.h */ | 515 | /* end of file gnunet-service-transport_ats.h */ |
diff --git a/src/transport/perf_transport_ats.c b/src/transport/perf_transport_ats.c index 59e276d09..3f8950a8a 100644 --- a/src/transport/perf_transport_ats.c +++ b/src/transport/perf_transport_ats.c | |||
@@ -18,15 +18,13 @@ | |||
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file testing/per_transport_ats.c | 21 | * @file transport/perf_transport_ats.c |
22 | * @brief testcase for ats functionality | 22 | * @brief testcase for ats functionality |
23 | */ | 23 | */ |
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_time_lib.h" | 25 | #include "gnunet_time_lib.h" |
26 | #include "gauger.h" | 26 | #include "gauger.h" |
27 | #if HAVE_LIBGLPK | ||
28 | #include <glpk.h> | 27 | #include <glpk.h> |
29 | #endif | ||
30 | 28 | ||
31 | #define VERBOSE GNUNET_NO | 29 | #define VERBOSE GNUNET_NO |
32 | 30 | ||
@@ -34,7 +32,6 @@ | |||
34 | 32 | ||
35 | static int ret = 0; | 33 | static int ret = 0; |
36 | 34 | ||
37 | #if HAVE_LIBGLPK | ||
38 | static int executions = EXECS; | 35 | static int executions = EXECS; |
39 | static uint64_t exec_time[EXECS]; | 36 | static uint64_t exec_time[EXECS]; |
40 | 37 | ||
@@ -48,7 +45,8 @@ static glp_prob * prob; | |||
48 | static struct GNUNET_TIME_Absolute start; | 45 | static struct GNUNET_TIME_Absolute start; |
49 | static struct GNUNET_TIME_Absolute end; | 46 | static struct GNUNET_TIME_Absolute end; |
50 | 47 | ||
51 | void solve_mlp(int presolve) | 48 | static void |
49 | solve_mlp(int presolve) | ||
52 | { | 50 | { |
53 | int result, solution; | 51 | int result, solution; |
54 | glp_iocp opt_mlp; | 52 | glp_iocp opt_mlp; |
@@ -62,7 +60,8 @@ void solve_mlp(int presolve) | |||
62 | GNUNET_assert ((solution == 5) && (result==0)); | 60 | GNUNET_assert ((solution == 5) && (result==0)); |
63 | } | 61 | } |
64 | 62 | ||
65 | void solve_lp(int presolve) | 63 | static void |
64 | solve_lp(int presolve) | ||
66 | { | 65 | { |
67 | int result; | 66 | int result; |
68 | int solution; | 67 | int solution; |
@@ -79,8 +78,10 @@ void solve_lp(int presolve) | |||
79 | GNUNET_assert ((solution == 5) && (result==0)); | 78 | GNUNET_assert ((solution == 5) && (result==0)); |
80 | } | 79 | } |
81 | 80 | ||
81 | #if 0 | ||
82 | /* Modify quality constraint */ | 82 | /* Modify quality constraint */ |
83 | void modify_qm(int start, int length, int values_to_change) | 83 | static void |
84 | modify_qm(int start, int length, int values_to_change) | ||
84 | { | 85 | { |
85 | //int * ind = GNUNET_malloc (length * sizeof (int)); | 86 | //int * ind = GNUNET_malloc (length * sizeof (int)); |
86 | //double *val = GNUNET_malloc (length * sizeof (double)); | 87 | //double *val = GNUNET_malloc (length * sizeof (double)); |
@@ -102,10 +103,12 @@ void modify_qm(int start, int length, int values_to_change) | |||
102 | } | 103 | } |
103 | //glp_set_mat_row(prob, start, length, ind, val); | 104 | //glp_set_mat_row(prob, start, length, ind, val); |
104 | } | 105 | } |
106 | #endif | ||
105 | 107 | ||
106 | 108 | ||
107 | 109 | ||
108 | void bench_simplex_optimization(char * file, int executions) | 110 | static void |
111 | bench_simplex_optimization(char * file, int executions) | ||
109 | { | 112 | { |
110 | int c; | 113 | int c; |
111 | int res; | 114 | int res; |
@@ -139,7 +142,8 @@ void bench_simplex_optimization(char * file, int executions) | |||
139 | } | 142 | } |
140 | 143 | ||
141 | 144 | ||
142 | void bench_simplex_no_optimization(char * file, int executions) | 145 | static void |
146 | bench_simplex_no_optimization(char * file, int executions) | ||
143 | { | 147 | { |
144 | int c; | 148 | int c; |
145 | int res; | 149 | int res; |
@@ -171,7 +175,8 @@ void bench_simplex_no_optimization(char * file, int executions) | |||
171 | glp_delete_prob(prob); | 175 | glp_delete_prob(prob); |
172 | } | 176 | } |
173 | 177 | ||
174 | void bench_mlp_no_optimization(char * file, int executions) | 178 | static void |
179 | bench_mlp_no_optimization(char * file, int executions) | ||
175 | { | 180 | { |
176 | int c; | 181 | int c; |
177 | int res; | 182 | int res; |
@@ -204,7 +209,8 @@ void bench_mlp_no_optimization(char * file, int executions) | |||
204 | } | 209 | } |
205 | 210 | ||
206 | 211 | ||
207 | void bench_mlp_with_optimization(char * file, int executions, int changes) | 212 | static void |
213 | bench_mlp_with_optimization(char * file, int executions, int changes) | ||
208 | { | 214 | { |
209 | int c; | 215 | int c; |
210 | int res; | 216 | int res; |
@@ -264,7 +270,7 @@ void modify_cr (int start, int length, int count) | |||
264 | //glp_set_mat_row(prob, start, length, ind, val); | 270 | //glp_set_mat_row(prob, start, length, ind, val); |
265 | } | 271 | } |
266 | #endif | 272 | #endif |
267 | #endif | 273 | |
268 | 274 | ||
269 | int main (int argc, char *argv[]) | 275 | int main (int argc, char *argv[]) |
270 | { | 276 | { |
@@ -276,12 +282,6 @@ int main (int argc, char *argv[]) | |||
276 | "INFO", | 282 | "INFO", |
277 | #endif | 283 | #endif |
278 | NULL); | 284 | NULL); |
279 | |||
280 | #if !HAVE_LIBGLPK | ||
281 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "GLPK not installed, exiting testcase\n"); | ||
282 | return 0; | ||
283 | #else | ||
284 | |||
285 | int nullfd = OPEN ("/dev/null", O_RDWR | O_APPEND); | 285 | int nullfd = OPEN ("/dev/null", O_RDWR | O_APPEND); |
286 | if (nullfd < 0) | 286 | if (nullfd < 0) |
287 | return GNUNET_SYSERR; | 287 | return GNUNET_SYSERR; |
@@ -330,10 +330,8 @@ int main (int argc, char *argv[]) | |||
330 | "GLPK MLP 100 peers 400 addresses with optimization", | 330 | "GLPK MLP 100 peers 400 addresses with optimization", |
331 | ((double) mlp_with_opt_avg / EXECS) / 400, "ms/address"); | 331 | ((double) mlp_with_opt_avg / EXECS) / 400, "ms/address"); |
332 | (void) CLOSE (nullfd); | 332 | (void) CLOSE (nullfd); |
333 | |||
334 | #endif | ||
335 | return ret; | 333 | return ret; |
336 | } | 334 | } |
337 | 335 | ||
338 | /* end of per_transport_ats.c*/ | 336 | /* end of perf_transport_ats.c*/ |
339 | 337 | ||
diff --git a/src/transport/test_transport_ats.c b/src/transport/test_transport_ats.c index 57110d5e5..fe8b6e87b 100644 --- a/src/transport/test_transport_ats.c +++ b/src/transport/test_transport_ats.c | |||
@@ -29,9 +29,14 @@ | |||
29 | #define VERBOSE GNUNET_YES | 29 | #define VERBOSE GNUNET_YES |
30 | 30 | ||
31 | static struct ATS_Handle * ats; | 31 | static struct ATS_Handle * ats; |
32 | |||
32 | static struct GNUNET_CONFIGURATION_Handle * cfg; | 33 | static struct GNUNET_CONFIGURATION_Handle * cfg; |
33 | 34 | ||
34 | void ats_result_cb () | 35 | static struct TransportConfiguration *tc; |
36 | |||
37 | |||
38 | static void | ||
39 | ats_result_cb () | ||
35 | { | 40 | { |
36 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 41 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
37 | "ATS Result callback\n"); | 42 | "ATS Result callback\n"); |
@@ -49,40 +54,11 @@ struct TransportConfiguration | |||
49 | struct ATS_mechanism * m_tail; | 54 | struct ATS_mechanism * m_tail; |
50 | }; | 55 | }; |
51 | 56 | ||
52 | struct TransportConfiguration *tc; | ||
53 | |||
54 | /* | ||
55 | void create_topology (int c_peers, int c_mechanisms) | ||
56 | { | ||
57 | int c; | ||
58 | peers = GNUNET_malloc ( c_peers * sizeof (struct ATS_peer)); | ||
59 | for (c=0 ; c<c_peers; c++) | ||
60 | { | ||
61 | peers[c].f = 1.0 / c_peers; | ||
62 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &peers[c].peer.hashPubKey); | ||
63 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peer %s \n", GNUNET_i2s (&peers[c].peer)); | ||
64 | peers[c].m_head = NULL; | ||
65 | peers[c].m_tail = NULL; | ||
66 | } | ||
67 | mechanisms = GNUNET_malloc ( c_mechanisms * sizeof (struct ATS_mechanism)); | ||
68 | for (c=0 ; c<c_mechanisms; c++) | ||
69 | { | ||
70 | mechanisms[c].peer = &peers[c]; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | |||
75 | void delete_topology (void) | ||
76 | { | ||
77 | GNUNET_free (peers); | ||
78 | GNUNET_free (mechanisms); | ||
79 | }*/ | ||
80 | |||
81 | |||
82 | void create_ats_information (struct ATS_peer **p, int * c_p, | ||
83 | struct ATS_mechanism ** m, int * c_m) | ||
84 | { | ||
85 | 57 | ||
58 | static void | ||
59 | create_ats_information (struct ATS_peer **p, int * c_p, | ||
60 | struct ATS_mechanism ** m, int * c_m) | ||
61 | { | ||
86 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 62 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
87 | "ATS needs addresses\n"); | 63 | "ATS needs addresses\n"); |
88 | 64 | ||
@@ -90,28 +66,27 @@ void create_ats_information (struct ATS_peer **p, int * c_p, | |||
90 | (*c_p) = tc->mechanisms; | 66 | (*c_p) = tc->mechanisms; |
91 | (*m) = tc->m_head; | 67 | (*m) = tc->m_head; |
92 | (*c_m) = tc->mechanisms; | 68 | (*c_m) = tc->mechanisms; |
93 | |||
94 | } | 69 | } |
95 | 70 | ||
96 | int run_ats (void) | 71 | |
72 | static | ||
73 | int run_ats () | ||
97 | { | 74 | { |
98 | int ret = 0; | 75 | int ret = 0; |
99 | #if HAVE_LIBGLPK | ||
100 | ats_calculate_bandwidth_distribution (ats); | 76 | ats_calculate_bandwidth_distribution (ats); |
101 | #endif | ||
102 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 77 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
103 | "Running ATS: %s \n", (ret==0)? "SUCCESSFUL": "FAILED"); | 78 | "Running ATS: %s \n", (ret==0)? "SUCCESSFUL": "FAILED"); |
104 | return ret; | 79 | return ret; |
105 | } | 80 | } |
106 | 81 | ||
107 | int init_ats (void) | 82 | |
83 | static int | ||
84 | init_ats () | ||
108 | { | 85 | { |
109 | int ret = 0; | 86 | int ret = 0; |
110 | #if HAVE_LIBGLPK | ||
111 | ats = ats_init(1.0, 1.0, 1.0, 50000, 5, 10, ATS_MAX_EXEC_DURATION, | 87 | ats = ats_init(1.0, 1.0, 1.0, 50000, 5, 10, ATS_MAX_EXEC_DURATION, |
112 | create_ats_information, | 88 | create_ats_information, |
113 | ats_result_cb); | 89 | ats_result_cb); |
114 | #endif | ||
115 | //GNUNET_assert (ats != NULL); | 90 | //GNUNET_assert (ats != NULL); |
116 | 91 | ||
117 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 92 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -120,49 +95,56 @@ int init_ats (void) | |||
120 | } | 95 | } |
121 | 96 | ||
122 | 97 | ||
123 | int shutdown_ats (void) | 98 | static int |
99 | shutdown_ats () | ||
124 | { | 100 | { |
125 | int ret = 0; | 101 | int ret = 0; |
126 | #if HAVE_LIBGLPK | ||
127 | ats_delete_problem (ats); | 102 | ats_delete_problem (ats); |
128 | ats_shutdown (ats); | 103 | ats_shutdown (ats); |
129 | #endif | ||
130 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 104 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
131 | "Shutdown ATS: %s \n", (ret==0)? "SUCCESSFUL": "FAILED"); | 105 | "Shutdown ATS: %s \n", (ret==0)? "SUCCESSFUL": "FAILED"); |
132 | return ret; | 106 | return ret; |
133 | } | 107 | } |
134 | 108 | ||
109 | |||
135 | /* To make compiler happy */ | 110 | /* To make compiler happy */ |
136 | void dummy(void) | 111 | void |
112 | dummy() | ||
137 | { | 113 | { |
138 | struct ATS_quality_metric * q = qm; | 114 | struct ATS_quality_metric * q = qm; |
139 | q = NULL; | 115 | q = NULL; |
140 | struct ATS_ressource * r = ressources; | 116 | struct ATS_ressource * r = ressources; |
141 | r = NULL; | 117 | r = NULL; |
118 | q++; | ||
119 | r++; | ||
142 | } | 120 | } |
143 | 121 | ||
144 | void iterate_peer_values (void *cls, | 122 | |
145 | const char *section, | 123 | static void |
146 | const char *option, | 124 | iterate_peer_values (void *cls, |
147 | const char *value) | 125 | const char *section, |
126 | const char *option, | ||
127 | const char *value) | ||
148 | { | 128 | { |
149 | if (strcmp (option, "f") == 0) | 129 | if (strcmp (option, "f") == 0) |
150 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 130 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
151 | "\t %s %s\n", option, value); | 131 | "\t %s %s\n", option, value); |
152 | } | 132 | } |
153 | 133 | ||
154 | void iterate_mech_values (void *cls, | 134 | static void |
155 | const char *section, | 135 | iterate_mech_values (void *cls, |
156 | const char *option, | 136 | const char *section, |
157 | const char *value) | 137 | const char *option, |
138 | const char *value) | ||
158 | { | 139 | { |
159 | if (strcmp (option, "f") == 0) | 140 | if (strcmp (option, "f") == 0) |
160 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 141 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
161 | "\t %s %s\n", option, value); | 142 | "\t %s %s\n", option, value); |
162 | } | 143 | } |
163 | 144 | ||
164 | void iterate_sections (void *cls, | 145 | static void |
165 | const char *section) | 146 | iterate_sections (void *cls, |
147 | const char *section) | ||
166 | { | 148 | { |
167 | struct TransportConfiguration * tc = cls; | 149 | struct TransportConfiguration * tc = cls; |
168 | /* Peer definition */ | 150 | /* Peer definition */ |
@@ -183,22 +165,22 @@ void iterate_sections (void *cls, | |||
183 | } | 165 | } |
184 | } | 166 | } |
185 | 167 | ||
186 | void destroy_transport_configuration (char * filename) | ||
187 | { | ||
188 | GNUNET_CONFIGURATION_destroy (cfg); | ||
189 | 168 | ||
190 | } | 169 | static struct TransportConfiguration * |
191 | 170 | load_transport_configuration (char * filename) | |
192 | struct TransportConfiguration * load_transport_configuration (char * filename) | ||
193 | { | 171 | { |
194 | struct TransportConfiguration * ret = GNUNET_malloc(sizeof (struct TransportConfiguration)); | 172 | struct TransportConfiguration * ret = GNUNET_malloc(sizeof (struct TransportConfiguration)); |
195 | cfg = GNUNET_CONFIGURATION_create(); | ||
196 | GNUNET_CONFIGURATION_load(cfg, filename); | ||
197 | GNUNET_CONFIGURATION_iterate_sections(cfg, iterate_sections, ret); | ||
198 | 173 | ||
174 | cfg = GNUNET_CONFIGURATION_create(); | ||
175 | GNUNET_assert (GNUNET_OK == | ||
176 | GNUNET_CONFIGURATION_load(cfg, filename)); | ||
177 | GNUNET_CONFIGURATION_iterate_sections (cfg, iterate_sections, ret); | ||
178 | GNUNET_CONFIGURATION_destroy (cfg); | ||
179 | cfg = NULL; | ||
199 | return ret; | 180 | return ret; |
200 | } | 181 | } |
201 | 182 | ||
183 | |||
202 | int | 184 | int |
203 | main (int argc, char *argv[]) | 185 | main (int argc, char *argv[]) |
204 | { | 186 | { |
@@ -211,29 +193,11 @@ main (int argc, char *argv[]) | |||
211 | "INFO", | 193 | "INFO", |
212 | #endif | 194 | #endif |
213 | NULL); | 195 | NULL); |
214 | #if !HAVE_LIBGLPK | ||
215 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
216 | "HAVE_LIBGLPK not set, exiting testcase\n"); | ||
217 | #endif | ||
218 | |||
219 | #if !HAVE_LIBGLPK | ||
220 | return ret; | ||
221 | #endif | ||
222 | |||
223 | return 0; | ||
224 | |||
225 | tc = load_transport_configuration ("test.ats"); | 196 | tc = load_transport_configuration ("test.ats"); |
226 | |||
227 | return ret; | ||
228 | |||
229 | /* Testing */ | ||
230 | ats = NULL; | 197 | ats = NULL; |
231 | |||
232 | ret += init_ats (); | 198 | ret += init_ats (); |
233 | ret += run_ats (); | 199 | ret += run_ats (); |
234 | ret += shutdown_ats (); | 200 | ret += shutdown_ats (); |
235 | |||
236 | /* Shutdown */ | ||
237 | return ret; | 201 | return ret; |
238 | 202 | ||
239 | } | 203 | } |
diff --git a/src/transport/test_transport_ats_multiple_peers.c b/src/transport/test_transport_ats_multiple_peers.c index 3ba20455f..9d30a061d 100644 --- a/src/transport/test_transport_ats_multiple_peers.c +++ b/src/transport/test_transport_ats_multiple_peers.c | |||
@@ -25,8 +25,6 @@ | |||
25 | #include "platform.h" | 25 | #include "platform.h" |
26 | #include "gnunet_util_lib.h" | 26 | #include "gnunet_util_lib.h" |
27 | 27 | ||
28 | #if HAVE_LIBGLPK | ||
29 | |||
30 | #include "gnunet_testing_lib.h" | 28 | #include "gnunet_testing_lib.h" |
31 | #include "gnunet_transport_service.h" | 29 | #include "gnunet_transport_service.h" |
32 | #include "gauger.h" | 30 | #include "gauger.h" |
@@ -557,8 +555,10 @@ void dummy(void) | |||
557 | { | 555 | { |
558 | struct ATS_quality_metric * q = qm; | 556 | struct ATS_quality_metric * q = qm; |
559 | q = NULL; | 557 | q = NULL; |
558 | q++; | ||
560 | struct ATS_ressource * r = ressources; | 559 | struct ATS_ressource * r = ressources; |
561 | r = NULL; | 560 | r = NULL; |
561 | r++; | ||
562 | } | 562 | } |
563 | 563 | ||
564 | static size_t | 564 | static size_t |
@@ -789,8 +789,6 @@ check () | |||
789 | return ok; | 789 | return ok; |
790 | } | 790 | } |
791 | 791 | ||
792 | #endif | ||
793 | |||
794 | int | 792 | int |
795 | main (int argc, char *argv[]) | 793 | main (int argc, char *argv[]) |
796 | { | 794 | { |
@@ -804,11 +802,6 @@ main (int argc, char *argv[]) | |||
804 | #endif | 802 | #endif |
805 | NULL); | 803 | NULL); |
806 | 804 | ||
807 | #if !HAVE_LIBGLPK | ||
808 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
809 | "GLPK not installed, exiting testcase\n"); | ||
810 | return ret; | ||
811 | #else | ||
812 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing"); | 805 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing"); |
813 | machine_parsable = GNUNET_NO; | 806 | machine_parsable = GNUNET_NO; |
814 | peers = NUM_PEERS; | 807 | peers = NUM_PEERS; |
@@ -848,7 +841,6 @@ main (int argc, char *argv[]) | |||
848 | */ | 841 | */ |
849 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing"); | 842 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing"); |
850 | return ret; | 843 | return ret; |
851 | #endif | ||
852 | } | 844 | } |
853 | 845 | ||
854 | /* end of test_transport_ats_multiple_peers.c*/ | 846 | /* end of test_transport_ats_multiple_peers.c*/ |