aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/test_testbed_api_3peers_3controllers.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-10-31 09:15:05 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-10-31 09:15:05 +0000
commitf2ac1a162054f0f7646b35d3a03d623c58a24c20 (patch)
tree55b60da9bd2080693e6ac4d138bfc7c491fec645 /src/testbed/test_testbed_api_3peers_3controllers.c
parent0a0036407218d7f9588d2b6b796b2a6f779bf700 (diff)
downloadgnunet-f2ac1a162054f0f7646b35d3a03d623c58a24c20.tar.gz
gnunet-f2ac1a162054f0f7646b35d3a03d623c58a24c20.zip
locate helpers in libexec
Diffstat (limited to 'src/testbed/test_testbed_api_3peers_3controllers.c')
-rw-r--r--src/testbed/test_testbed_api_3peers_3controllers.c59
1 files changed, 10 insertions, 49 deletions
diff --git a/src/testbed/test_testbed_api_3peers_3controllers.c b/src/testbed/test_testbed_api_3peers_3controllers.c
index 206944ae8..f67042296 100644
--- a/src/testbed/test_testbed_api_3peers_3controllers.c
+++ b/src/testbed/test_testbed_api_3peers_3controllers.c
@@ -680,6 +680,16 @@ run (void *cls, char *const *args, const char *cfgfile,
680{ 680{
681 host = GNUNET_TESTBED_host_create (NULL, NULL, 0); 681 host = GNUNET_TESTBED_host_create (NULL, NULL, 0);
682 GNUNET_assert (NULL != host); 682 GNUNET_assert (NULL != host);
683 if (GNUNET_YES != GNUNET_TESTBED_is_host_habitable (host, config))
684 {
685 GNUNET_TESTBED_host_destroy (host);
686 host = NULL;
687 (void) PRINTF ("%s",
688 "Unable to run the test as this system is not configured "
689 "to use password less SSH logins to localhost.\n"
690 "Marking test as successful\n");
691 return;
692 }
683 cfg = GNUNET_CONFIGURATION_dup (config); 693 cfg = GNUNET_CONFIGURATION_dup (config);
684 cp1 = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb, 694 cp1 = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
685 NULL); 695 NULL);
@@ -691,46 +701,6 @@ run (void *cls, char *const *args, const char *cfgfile,
691 701
692 702
693/** 703/**
694 * Function to check if
695 * 1. Password-less SSH logins to given ip work
696 * 2. gnunet-helper-testbed is found on the PATH on the remote side
697 *
698 * @param host_str numeric representation of the host's ip
699 * @return GNUNET_YES if password-less SSH login to the given host works;
700 * GNUNET_NO if not
701 */
702static int
703check_ssh (char *host_str)
704{
705 char *const remote_args[] = {
706 "ssh", "-o", "BatchMode=yes", "-o", "CheckHostIP=no",
707 "-o", "NoHostAuthenticationForLocalhost=yes", "-q",
708 host_str, "which", "gnunet-helper-testbed", NULL
709 };
710 // FIXME: the above no longer works with libexec/-installation!
711 struct GNUNET_OS_Process *auxp;
712 enum GNUNET_OS_ProcessStatusType type;
713 unsigned long code;
714 int ret;
715
716 auxp =
717 GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
718 NULL, "ssh", remote_args);
719 GNUNET_assert (NULL != auxp);
720 do
721 {
722 ret = GNUNET_OS_process_status (auxp, &type, &code);
723 GNUNET_assert (GNUNET_SYSERR != ret);
724 (void) usleep (300);
725 }
726 while (GNUNET_NO == ret);
727 (void) GNUNET_OS_process_wait (auxp);
728 GNUNET_OS_process_destroy (auxp);
729 return (0 != code) ? GNUNET_NO : GNUNET_YES;
730}
731
732
733/**
734 * Main function 704 * Main function
735 */ 705 */
736int 706int
@@ -745,8 +715,6 @@ main (int argc, char **argv)
745 }; 715 };
746 int ret; 716 int ret;
747 717
748 if (GNUNET_YES != check_ssh ("127.0.0.1"))
749 goto error_exit;
750 result = INIT; 718 result = INIT;
751 ret = 719 ret =
752 GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, 720 GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
@@ -755,13 +723,6 @@ main (int argc, char **argv)
755 if ((GNUNET_OK != ret) || (SUCCESS != result)) 723 if ((GNUNET_OK != ret) || (SUCCESS != result))
756 return 1; 724 return 1;
757 return 0; 725 return 0;
758
759 error_exit:
760 (void) PRINTF ("%s",
761 "Unable to run the test as this system is not configured "
762 "to use password less SSH logins to localhost.\n"
763 "Marking test as successful\n");
764 return 0;
765} 726}
766 727
767/* end of test_testbed_api_3peers_3controllers.c */ 728/* end of test_testbed_api_3peers_3controllers.c */