diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-31 09:15:05 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-31 09:15:05 +0000 |
commit | f2ac1a162054f0f7646b35d3a03d623c58a24c20 (patch) | |
tree | 55b60da9bd2080693e6ac4d138bfc7c491fec645 /src/testbed/test_testbed_api_controllerlink.c | |
parent | 0a0036407218d7f9588d2b6b796b2a6f779bf700 (diff) | |
download | gnunet-f2ac1a162054f0f7646b35d3a03d623c58a24c20.tar.gz gnunet-f2ac1a162054f0f7646b35d3a03d623c58a24c20.zip |
locate helpers in libexec
Diffstat (limited to 'src/testbed/test_testbed_api_controllerlink.c')
-rw-r--r-- | src/testbed/test_testbed_api_controllerlink.c | 59 |
1 files changed, 10 insertions, 49 deletions
diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c index abde65166..471fb8630 100644 --- a/src/testbed/test_testbed_api_controllerlink.c +++ b/src/testbed/test_testbed_api_controllerlink.c | |||
@@ -633,6 +633,16 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
633 | { | 633 | { |
634 | host = GNUNET_TESTBED_host_create (NULL, NULL, 0); | 634 | host = GNUNET_TESTBED_host_create (NULL, NULL, 0); |
635 | GNUNET_assert (NULL != host); | 635 | GNUNET_assert (NULL != host); |
636 | if (GNUNET_YES != GNUNET_TESTBED_is_host_habitable (host, config)) | ||
637 | { | ||
638 | GNUNET_TESTBED_host_destroy (host); | ||
639 | host = NULL; | ||
640 | (void) PRINTF ("%s", | ||
641 | "Unable to run the test as this system is not configured " | ||
642 | "to use password less SSH logins to localhost.\n" | ||
643 | "Marking test as successful\n"); | ||
644 | return; | ||
645 | } | ||
636 | cfg = GNUNET_CONFIGURATION_dup (config); | 646 | cfg = GNUNET_CONFIGURATION_dup (config); |
637 | cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb, | 647 | cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb, |
638 | NULL); | 648 | NULL); |
@@ -644,46 +654,6 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
644 | 654 | ||
645 | 655 | ||
646 | /** | 656 | /** |
647 | * Function to check if | ||
648 | * 1. Password-less SSH logins to given ip work | ||
649 | * 2. gnunet-helper-testbed is found on the PATH on the remote side | ||
650 | * | ||
651 | * @param host_str numeric representation of the host's ip | ||
652 | * @return GNUNET_YES if password-less SSH login to the given host works; | ||
653 | * GNUNET_NO if not | ||
654 | */ | ||
655 | static int | ||
656 | check_ssh (char *host_str) | ||
657 | { | ||
658 | char *const remote_args[] = { | ||
659 | "ssh", "-o", "BatchMode=yes", "-o", "CheckHostIP=no", | ||
660 | "-o", "NoHostAuthenticationForLocalhost=yes", "-q", | ||
661 | host_str, "which", "gnunet-helper-testbed", NULL | ||
662 | }; | ||
663 | // FIXME: the above no longer works with libexec/-installation! | ||
664 | struct GNUNET_OS_Process *auxp; | ||
665 | enum GNUNET_OS_ProcessStatusType type; | ||
666 | unsigned long code; | ||
667 | int ret; | ||
668 | |||
669 | auxp = | ||
670 | GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, | ||
671 | NULL, "ssh", remote_args); | ||
672 | GNUNET_assert (NULL != auxp); | ||
673 | do | ||
674 | { | ||
675 | ret = GNUNET_OS_process_status (auxp, &type, &code); | ||
676 | GNUNET_assert (GNUNET_SYSERR != ret); | ||
677 | (void) usleep (300); | ||
678 | } | ||
679 | while (GNUNET_NO == ret); | ||
680 | (void) GNUNET_OS_process_wait (auxp); | ||
681 | GNUNET_OS_process_destroy (auxp); | ||
682 | return (0 != code) ? GNUNET_NO : GNUNET_YES; | ||
683 | } | ||
684 | |||
685 | |||
686 | /** | ||
687 | * Main function | 657 | * Main function |
688 | */ | 658 | */ |
689 | int | 659 | int |
@@ -698,8 +668,6 @@ main (int argc, char **argv) | |||
698 | }; | 668 | }; |
699 | int ret; | 669 | int ret; |
700 | 670 | ||
701 | if (GNUNET_YES != check_ssh ("127.0.0.1")) | ||
702 | goto error_exit; | ||
703 | result = INIT; | 671 | result = INIT; |
704 | ret = | 672 | ret = |
705 | GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, | 673 | GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, |
@@ -708,13 +676,6 @@ main (int argc, char **argv) | |||
708 | if ((GNUNET_OK != ret) || (SLAVE3_LINK_SUCCESS != result)) | 676 | if ((GNUNET_OK != ret) || (SLAVE3_LINK_SUCCESS != result)) |
709 | return 1; | 677 | return 1; |
710 | return 0; | 678 | return 0; |
711 | |||
712 | error_exit: | ||
713 | (void) PRINTF ("%s", | ||
714 | "Unable to run the test as this system is not configured " | ||
715 | "to use password less SSH logins to localhost.\n" | ||
716 | "Marking test as successful\n"); | ||
717 | return 0; | ||
718 | } | 679 | } |
719 | 680 | ||
720 | /* end of test_testbed_api_controllerlink.c */ | 681 | /* end of test_testbed_api_controllerlink.c */ |