[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24627 - in gnunet/src: include mesh testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24627 - in gnunet/src: include mesh testbed |
Date: |
Wed, 31 Oct 2012 10:15:05 +0100 |
Author: harsha
Date: 2012-10-31 10:15:05 +0100 (Wed, 31 Oct 2012)
New Revision: 24627
Modified:
gnunet/src/include/gnunet_testbed_service.h
gnunet/src/mesh/gnunet-regex-profiler.c
gnunet/src/testbed/gnunet-testbed-profiler.c
gnunet/src/testbed/test_testbed_api_3peers_3controllers.c
gnunet/src/testbed/test_testbed_api_controllerlink.c
gnunet/src/testbed/testbed.conf.in
gnunet/src/testbed/testbed_api.c
gnunet/src/testbed/testbed_api.h
gnunet/src/testbed/testbed_api_hosts.c
Log:
locate helpers in libexec
Modified: gnunet/src/include/gnunet_testbed_service.h
===================================================================
--- gnunet/src/include/gnunet_testbed_service.h 2012-10-30 23:03:07 UTC (rev
24626)
+++ gnunet/src/include/gnunet_testbed_service.h 2012-10-31 09:15:05 UTC (rev
24627)
@@ -136,11 +136,13 @@
* Checks whether a host can be used to start testbed service
*
* @param host the host to check
+ * @param config the configuration handle to lookup the path of the testbed
helper
* @return GNUNET_YES if testbed service can be started on the given host
* remotely; GNUNET_NO if not
*/
int
-GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host);
+GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host,
+ const struct GNUNET_CONFIGURATION_Handle
*config);
/**
Modified: gnunet/src/mesh/gnunet-regex-profiler.c
===================================================================
--- gnunet/src/mesh/gnunet-regex-profiler.c 2012-10-30 23:03:07 UTC (rev
24626)
+++ gnunet/src/mesh/gnunet-regex-profiler.c 2012-10-31 09:15:05 UTC (rev
24627)
@@ -1676,7 +1676,7 @@
}
for (nhost = 0; nhost < num_hosts; nhost++)
{
- if (GNUNET_YES != GNUNET_TESTBED_is_host_habitable (hosts[nhost]))
+ if (GNUNET_YES != GNUNET_TESTBED_is_host_habitable (hosts[nhost], config))
{
fprintf (stderr, _("Host %s cannot start testbed\n"),
GNUNET_TESTBED_host_get_hostname (hosts[nhost]));
Modified: gnunet/src/testbed/gnunet-testbed-profiler.c
===================================================================
--- gnunet/src/testbed/gnunet-testbed-profiler.c 2012-10-30 23:03:07 UTC
(rev 24626)
+++ gnunet/src/testbed/gnunet-testbed-profiler.c 2012-10-31 09:15:05 UTC
(rev 24627)
@@ -718,7 +718,7 @@
}
for (nhost = 0; nhost < num_hosts; nhost++)
{
- if (GNUNET_YES != GNUNET_TESTBED_is_host_habitable (hosts[nhost]))
+ if (GNUNET_YES != GNUNET_TESTBED_is_host_habitable (hosts[nhost], config))
{
fprintf (stderr, _("Host %s cannot start testbed\n"),
GNUNET_TESTBED_host_get_hostname_ (hosts[nhost]));
Modified: gnunet/src/testbed/test_testbed_api_3peers_3controllers.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_3peers_3controllers.c 2012-10-30
23:03:07 UTC (rev 24626)
+++ gnunet/src/testbed/test_testbed_api_3peers_3controllers.c 2012-10-31
09:15:05 UTC (rev 24627)
@@ -680,6 +680,16 @@
{
host = GNUNET_TESTBED_host_create (NULL, NULL, 0);
GNUNET_assert (NULL != host);
+ if (GNUNET_YES != GNUNET_TESTBED_is_host_habitable (host, config))
+ {
+ GNUNET_TESTBED_host_destroy (host);
+ host = NULL;
+ (void) PRINTF ("%s",
+ "Unable to run the test as this system is not configured "
+ "to use password less SSH logins to localhost.\n"
+ "Marking test as successful\n");
+ return;
+ }
cfg = GNUNET_CONFIGURATION_dup (config);
cp1 = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
NULL);
@@ -691,46 +701,6 @@
/**
- * Function to check if
- * 1. Password-less SSH logins to given ip work
- * 2. gnunet-helper-testbed is found on the PATH on the remote side
- *
- * @param host_str numeric representation of the host's ip
- * @return GNUNET_YES if password-less SSH login to the given host works;
- * GNUNET_NO if not
- */
-static int
-check_ssh (char *host_str)
-{
- char *const remote_args[] = {
- "ssh", "-o", "BatchMode=yes", "-o", "CheckHostIP=no",
- "-o", "NoHostAuthenticationForLocalhost=yes", "-q",
- host_str, "which", "gnunet-helper-testbed", NULL
- };
- // FIXME: the above no longer works with libexec/-installation!
- struct GNUNET_OS_Process *auxp;
- enum GNUNET_OS_ProcessStatusType type;
- unsigned long code;
- int ret;
-
- auxp =
- GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
- NULL, "ssh", remote_args);
- GNUNET_assert (NULL != auxp);
- do
- {
- ret = GNUNET_OS_process_status (auxp, &type, &code);
- GNUNET_assert (GNUNET_SYSERR != ret);
- (void) usleep (300);
- }
- while (GNUNET_NO == ret);
- (void) GNUNET_OS_process_wait (auxp);
- GNUNET_OS_process_destroy (auxp);
- return (0 != code) ? GNUNET_NO : GNUNET_YES;
-}
-
-
-/**
* Main function
*/
int
@@ -745,8 +715,6 @@
};
int ret;
- if (GNUNET_YES != check_ssh ("127.0.0.1"))
- goto error_exit;
result = INIT;
ret =
GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
@@ -755,13 +723,6 @@
if ((GNUNET_OK != ret) || (SUCCESS != result))
return 1;
return 0;
-
- error_exit:
- (void) PRINTF ("%s",
- "Unable to run the test as this system is not configured "
- "to use password less SSH logins to localhost.\n"
- "Marking test as successful\n");
- return 0;
}
/* end of test_testbed_api_3peers_3controllers.c */
Modified: gnunet/src/testbed/test_testbed_api_controllerlink.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_controllerlink.c 2012-10-30
23:03:07 UTC (rev 24626)
+++ gnunet/src/testbed/test_testbed_api_controllerlink.c 2012-10-31
09:15:05 UTC (rev 24627)
@@ -633,6 +633,16 @@
{
host = GNUNET_TESTBED_host_create (NULL, NULL, 0);
GNUNET_assert (NULL != host);
+ if (GNUNET_YES != GNUNET_TESTBED_is_host_habitable (host, config))
+ {
+ GNUNET_TESTBED_host_destroy (host);
+ host = NULL;
+ (void) PRINTF ("%s",
+ "Unable to run the test as this system is not configured "
+ "to use password less SSH logins to localhost.\n"
+ "Marking test as successful\n");
+ return;
+ }
cfg = GNUNET_CONFIGURATION_dup (config);
cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
NULL);
@@ -644,46 +654,6 @@
/**
- * Function to check if
- * 1. Password-less SSH logins to given ip work
- * 2. gnunet-helper-testbed is found on the PATH on the remote side
- *
- * @param host_str numeric representation of the host's ip
- * @return GNUNET_YES if password-less SSH login to the given host works;
- * GNUNET_NO if not
- */
-static int
-check_ssh (char *host_str)
-{
- char *const remote_args[] = {
- "ssh", "-o", "BatchMode=yes", "-o", "CheckHostIP=no",
- "-o", "NoHostAuthenticationForLocalhost=yes", "-q",
- host_str, "which", "gnunet-helper-testbed", NULL
- };
- // FIXME: the above no longer works with libexec/-installation!
- struct GNUNET_OS_Process *auxp;
- enum GNUNET_OS_ProcessStatusType type;
- unsigned long code;
- int ret;
-
- auxp =
- GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
- NULL, "ssh", remote_args);
- GNUNET_assert (NULL != auxp);
- do
- {
- ret = GNUNET_OS_process_status (auxp, &type, &code);
- GNUNET_assert (GNUNET_SYSERR != ret);
- (void) usleep (300);
- }
- while (GNUNET_NO == ret);
- (void) GNUNET_OS_process_wait (auxp);
- GNUNET_OS_process_destroy (auxp);
- return (0 != code) ? GNUNET_NO : GNUNET_YES;
-}
-
-
-/**
* Main function
*/
int
@@ -698,8 +668,6 @@
};
int ret;
- if (GNUNET_YES != check_ssh ("127.0.0.1"))
- goto error_exit;
result = INIT;
ret =
GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
@@ -708,13 +676,6 @@
if ((GNUNET_OK != ret) || (SLAVE3_LINK_SUCCESS != result))
return 1;
return 0;
-
- error_exit:
- (void) PRINTF ("%s",
- "Unable to run the test as this system is not configured "
- "to use password less SSH logins to localhost.\n"
- "Marking test as successful\n");
- return 0;
}
/* end of test_testbed_api_controllerlink.c */
Modified: gnunet/src/testbed/testbed.conf.in
===================================================================
--- gnunet/src/testbed/testbed.conf.in 2012-10-30 23:03:07 UTC (rev 24626)
+++ gnunet/src/testbed/testbed.conf.in 2012-10-31 09:15:05 UTC (rev 24627)
@@ -4,6 +4,8 @@
HOSTNAME = localhost
HOME = $SERVICEHOME
BINARY = gnunet-service-testbed
+# Set this to the path where the testbed helper is installed
+# HELPER_BINARY_PATH = @prefix@/lib/gnunet/libexec/gnunet-helper-testbed
ACCEPT_FROM = 127.0.0.1;
ACCEPT_FROM6 = ::1;
UNIXPATH = /tmp/gnunet-service-testbed.sock
Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c 2012-10-30 23:03:07 UTC (rev 24626)
+++ gnunet/src/testbed/testbed_api.c 2012-10-31 09:15:05 UTC (rev 24627)
@@ -68,13 +68,6 @@
/**
- * Testbed Helper binary name
- */
-#define HELPER_TESTBED_BINARY "gnunet-helper-testbed"
-#define HELPER_TESTBED_BINARY_SSH ". ~/.bashrc; gnunet-helper-testbed"
-
-
-/**
* Handle for controller process
*/
struct GNUNET_TESTBED_ControllerProc
@@ -1464,6 +1457,7 @@
}
else
{
+ char *helper_binary_path;
char *remote_args[10];
unsigned int argp;
const char *username;
@@ -1485,13 +1479,17 @@
remote_args[argp++] = "-o";
remote_args[argp++] = "NoHostAuthenticationForLocalhost=yes";
remote_args[argp++] = cp->dst;
- // FIXME: lib/gnunet/libexec/-prefix missing here!!!
- remote_args[argp++] = HELPER_TESTBED_BINARY_SSH;
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "testbed",
+
"HELPER_BINARY_PATH",
+
&helper_binary_path))
+ helper_binary_path = GNUNET_OS_get_libexec_binary_path
(HELPER_TESTBED_BINARY);
+ remote_args[argp++] = helper_binary_path;
remote_args[argp++] = NULL;
GNUNET_assert (argp == 10);
cp->helper =
GNUNET_HELPER_start (GNUNET_NO, "ssh", remote_args, &helper_mst,
&helper_exp_cb, cp);
+ GNUNET_free (helper_binary_path);
}
if (NULL == cp->helper)
{
Modified: gnunet/src/testbed/testbed_api.h
===================================================================
--- gnunet/src/testbed/testbed_api.h 2012-10-30 23:03:07 UTC (rev 24626)
+++ gnunet/src/testbed/testbed_api.h 2012-10-31 09:15:05 UTC (rev 24627)
@@ -30,7 +30,14 @@
#include "gnunet_testbed_service.h"
#include "testbed.h"
+
/**
+ * Testbed Helper binary name
+ */
+#define HELPER_TESTBED_BINARY "gnunet-helper-testbed"
+
+
+/**
* Enumeration of operations
*/
enum OperationType
Modified: gnunet/src/testbed/testbed_api_hosts.c
===================================================================
--- gnunet/src/testbed/testbed_api_hosts.c 2012-10-30 23:03:07 UTC (rev
24626)
+++ gnunet/src/testbed/testbed_api_hosts.c 2012-10-31 09:15:05 UTC (rev
24627)
@@ -485,13 +485,16 @@
* Checks whether a host can be used to start testbed service
*
* @param host the host to check
+ * @param config the configuration handle to lookup the path of the testbed
helper
* @return GNUNET_YES if testbed service can be started on the given host
* remotely; GNUNET_NO if not
*/
int
-GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host)
+GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host,
+ const struct GNUNET_CONFIGURATION_Handle
*config)
{
char *remote_args[11];
+ char *helper_binary_path;
char *portstr;
char *ssh_addr;
const char *hostname;
@@ -508,6 +511,10 @@
ssh_addr = GNUNET_strdup (hostname);
else
GNUNET_asprintf (&ssh_addr, "address@hidden", host->username, hostname);
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (config, "testbed",
+ "HELPER_BINARY_PATH",
+ &helper_binary_path))
+ helper_binary_path = GNUNET_OS_get_libexec_binary_path
(HELPER_TESTBED_BINARY);
argp = 0;
remote_args[argp++] = "ssh";
GNUNET_asprintf (&portstr, "%u", host->port);
@@ -518,13 +525,12 @@
remote_args[argp++] = "-o";
remote_args[argp++] = "NoHostAuthenticationForLocalhost=yes";
remote_args[argp++] = ssh_addr;
- // FIXME: this no longer works with 'libexec/' paths!
- remote_args[argp++] = "which";
- remote_args[argp++] = "gnunet-helper-testbed";
+ remote_args[argp++] = "stat";
+ remote_args[argp++] = helper_binary_path;
remote_args[argp++] = NULL;
GNUNET_assert (argp == 11);
auxp =
- GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
+ GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ERR, NULL,
NULL, "ssh", remote_args);
if (NULL == auxp)
{
@@ -538,11 +544,11 @@
GNUNET_assert (GNUNET_SYSERR != ret);
(void) usleep (300);
}
- while (GNUNET_NO == ret);
- //(void) GNUNET_OS_process_wait (auxp);
+ while (GNUNET_NO == ret);
GNUNET_OS_process_destroy (auxp);
GNUNET_free (ssh_addr);
GNUNET_free (portstr);
+ GNUNET_free (helper_binary_path);
return (0 != code) ? GNUNET_NO : GNUNET_YES;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24627 - in gnunet/src: include mesh testbed,
gnunet <=