diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-09-03 14:25:22 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-09-03 14:25:22 +0000 |
commit | a6c88c59dfc11abe372b928bdf938cc19e4c8891 (patch) | |
tree | 3d58c3e78badfd1f5d603561460e7b2399357665 /src/gns | |
parent | 2bc5c276156904e9406076f557ed6455bcc53307 (diff) | |
download | gnunet-a6c88c59dfc11abe372b928bdf938cc19e4c8891.tar.gz gnunet-a6c88c59dfc11abe372b928bdf938cc19e4c8891.zip |
- next test
Diffstat (limited to 'src/gns')
-rw-r--r-- | src/gns/Makefile.am | 4 | ||||
-rw-r--r-- | src/gns/test_gns_pseu_shorten.c | 242 |
2 files changed, 81 insertions, 165 deletions
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am index 299b64fdc..59bd1191a 100644 --- a/src/gns/Makefile.am +++ b/src/gns/Makefile.am | |||
@@ -214,13 +214,13 @@ test_gns_pseu_shorten_LDADD = \ | |||
214 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ | 214 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ |
215 | $(top_builddir)/src/dht/libgnunetdht.la \ | 215 | $(top_builddir)/src/dht/libgnunetdht.la \ |
216 | $(top_builddir)/src/gns/libgnunetgns.la \ | 216 | $(top_builddir)/src/gns/libgnunetgns.la \ |
217 | $(top_builddir)/src/testing_old/libgnunettesting_old.la | 217 | $(top_builddir)/src/testing/libgnunettesting.la |
218 | test_gns_pseu_shorten_DEPENDENCIES = \ | 218 | test_gns_pseu_shorten_DEPENDENCIES = \ |
219 | $(top_builddir)/src/util/libgnunetutil.la \ | 219 | $(top_builddir)/src/util/libgnunetutil.la \ |
220 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ | 220 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ |
221 | $(top_builddir)/src/dht/libgnunetdht.la \ | 221 | $(top_builddir)/src/dht/libgnunetdht.la \ |
222 | $(top_builddir)/src/gns/libgnunetgns.la \ | 222 | $(top_builddir)/src/gns/libgnunetgns.la \ |
223 | $(top_builddir)/src/testing_old/libgnunettesting_old.la | 223 | $(top_builddir)/src/testing/libgnunettesting.la |
224 | 224 | ||
225 | 225 | ||
226 | test_gns_max_queries_SOURCES = \ | 226 | test_gns_max_queries_SOURCES = \ |
diff --git a/src/gns/test_gns_pseu_shorten.c b/src/gns/test_gns_pseu_shorten.c index f3a3c59a2..12e7adc2f 100644 --- a/src/gns/test_gns_pseu_shorten.c +++ b/src/gns/test_gns_pseu_shorten.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | #include "platform.h" | 25 | #include "platform.h" |
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib-new.h" |
27 | #include "gnunet_core_service.h" | 27 | #include "gnunet_core_service.h" |
28 | #include "block_gns.h" | 28 | #include "block_gns.h" |
29 | #include "gnunet_signatures.h" | 29 | #include "gnunet_signatures.h" |
@@ -63,18 +63,9 @@ | |||
63 | 63 | ||
64 | /* Globals */ | 64 | /* Globals */ |
65 | 65 | ||
66 | /** | ||
67 | * Directory to store temp data in, defined in config file | ||
68 | */ | ||
69 | static char *test_directory; | ||
70 | |||
71 | static struct GNUNET_TESTING_PeerGroup *pg; | ||
72 | |||
73 | /* Task handle to use to schedule test failure */ | 66 | /* Task handle to use to schedule test failure */ |
74 | static GNUNET_SCHEDULER_TaskIdentifier die_task; | 67 | static GNUNET_SCHEDULER_TaskIdentifier die_task; |
75 | 68 | ||
76 | static GNUNET_SCHEDULER_TaskIdentifier disco_task; | ||
77 | |||
78 | /* Global return value (0 for success, anything else for failure) */ | 69 | /* Global return value (0 for success, anything else for failure) */ |
79 | static int ok; | 70 | static int ok; |
80 | 71 | ||
@@ -102,36 +93,44 @@ struct GNUNET_CRYPTO_ShortHashCode our_zone; | |||
102 | struct GNUNET_CRYPTO_ShortHashCode priv_zone; | 93 | struct GNUNET_CRYPTO_ShortHashCode priv_zone; |
103 | struct GNUNET_CRYPTO_ShortHashCode short_zone; | 94 | struct GNUNET_CRYPTO_ShortHashCode short_zone; |
104 | 95 | ||
96 | |||
105 | /** | 97 | /** |
106 | * Check whether peers successfully shut down. | 98 | * Check if the get_handle is being used, if so stop the request. Either |
99 | * way, schedule the end_badly_cont function which actually shuts down the | ||
100 | * test. | ||
107 | */ | 101 | */ |
108 | void | 102 | static void |
109 | shutdown_callback (void *cls, const char *emsg) | 103 | end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
110 | { | 104 | { |
111 | if (disco_task != GNUNET_SCHEDULER_NO_TASK) | 105 | die_task = GNUNET_SCHEDULER_NO_TASK; |
106 | if (NULL != gns_handle) | ||
112 | { | 107 | { |
113 | disco_task = GNUNET_SCHEDULER_NO_TASK; | 108 | GNUNET_GNS_disconnect(gns_handle); |
114 | GNUNET_SCHEDULER_cancel(disco_task); | 109 | gns_handle = NULL; |
115 | GNUNET_DHT_disconnect(dht_handle); | ||
116 | dht_handle = NULL; | ||
117 | } | 110 | } |
118 | 111 | ||
119 | if (emsg != NULL) | 112 | if (NULL != namestore_handle) |
120 | { | 113 | { |
121 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error on shutdown! ret=%d\n", ok); | 114 | GNUNET_NAMESTORE_disconnect (namestore_handle); |
122 | if (ok == 0) | 115 | namestore_handle = NULL; |
123 | ok = 2; | ||
124 | } | 116 | } |
125 | 117 | ||
126 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "done(ret=%d)!\n", ok); | 118 | if (NULL != dht_handle) |
119 | { | ||
120 | GNUNET_DHT_disconnect (dht_handle); | ||
121 | dht_handle = NULL; | ||
122 | } | ||
123 | |||
124 | GNUNET_break (0); | ||
125 | GNUNET_SCHEDULER_shutdown (); | ||
126 | ok = 1; | ||
127 | } | 127 | } |
128 | 128 | ||
129 | static void | 129 | static void |
130 | disco_dht(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 130 | end_badly_now () |
131 | { | 131 | { |
132 | disco_task = GNUNET_SCHEDULER_NO_TASK; | 132 | GNUNET_SCHEDULER_cancel (die_task); |
133 | GNUNET_DHT_disconnect(dht_handle); | 133 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
134 | dht_handle = NULL; | ||
135 | } | 134 | } |
136 | 135 | ||
137 | /** | 136 | /** |
@@ -140,9 +139,24 @@ disco_dht(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
140 | static void | 139 | static void |
141 | process_shorten_result(void* cls, const char* sname) | 140 | process_shorten_result(void* cls, const char* sname) |
142 | { | 141 | { |
143 | GNUNET_GNS_disconnect(gns_handle); | 142 | |
144 | //GNUNET_SCHEDULER_add_now(disco_dht, NULL); | 143 | if (GNUNET_SCHEDULER_NO_TASK != die_task) |
145 | ok = 0; | 144 | { |
145 | GNUNET_SCHEDULER_cancel (die_task); | ||
146 | die_task = GNUNET_SCHEDULER_NO_TASK; | ||
147 | } | ||
148 | |||
149 | if (NULL != gns_handle) | ||
150 | { | ||
151 | GNUNET_GNS_disconnect(gns_handle); | ||
152 | gns_handle = NULL; | ||
153 | } | ||
154 | |||
155 | if (NULL != dht_handle) | ||
156 | { | ||
157 | GNUNET_DHT_disconnect (dht_handle); | ||
158 | dht_handle = NULL; | ||
159 | } | ||
146 | 160 | ||
147 | if (sname == NULL) | 161 | if (sname == NULL) |
148 | { | 162 | { |
@@ -164,21 +178,10 @@ process_shorten_result(void* cls, const char* sname) | |||
164 | 178 | ||
165 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shorten test succeeded!\n"); | 179 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shorten test succeeded!\n"); |
166 | } | 180 | } |
167 | 181 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer!\n"); | |
168 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer1!\n"); | 182 | GNUNET_SCHEDULER_shutdown (); |
169 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | ||
170 | } | 183 | } |
171 | 184 | ||
172 | static void | ||
173 | do_shorten(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
174 | { | ||
175 | GNUNET_GNS_shorten_zone (gns_handle, TEST_DOMAIN, | ||
176 | &priv_zone, | ||
177 | &short_zone, | ||
178 | &our_zone, | ||
179 | &process_shorten_result, | ||
180 | TEST_DOMAIN); | ||
181 | } | ||
182 | 185 | ||
183 | static void | 186 | static void |
184 | on_lookup_result(void *cls, uint32_t rd_count, | 187 | on_lookup_result(void *cls, uint32_t rd_count, |
@@ -219,8 +222,12 @@ on_lookup_result(void *cls, uint32_t rd_count, | |||
219 | } | 222 | } |
220 | } | 223 | } |
221 | } | 224 | } |
222 | 225 | GNUNET_GNS_shorten_zone (gns_handle, TEST_DOMAIN, | |
223 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &do_shorten, NULL); | 226 | &priv_zone, |
227 | &short_zone, | ||
228 | &our_zone, | ||
229 | &process_shorten_result, | ||
230 | TEST_DOMAIN); | ||
224 | } | 231 | } |
225 | 232 | ||
226 | 233 | ||
@@ -231,16 +238,15 @@ on_lookup_result(void *cls, uint32_t rd_count, | |||
231 | static void | 238 | static void |
232 | commence_testing (void *cls, int success) | 239 | commence_testing (void *cls, int success) |
233 | { | 240 | { |
234 | GNUNET_SCHEDULER_add_now(disco_dht, NULL); | ||
235 | //GNUNET_DHT_disconnect(dht_handle); | ||
236 | 241 | ||
237 | GNUNET_CRYPTO_rsa_key_free(our_key); | 242 | GNUNET_CRYPTO_rsa_key_free(our_key); |
238 | GNUNET_CRYPTO_rsa_key_free(bob_key); | 243 | GNUNET_CRYPTO_rsa_key_free(bob_key); |
239 | GNUNET_CRYPTO_rsa_key_free(alice_key); | 244 | GNUNET_CRYPTO_rsa_key_free(alice_key); |
240 | 245 | ||
241 | GNUNET_NAMESTORE_disconnect (namestore_handle); | 246 | GNUNET_NAMESTORE_disconnect (namestore_handle); |
242 | gns_handle = GNUNET_GNS_connect(cfg); | 247 | namestore_handle = NULL; |
243 | 248 | ||
249 | gns_handle = GNUNET_GNS_connect(cfg); | ||
244 | if (NULL == gns_handle) | 250 | if (NULL == gns_handle) |
245 | { | 251 | { |
246 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 252 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -255,28 +261,6 @@ commence_testing (void *cls, int success) | |||
255 | &on_lookup_result, TEST_DOMAIN); | 261 | &on_lookup_result, TEST_DOMAIN); |
256 | } | 262 | } |
257 | 263 | ||
258 | /** | ||
259 | * Continuation for the GNUNET_DHT_get_stop call, so that we don't shut | ||
260 | * down the peers without freeing memory associated with GET request. | ||
261 | */ | ||
262 | static void | ||
263 | end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
264 | { | ||
265 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failing test with error: `%s'!\n", | ||
266 | (char *) cls); | ||
267 | ok = 1; | ||
268 | |||
269 | if (disco_task != GNUNET_SCHEDULER_NO_TASK) | ||
270 | { | ||
271 | disco_task = GNUNET_SCHEDULER_NO_TASK; | ||
272 | GNUNET_SCHEDULER_cancel(disco_task); | ||
273 | GNUNET_DHT_disconnect(dht_handle); | ||
274 | dht_handle = NULL; | ||
275 | } | ||
276 | if (pg != NULL) | ||
277 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | ||
278 | GNUNET_SCHEDULER_cancel (die_task); | ||
279 | } | ||
280 | 264 | ||
281 | static void | 265 | static void |
282 | put_pseu_dht(void *cls, int success) | 266 | put_pseu_dht(void *cls, int success) |
@@ -330,14 +314,12 @@ put_pseu_dht(void *cls, int success) | |||
330 | { | 314 | { |
331 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n"); | 315 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n"); |
332 | ok = 3; | 316 | ok = 3; |
333 | GNUNET_DHT_disconnect(dht_handle); | ||
334 | |||
335 | |||
336 | GNUNET_CRYPTO_rsa_key_free(our_key); | 317 | GNUNET_CRYPTO_rsa_key_free(our_key); |
337 | GNUNET_CRYPTO_rsa_key_free(bob_key); | 318 | GNUNET_CRYPTO_rsa_key_free(bob_key); |
338 | GNUNET_CRYPTO_rsa_key_free(alice_key); | 319 | GNUNET_CRYPTO_rsa_key_free(alice_key); |
339 | GNUNET_free(sig); | 320 | GNUNET_free(sig); |
340 | GNUNET_free (nrb); | 321 | GNUNET_free (nrb); |
322 | end_badly_now (); | ||
341 | return; | 323 | return; |
342 | } | 324 | } |
343 | GNUNET_CRYPTO_short_hash("+", strlen("+"), &name_hash); | 325 | GNUNET_CRYPTO_short_hash("+", strlen("+"), &name_hash); |
@@ -419,13 +401,13 @@ put_www_dht(void *cls, int success) | |||
419 | { | 401 | { |
420 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n"); | 402 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n"); |
421 | ok = 3; | 403 | ok = 3; |
422 | GNUNET_DHT_disconnect(dht_handle); | ||
423 | |||
424 | GNUNET_CRYPTO_rsa_key_free(our_key); | 404 | GNUNET_CRYPTO_rsa_key_free(our_key); |
425 | GNUNET_CRYPTO_rsa_key_free(bob_key); | 405 | GNUNET_CRYPTO_rsa_key_free(bob_key); |
426 | GNUNET_CRYPTO_rsa_key_free(alice_key); | 406 | GNUNET_CRYPTO_rsa_key_free(alice_key); |
407 | GNUNET_free (sig); | ||
427 | GNUNET_free(web); | 408 | GNUNET_free(web); |
428 | GNUNET_free (nrb); | 409 | GNUNET_free (nrb); |
410 | end_badly_now(); | ||
429 | return; | 411 | return; |
430 | } | 412 | } |
431 | GNUNET_CRYPTO_short_hash(TEST_RECORD_NAME, strlen(TEST_RECORD_NAME), &name_hash); | 413 | GNUNET_CRYPTO_short_hash(TEST_RECORD_NAME, strlen(TEST_RECORD_NAME), &name_hash); |
@@ -449,8 +431,8 @@ put_www_dht(void *cls, int success) | |||
449 | DHT_OPERATION_TIMEOUT, | 431 | DHT_OPERATION_TIMEOUT, |
450 | &put_pseu_dht, | 432 | &put_pseu_dht, |
451 | NULL); | 433 | NULL); |
452 | 434 | GNUNET_free (sig); | |
453 | GNUNET_free(web); | 435 | GNUNET_free (web); |
454 | GNUNET_free (nrb); | 436 | GNUNET_free (nrb); |
455 | } | 437 | } |
456 | 438 | ||
@@ -500,11 +482,12 @@ put_pkey_dht(void *cls, int32_t success, const char *emsg) | |||
500 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n"); | 482 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n"); |
501 | ok = 3; | 483 | ok = 3; |
502 | 484 | ||
503 | GNUNET_CRYPTO_rsa_key_free(our_key); | 485 | GNUNET_CRYPTO_rsa_key_free (our_key); |
504 | GNUNET_CRYPTO_rsa_key_free(bob_key); | 486 | GNUNET_CRYPTO_rsa_key_free (bob_key); |
505 | GNUNET_CRYPTO_rsa_key_free(alice_key); | 487 | GNUNET_CRYPTO_rsa_key_free (alice_key); |
506 | GNUNET_free(sig); | 488 | GNUNET_free (sig); |
507 | GNUNET_free (nrb); | 489 | GNUNET_free (nrb); |
490 | end_badly_now (); | ||
508 | return; | 491 | return; |
509 | } | 492 | } |
510 | 493 | ||
@@ -530,6 +513,7 @@ put_pkey_dht(void *cls, int32_t success, const char *emsg) | |||
530 | DHT_OPERATION_TIMEOUT, | 513 | DHT_OPERATION_TIMEOUT, |
531 | &put_www_dht, | 514 | &put_www_dht, |
532 | NULL); | 515 | NULL); |
516 | GNUNET_free (sig); | ||
533 | GNUNET_free (nrb); | 517 | GNUNET_free (nrb); |
534 | } | 518 | } |
535 | 519 | ||
@@ -572,25 +556,23 @@ cont_init_zone (void *cls, int32_t success, const char *emsg) | |||
572 | } | 556 | } |
573 | 557 | ||
574 | static void | 558 | static void |
575 | do_lookup (void *cls, const struct GNUNET_PeerIdentity *id, | 559 | do_check (void *cls, |
576 | const struct GNUNET_CONFIGURATION_Handle *_cfg, | 560 | const struct GNUNET_CONFIGURATION_Handle *ccfg, |
577 | struct GNUNET_TESTING_Daemon *d, const char *emsg) | 561 | struct GNUNET_TESTING_Peer *peer) |
578 | { | 562 | { |
579 | |||
580 | char* private_keyfile; | 563 | char* private_keyfile; |
581 | char* shorten_keyfile; | 564 | char* shorten_keyfile; |
582 | char* our_keyfile; | 565 | char* our_keyfile; |
583 | 566 | ||
584 | cfg = _cfg; | 567 | cfg = ccfg; |
585 | 568 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); | |
586 | GNUNET_SCHEDULER_cancel (die_task); | ||
587 | 569 | ||
588 | /* put records into namestore */ | 570 | /* put records into namestore */ |
589 | namestore_handle = GNUNET_NAMESTORE_connect(cfg); | 571 | namestore_handle = GNUNET_NAMESTORE_connect(cfg); |
590 | if (NULL == namestore_handle) | 572 | if (NULL == namestore_handle) |
591 | { | 573 | { |
592 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to connect to namestore\n"); | 574 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to connect to namestore\n"); |
593 | ok = -1; | 575 | end_badly_now(); |
594 | return; | 576 | return; |
595 | } | 577 | } |
596 | 578 | ||
@@ -599,7 +581,7 @@ do_lookup (void *cls, const struct GNUNET_PeerIdentity *id, | |||
599 | if (NULL == dht_handle) | 581 | if (NULL == dht_handle) |
600 | { | 582 | { |
601 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to connect to dht\n"); | 583 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to connect to dht\n"); |
602 | ok = -1; | 584 | end_badly_now(); |
603 | return; | 585 | return; |
604 | } | 586 | } |
605 | 587 | ||
@@ -608,7 +590,7 @@ do_lookup (void *cls, const struct GNUNET_PeerIdentity *id, | |||
608 | &our_keyfile)) | 590 | &our_keyfile)) |
609 | { | 591 | { |
610 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to get key from cfg\n"); | 592 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to get key from cfg\n"); |
611 | ok = -1; | 593 | end_badly_now(); |
612 | return; | 594 | return; |
613 | } | 595 | } |
614 | 596 | ||
@@ -618,7 +600,7 @@ do_lookup (void *cls, const struct GNUNET_PeerIdentity *id, | |||
618 | { | 600 | { |
619 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 601 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
620 | "Failed to get shorten zone key from cfg\n"); | 602 | "Failed to get shorten zone key from cfg\n"); |
621 | ok = -1; | 603 | end_badly_now(); |
622 | return; | 604 | return; |
623 | } | 605 | } |
624 | 606 | ||
@@ -628,7 +610,7 @@ do_lookup (void *cls, const struct GNUNET_PeerIdentity *id, | |||
628 | { | 610 | { |
629 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 611 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
630 | "Failed to get private zone key from cfg\n"); | 612 | "Failed to get private zone key from cfg\n"); |
631 | ok = -1; | 613 | end_badly_now(); |
632 | return; | 614 | return; |
633 | } | 615 | } |
634 | our_key = GNUNET_CRYPTO_rsa_key_create_from_file (our_keyfile); | 616 | our_key = GNUNET_CRYPTO_rsa_key_create_from_file (our_keyfile); |
@@ -665,74 +647,12 @@ do_lookup (void *cls, const struct GNUNET_PeerIdentity *id, | |||
665 | &rd, | 647 | &rd, |
666 | &cont_init_zone, | 648 | &cont_init_zone, |
667 | NULL); | 649 | NULL); |
668 | |||
669 | |||
670 | |||
671 | |||
672 | } | ||
673 | |||
674 | static void | ||
675 | run (void *cls, char *const *args, const char *cfgfile, | ||
676 | const struct GNUNET_CONFIGURATION_Handle *c) | ||
677 | { | ||
678 | cfg = c; | ||
679 | /* Get path from configuration file */ | ||
680 | if (GNUNET_YES != | ||
681 | GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome", | ||
682 | &test_directory)) | ||
683 | { | ||
684 | ok = 404; | ||
685 | return; | ||
686 | } | ||
687 | |||
688 | |||
689 | /* Set up a task to end testing if peer start fails */ | ||
690 | die_task = | ||
691 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, | ||
692 | "didn't start all daemons in reasonable amount of time!!!"); | ||
693 | |||
694 | /* Start alice */ | ||
695 | //d1 = GNUNET_TESTING_daemon_start(cfg, TIMEOUT, GNUNET_NO, NULL, NULL, 0, | ||
696 | // NULL, NULL, NULL, &do_lookup, NULL); | ||
697 | pg = GNUNET_TESTING_daemons_start(cfg, 1, 1, 1, TIMEOUT, | ||
698 | NULL, NULL, &do_lookup, NULL, | ||
699 | NULL, NULL, NULL); | ||
700 | } | ||
701 | |||
702 | static int | ||
703 | check () | ||
704 | { | ||
705 | int ret; | ||
706 | |||
707 | /* Arguments for GNUNET_PROGRAM_run */ | ||
708 | char *const argv[] = { "test-gns-pseu-shorten", /* Name to give running binary */ | ||
709 | "-c", | ||
710 | "test_gns_simple_lookup.conf", /* Config file to use */ | ||
711 | #if VERBOSE | ||
712 | "-L", "DEBUG", | ||
713 | #endif | ||
714 | NULL | ||
715 | }; | ||
716 | struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
717 | GNUNET_GETOPT_OPTION_END | ||
718 | }; | ||
719 | /* Run the run function as a new program */ | ||
720 | ret = | ||
721 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, | ||
722 | "test-gns-pseu-shorten", "nohelp", options, &run, | ||
723 | &ok); | ||
724 | if (ret != GNUNET_OK) | ||
725 | { | ||
726 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
727 | "`test-gns-pseu-shorten': Failed with error code %d\n", ret); | ||
728 | } | ||
729 | return ok; | ||
730 | } | 650 | } |
731 | 651 | ||
732 | int | 652 | int |
733 | main (int argc, char *argv[]) | 653 | main (int argc, char *argv[]) |
734 | { | 654 | { |
735 | int ret; | 655 | ok = 1; |
736 | 656 | ||
737 | GNUNET_log_setup ("test-gns-pseu-shorten", | 657 | GNUNET_log_setup ("test-gns-pseu-shorten", |
738 | #if VERBOSE | 658 | #if VERBOSE |
@@ -741,12 +661,8 @@ main (int argc, char *argv[]) | |||
741 | "WARNING", | 661 | "WARNING", |
742 | #endif | 662 | #endif |
743 | NULL); | 663 | NULL); |
744 | ret = check (); | 664 | GNUNET_TESTING_peer_run ("test-gns-pseu-shorten", "test_gns_simple_lookup.conf", &do_check, NULL); |
745 | /** | 665 | return ok; |
746 | * Need to remove base directory, subdirectories taken care | ||
747 | * of by the testing framework. | ||
748 | */ | ||
749 | return ret; | ||
750 | } | 666 | } |
751 | 667 | ||
752 | /* end of test_gns_twopeer.c */ | 668 | /* end of test_gns_pseu_shorten.c */ |