aboutsummaryrefslogtreecommitdiff
path: root/src/regex
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-09-28 13:27:32 +0000
committerBart Polot <bart@net.in.tum.de>2012-09-28 13:27:32 +0000
commit978c2c999334b76e02e503d2f31d0b45d1d877f8 (patch)
treef54acb720be9dd6f056e586396144ed33b3385bf /src/regex
parent4aa49410f7e46a106f3ca03b910a3aad60e7f90b (diff)
downloadgnunet-978c2c999334b76e02e503d2f31d0b45d1d877f8.tar.gz
gnunet-978c2c999334b76e02e503d2f31d0b45d1d877f8.zip
- WiP
Diffstat (limited to 'src/regex')
-rw-r--r--src/regex/test_regex_big.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/src/regex/test_regex_big.c b/src/regex/test_regex_big.c
index 4aa51fd76..adfd713df 100644
--- a/src/regex/test_regex_big.c
+++ b/src/regex/test_regex_big.c
@@ -111,7 +111,11 @@ enum SetupState
111 /** 111 /**
112 * Connecting to slave controller 112 * Connecting to slave controller
113 */ 113 */
114 LINKING 114 LINKING,
115
116 CREATING_PEER,
117
118 STARTING_PEER,
115}; 119};
116 120
117 121
@@ -448,12 +452,14 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
448 long i = (long) cls; 452 long i = (long) cls;
449 long peer_id; 453 long peer_id;
450 454
451 GNUNET_TESTBED_operation_done(op[i]); 455// GNUNET_TESTBED_operation_done(op[i]);
452 peer_id = i; // FIXME A * i + B 456 peer_id = i; // FIXME A * i + B
453 peers[peer_id] = peer; 457 peers[peer_id] = peer;
458 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Peer created\n");
454 op[i] = GNUNET_TESTBED_peer_start (peer, peer_start_cb, (void *) i); 459 op[i] = GNUNET_TESTBED_peer_start (peer, peer_start_cb, (void *) i);
455} 460}
456 461
462
457/** 463/**
458 * Signature of the event handler function called by the 464 * Signature of the event handler function called by the
459 * respective event controller. 465 * respective event controller.
@@ -490,14 +496,18 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
490 { 496 {
491 case INIT: 497 case INIT:
492 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Init\n"); 498 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Init\n");
499 break;
500 case LINKING:
501 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Link\n");
502 state[i] = CREATING_PEER;
493 op[i] = GNUNET_TESTBED_peer_create (master_ctrl, 503 op[i] = GNUNET_TESTBED_peer_create (master_ctrl,
494 slave_hosts[i], 504 slave_hosts[i],
495 cfg, 505 cfg,
496 peer_create_cb, 506 peer_create_cb,
497 (void *) i); 507 (void *) i);
498 break; 508 break;
499 case LINKING: 509 case CREATING_PEER:
500 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Link\n"); 510 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Peer create\n");
501 break; 511 break;
502 default: 512 default:
503 GNUNET_break (0); 513 GNUNET_break (0);
@@ -560,6 +570,9 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config,
560{ 570{
561 unsigned int i; 571 unsigned int i;
562 572
573 if (NULL == config)
574 return;
575
563 event_mask = 0; 576 event_mask = 0;
564 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START); 577 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START);
565 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP); 578 event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP);
@@ -620,6 +633,7 @@ run (void *cls, char *const *args, const char *cfgfile,
620int main (int argc, char **argv) 633int main (int argc, char **argv)
621{ 634{
622 int ret; 635 int ret;
636 int test_hosts;
623 unsigned int i; 637 unsigned int i;
624 638
625 struct GNUNET_GETOPT_CommandLineOption options[] = { 639 struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -630,15 +644,18 @@ int main (int argc, char **argv)
630 NULL 644 NULL
631 }; 645 };
632 646
647 test_hosts = GNUNET_OK;
633 for (i = 0; i < NUM_HOSTS; i++) 648 for (i = 0; i < NUM_HOSTS; i++)
634 { 649 {
635 char *const remote_args[] = { 650 char *const remote_args[] = {
636 "ssh", "-o", "BatchMode=yes", slave_ips[i], "echo", "Hello", "World", NULL 651 "ssh", "-o", "BatchMode=yes", slave_ips[i],
652 ". .bashrc; gnunet-helper-testbed --help > /dev/null", NULL
637 }; 653 };
638 struct GNUNET_OS_Process *auxp; 654 struct GNUNET_OS_Process *auxp;
639 enum GNUNET_OS_ProcessStatusType type; 655 enum GNUNET_OS_ProcessStatusType type;
640 unsigned long code; 656 unsigned long code;
641 657
658 fprintf (stderr, "Testing host %i\n", i);
642 auxp = 659 auxp =
643 GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, 660 GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
644 NULL, "ssh", remote_args); 661 NULL, "ssh", remote_args);
@@ -654,12 +671,19 @@ int main (int argc, char **argv)
654 GNUNET_OS_process_destroy (auxp); 671 GNUNET_OS_process_destroy (auxp);
655 if (0 != code) 672 if (0 != code)
656 { 673 {
657 (void) printf("Unable to run the test as this system is not configured " 674 fprintf (stderr,
658 "to use password less SSH logins to host %s.\n" 675 "Unable to run the test as this system is not configured "
659 "Marking test as successful\n", slave_ips[i]); 676 "to use password less SSH logins to host %s.\n",
660 return 0; 677 slave_ips[i]);
678 test_hosts = GNUNET_SYSERR;
661 } 679 }
662 } 680 }
681 if (test_hosts != GNUNET_OK)
682 {
683 fprintf (stderr, "Some hosts have failed the ssh check. Exiting.\n");
684 return 1;
685 }
686 fprintf (stderr, "START.\n");
663 687
664 result = GNUNET_SYSERR; 688 result = GNUNET_SYSERR;
665 689
@@ -668,7 +692,9 @@ int main (int argc, char **argv)
668 "test_regex_big", "nohelp", options, 692 "test_regex_big", "nohelp", options,
669 &run, NULL); 693 &run, NULL);
670 694
671 if (GNUNET_SYSERR == result || 0 != ret) 695 fprintf (stderr, "END.\n");
696
697 if (GNUNET_SYSERR == result || GNUNET_OK != ret)
672 return 1; 698 return 1;
673 return 0; 699 return 0;
674} 700}