aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_testing_data_remote.conf8
-rw-r--r--src/testing/test_testing_data_topology_scale_free.conf2
-rw-r--r--src/testing/test_testing_topology.c99
-rw-r--r--src/testing/testing.c4
-rw-r--r--src/testing/testing_group.c9
5 files changed, 96 insertions, 26 deletions
diff --git a/src/testing/test_testing_data_remote.conf b/src/testing/test_testing_data_remote.conf
index 3c28c5ece..df036c49e 100644
--- a/src/testing/test_testing_data_remote.conf
+++ b/src/testing/test_testing_data_remote.conf
@@ -1,6 +1,6 @@
1PATHS] 1[PATHS]
2SERVICEHOME = /tmp/test-gnunet-testing/ 2SERVICEHOME = /tmp/test-gnunet-testing/
3DEFAULTCONFIG = test_testing_data.conf 3DEFAULTCONFIG = test_testing_data_remote.conf
4 4
5[resolver] 5[resolver]
6PORT = 2564 6PORT = 2564
@@ -16,6 +16,7 @@ PORT = 2566
16DEFAULTSERVICES = 16DEFAULTSERVICES =
17 17
18[statistics] 18[statistics]
19AUTOSTART = NO
19PORT = 2567 20PORT = 2567
20 21
21[transport-tcp] 22[transport-tcp]
@@ -29,8 +30,9 @@ PORT = 2570
29 30
30[testing] 31[testing]
31CONTROL_HOST = 131.159.20.42 32CONTROL_HOST = 131.159.20.42
32HOSTS = 127.0.0.1 33HOSTFILE = remote_hosts.txt
33WEAKRANDOM = YES 34WEAKRANDOM = YES
35NUM_PEERS = 2
34 36
35[dht] 37[dht]
36AUTOSTART = NO 38AUTOSTART = NO
diff --git a/src/testing/test_testing_data_topology_scale_free.conf b/src/testing/test_testing_data_topology_scale_free.conf
index abf86e3d9..1a104b88b 100644
--- a/src/testing/test_testing_data_topology_scale_free.conf
+++ b/src/testing/test_testing_data_topology_scale_free.conf
@@ -40,7 +40,7 @@ PORT = 2570
40#DEBUG = YES 40#DEBUG = YES
41 41
42[testing] 42[testing]
43NUM_PEERS = 500 43NUM_PEERS = 50
44WEAKRANDOM = YES 44WEAKRANDOM = YES
45TOPOLOGY = SCALE_FREE 45TOPOLOGY = SCALE_FREE
46F2F = YES 46F2F = YES
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c
index 36ccad6c9..f9d5fb9af 100644
--- a/src/testing/test_testing_topology.c
+++ b/src/testing/test_testing_topology.c
@@ -142,6 +142,12 @@ struct TestMessageContext
142 /* Identifier for this message, so we don't disconnect other peers! */ 142 /* Identifier for this message, so we don't disconnect other peers! */
143 uint32_t uid; 143 uint32_t uid;
144 144
145 /* Has peer1 been notified already of a connection to peer2? */
146 int peer1notified;
147
148 /* Has the core of peer2 been connected already? */
149 int peer2connected;
150
145 /* Task for disconnecting cores, allow task to be cancelled on shutdown */ 151 /* Task for disconnecting cores, allow task to be cancelled on shutdown */
146 GNUNET_SCHEDULER_TaskIdentifier disconnect_task; 152 GNUNET_SCHEDULER_TaskIdentifier disconnect_task;
147 153
@@ -364,6 +370,7 @@ process_mtype (void *cls,
364#endif 370#endif
365 371
366 total_messages_received++; 372 total_messages_received++;
373
367#if VERBOSE > 1 374#if VERBOSE > 1
368 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 375 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
369 "Received message from `%4s', type %d.\n", GNUNET_i2s (peer), 376 "Received message from `%4s', type %d.\n", GNUNET_i2s (peer),
@@ -491,33 +498,89 @@ init_notify_peer2 (void *cls,
491{ 498{
492 struct TestMessageContext *pos = cls; 499 struct TestMessageContext *pos = cls;
493 500
501 total_server_connections++;
502
503 pos->peer2connected = GNUNET_YES;
504 if (pos->peer1notified == GNUNET_YES) /* Peer 1 has been notified of connection to peer 2 */
505 {
494#if VERBOSE > 1 506#if VERBOSE > 1
495 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 507 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
496 "Core connection to `%4s' established, scheduling message send\n", 508 "Scheduling message send to peer `%s' from peer `%s' (init_notify_peer2)\n",
497 GNUNET_i2s (my_identity)); 509 GNUNET_i2s (my_identity), GNUNET_h2s(&pos->peer1->id.hashPubKey));
498#endif 510#endif
499 total_server_connections++; 511 if (NULL == GNUNET_CORE_notify_transmit_ready (pos->peer1handle,
512 0,
513 TIMEOUT,
514 &pos->peer2->id,
515 sizeof (struct
516 GNUNET_TestMessage),
517 &transmit_ready, pos))
518 {
519 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
520 "RECEIVED NULL when asking core (1) for transmission to peer `%4s'\n",
521 GNUNET_i2s (&pos->peer2->id));
522 transmit_ready_failed++;
523 }
524 else
525 {
526 transmit_ready_scheduled++;
527 }
528 }
529}
530
531/**
532 * Method called whenever a given peer connects.
533 *
534 * @param cls closure
535 * @param peer peer identity this notification is about
536 * @param atsi performance data for the connection
537 */
538static void connect_notify_peers (void *cls,
539 const struct
540 GNUNET_PeerIdentity *peer,
541 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
542{
543 struct TestMessageContext *pos = cls;
500 544
501 if (NULL == GNUNET_CORE_notify_transmit_ready (pos->peer1handle, 545 if (0 == memcmp(peer, &pos->peer2->id, sizeof(struct GNUNET_PeerIdentity)))
502 0,
503 TIMEOUT,
504 &pos->peer2->id,
505 sizeof (struct
506 GNUNET_TestMessage),
507 &transmit_ready, pos))
508 { 546 {
547 pos->peer1notified = GNUNET_YES;
548#if VERBOSE > 1
509 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 549 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
510 "RECEIVED NULL when asking core (1) for transmission to peer `%4s'\n", 550 "Peer `%s' notified of connection to peer `%s'\n",
511 GNUNET_i2s (&pos->peer2->id)); 551 GNUNET_i2s (&pos->peer1->id), GNUNET_h2s(&peer->hashPubKey));
512 transmit_ready_failed++; 552#endif
513 } 553 }
514 else 554 else
555 return;
556
557 if (pos->peer2connected == GNUNET_YES) /* Already connected and notified of connection, send message! */
515 { 558 {
516 transmit_ready_scheduled++; 559#if VERBOSE > 1
560 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
561 "Scheduling message send to peer `%s' from peer `%s' (init_notify_peer2)\n",
562 GNUNET_i2s (&pos->peer2->id), GNUNET_h2s(&pos->peer1->id.hashPubKey));
563#endif
564 if (NULL == GNUNET_CORE_notify_transmit_ready (pos->peer1handle,
565 0,
566 TIMEOUT,
567 &pos->peer2->id,
568 sizeof (struct
569 GNUNET_TestMessage),
570 &transmit_ready, pos))
571 {
572 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
573 "RECEIVED NULL when asking core (1) for transmission to peer `%4s'\n",
574 GNUNET_i2s (&pos->peer2->id));
575 transmit_ready_failed++;
576 }
577 else
578 {
579 transmit_ready_scheduled++;
580 }
517 } 581 }
518} 582}
519 583
520
521static void 584static void
522init_notify_peer1 (void *cls, 585init_notify_peer1 (void *cls,
523 struct GNUNET_CORE_Handle *server, 586 struct GNUNET_CORE_Handle *server,
@@ -585,7 +648,7 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
585 1, 648 1,
586 pos, 649 pos,
587 &init_notify_peer1, 650 &init_notify_peer1,
588 NULL, NULL, 651 &connect_notify_peers, NULL,
589 NULL, 652 NULL,
590 NULL, 653 NULL,
591 GNUNET_NO, NULL, GNUNET_NO, 654 GNUNET_NO, NULL, GNUNET_NO,
@@ -639,7 +702,7 @@ topology_callback (void *cls,
639#endif 702#endif
640 total_connections++; 703 total_connections++;
641#if VERBOSE > 1 704#if VERBOSE > 1
642 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connected peer %s to peer %s\n", 705 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "connected peer %s to peer %s\n",
643 first_daemon->shortname, second_daemon->shortname); 706 first_daemon->shortname, second_daemon->shortname);
644#endif 707#endif
645 temp_context = GNUNET_malloc (sizeof (struct TestMessageContext)); 708 temp_context = GNUNET_malloc (sizeof (struct TestMessageContext));
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 84493410a..3d1a74e0e 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -1533,10 +1533,12 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1533 ctx->max_connect_attempts + 1), 1533 ctx->max_connect_attempts + 1),
1534 &ctx->d2->id, 1534 &ctx->d2->id,
1535 &core_connect_request_cont, ctx); 1535 &core_connect_request_cont, ctx);
1536 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1536#if DEBUG_TESTING
1537 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1537 "Sending connect request to CORE of %s for peer %s\n", 1538 "Sending connect request to CORE of %s for peer %s\n",
1538 GNUNET_i2s (&ctx->d1->id), 1539 GNUNET_i2s (&ctx->d1->id),
1539 GNUNET_h2s (&ctx->d2->id.hashPubKey)); 1540 GNUNET_h2s (&ctx->d2->id.hashPubKey));
1541#endif
1540 ctx->timeout_hello = 1542 ctx->timeout_hello =
1541 GNUNET_TIME_relative_add (ctx->timeout_hello, 1543 GNUNET_TIME_relative_add (ctx->timeout_hello,
1542 GNUNET_TIME_relative_multiply 1544 GNUNET_TIME_relative_multiply
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index 9c0dbd8fa..e74d5b9ef 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -3421,12 +3421,15 @@ schedule_get_topology (void *cls,
3421 outstanding_connects); 3421 outstanding_connects);
3422#endif 3422#endif
3423 topology_context->connected++; 3423 topology_context->connected++;
3424
3424 if (GNUNET_OK != 3425 if (GNUNET_OK !=
3425 GNUNET_CORE_iterate_peers (core_context->daemon->server, 3426 GNUNET_CORE_iterate_peers (core_context->daemon->cfg,
3426 &internal_topology_callback, 3427 &internal_topology_callback,
3427 core_context)) 3428 core_context))
3428 internal_topology_callback (core_context, NULL, NULL); 3429 {
3429 3430 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Topology iteration failed.\n");
3431 internal_topology_callback (core_context, NULL, NULL);
3432 }
3430 } 3433 }
3431} 3434}
3432 3435