[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20403 - in gnunet/src: include testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20403 - in gnunet/src: include testing |
Date: |
Fri, 9 Mar 2012 13:23:55 +0100 |
Author: grothoff
Date: 2012-03-09 13:23:55 +0100 (Fri, 09 Mar 2012)
New Revision: 20403
Modified:
gnunet/src/include/gnunet_testing_lib.h
gnunet/src/testing/testing.c
Log:
-removing 'proc' and replacing it with a different proc for each of the
different types of processes being started so that we can actually figure out
which ones are running
Modified: gnunet/src/include/gnunet_testing_lib.h
===================================================================
--- gnunet/src/include/gnunet_testing_lib.h 2012-03-09 12:10:34 UTC (rev
20402)
+++ gnunet/src/include/gnunet_testing_lib.h 2012-03-09 12:23:55 UTC (rev
20403)
@@ -304,11 +304,36 @@
void *update_cb_cls;
/**
- * PID of the process that we started last.
+ * PID of the process we used to run gnunet-arm or SSH to start the peer.
*/
- struct GNUNET_OS_Process *proc;
+ struct GNUNET_OS_Process *proc_arm_start;
/**
+ * PID of the process we used to run gnunet-arm or SSH to stop the peer.
+ */
+ struct GNUNET_OS_Process *proc_arm_stop;
+
+ /**
+ * PID of the process we used to run gnunet-arm or SSH to manage services at
the peer.
+ */
+ struct GNUNET_OS_Process *proc_arm_srv_start;
+
+ /**
+ * PID of the process we used to run gnunet-arm or SSH to manage services at
the peer.
+ */
+ struct GNUNET_OS_Process *proc_arm_srv_stop;
+
+ /**
+ * PID of the process we used to run copy files
+ */
+ struct GNUNET_OS_Process *proc_arm_copying;
+
+ /**
+ * PID of the process we used to run gnunet-peerinfo.
+ */
+ struct GNUNET_OS_Process *proc_arm_peerinfo;
+
+ /**
* Handle to the server.
*/
struct GNUNET_CORE_Handle *server;
Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c 2012-03-09 12:10:34 UTC (rev 20402)
+++ gnunet/src/testing/testing.c 2012-03-09 12:23:55 UTC (rev 20403)
@@ -192,7 +192,7 @@
{
case SP_COPYING:
/* confirm copying complete */
- if (GNUNET_OK != GNUNET_OS_process_status (d->proc, &type, &code))
+ if (GNUNET_OK != GNUNET_OS_process_status (d->proc_arm_copying, &type,
&code))
{
if (GNUNET_TIME_absolute_get_remaining (d->max_timeout).rel_value == 0)
{
@@ -218,7 +218,8 @@
cb (d->cb_cls, NULL, d->cfg, d, _("`scp' did not complete
cleanly.\n"));
return;
}
- GNUNET_OS_process_close (d->proc);
+ GNUNET_OS_process_close (d->proc_arm_copying);
+ d->proc_arm_copying = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Successfully copied configuration file.\n");
d->phase = SP_COPIED;
@@ -227,6 +228,7 @@
/* Start create hostkey process if we don't already know the peer
identity! */
if (GNUNET_NO == d->have_hostkey)
{
+ GNUNET_assert (NULL == d->proc_arm_peerinfo);
d->pipe_stdout = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO,
GNUNET_YES);
if (d->pipe_stdout == NULL)
{
@@ -246,7 +248,7 @@
"Starting `%s', with command `%s %s %s %s'.\n",
"gnunet-peerinfo", "gnunet-peerinfo", "-c", d->cfgfile,
"-sq");
- d->proc =
+ d->proc_arm_peerinfo =
GNUNET_OS_start_process (GNUNET_YES, NULL, d->pipe_stdout,
"gnunet-peerinfo",
"gnunet-peerinfo", "-c", d->cfgfile,
"-sq",
NULL);
@@ -265,7 +267,7 @@
d->cfgfile, "-sq");
if (d->ssh_port_str == NULL)
{
- d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, d->pipe_stdout,
"ssh", "ssh",
+ d->proc_arm_peerinfo = GNUNET_OS_start_process (GNUNET_NO, NULL,
d->pipe_stdout, "ssh", "ssh",
#if !DEBUG_TESTING
"-q",
#endif
@@ -274,7 +276,7 @@
}
else
{
- d->proc =
+ d->proc_arm_peerinfo =
GNUNET_OS_start_process (GNUNET_NO, NULL, d->pipe_stdout, "ssh",
"ssh", "-p",
d->ssh_port_str,
#if !DEBUG_TESTING
@@ -286,7 +288,7 @@
GNUNET_DISK_pipe_close_end (d->pipe_stdout,
GNUNET_DISK_PIPE_END_WRITE);
GNUNET_free (dst);
}
- if (NULL == d->proc)
+ if (NULL == d->proc_arm_peerinfo)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Could not start `%s' process to create hostkey.\n"),
@@ -366,10 +368,10 @@
d->cb = NULL;
GNUNET_DISK_pipe_close (d->pipe_stdout);
d->pipe_stdout = NULL;
- (void) GNUNET_OS_process_kill (d->proc, SIGKILL);
- GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (d->proc));
- GNUNET_OS_process_close (d->proc);
- d->proc = NULL;
+ (void) GNUNET_OS_process_kill (d->proc_arm_peerinfo, SIGKILL);
+ GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait
(d->proc_arm_peerinfo));
+ GNUNET_OS_process_close (d->proc_arm_peerinfo);
+ d->proc_arm_peerinfo = NULL;
if (NULL != cb)
cb (d->cb_cls, NULL, d->cfg, d, _("Failed to get hostkey!\n"));
return;
@@ -377,10 +379,10 @@
d->shortname = GNUNET_strdup (GNUNET_i2s (&d->id));
GNUNET_DISK_pipe_close (d->pipe_stdout);
d->pipe_stdout = NULL;
- (void) GNUNET_OS_process_kill (d->proc, SIGKILL);
- GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (d->proc));
- GNUNET_OS_process_close (d->proc);
- d->proc = NULL;
+ (void) GNUNET_OS_process_kill (d->proc_arm_peerinfo, SIGKILL);
+ GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (d->proc_arm_peerinfo));
+ GNUNET_OS_process_close (d->proc_arm_peerinfo);
+ d->proc_arm_peerinfo = NULL;
d->have_hostkey = GNUNET_YES;
if (d->hostkey_callback != NULL)
{
@@ -413,13 +415,14 @@
break;
case SP_TOPOLOGY_SETUP: /* Indicates topology setup has completed! */
/* start GNUnet on remote host */
+ fprintf (stderr, "Starting\n");
if (NULL == d->hostname)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting `%s', with command `%s %s %s %s %s %s'.\n",
"gnunet-arm", "gnunet-arm", "-c", d->cfgfile, "-L", "DEBUG",
"-s");
- d->proc =
+ d->proc_arm_start =
GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm",
"gnunet-arm", "-c",
d->cfgfile,
"-L", "DEBUG",
@@ -441,7 +444,7 @@
"-L", "DEBUG", "-s", "-q");
if (d->ssh_port_str == NULL)
{
- d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ d->proc_arm_start = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL,
"ssh", "ssh",
#if !DEBUG_TESTING
"-q",
#endif
@@ -457,7 +460,7 @@
else
{
- d->proc =
+ d->proc_arm_start =
GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", "-p",
d->ssh_port_str,
#if !DEBUG_TESTING
@@ -474,7 +477,7 @@
}
GNUNET_free (dst);
}
- if (NULL == d->proc)
+ if (NULL == d->proc_arm_start)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Could not start `%s' process to start GNUnet.\n"),
@@ -497,7 +500,7 @@
d);
break;
case SP_START_ARMING:
- if (GNUNET_OK != GNUNET_OS_process_status (d->proc, &type, &code))
+ if (GNUNET_OK != GNUNET_OS_process_status (d->proc_arm_start, &type,
&code))
{
if (GNUNET_TIME_absolute_get_remaining (d->max_timeout).rel_value == 0)
{
@@ -520,10 +523,11 @@
}
GNUNET_free_non_null (d->hostname);
GNUNET_free_non_null (d->username);
- GNUNET_free (d->proc);
-// GNUNET_free (d); // FIXME (could this leak)
+ GNUNET_free (d->proc_arm_start);
+ d->proc_arm_start = NULL;
d->hostname = NULL; // Quick hack to avoid crashing (testing need
to be
d->cfg = NULL; // overhauled anyway, and the error managing is
+ // GNUNET_free (d); // FIXME (could this leak)
// pretty broken anyway.
return;
}
@@ -535,7 +539,8 @@
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully started `%s'.\n",
"gnunet-arm");
- GNUNET_free (d->proc);
+ GNUNET_free (d->proc_arm_start);
+ d->proc_arm_start = NULL;
d->phase = SP_START_CORE;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling CORE_connect\n");
/* Fall through */
@@ -600,7 +605,7 @@
break;
case SP_SERVICE_START:
/* confirm gnunet-arm exited */
- if (GNUNET_OK != GNUNET_OS_process_status (d->proc, &type, &code))
+ if (GNUNET_OK != GNUNET_OS_process_status (d->proc_arm_srv_start, &type,
&code))
{
if (GNUNET_TIME_absolute_get_remaining (d->max_timeout).rel_value == 0)
{
@@ -643,7 +648,7 @@
break;
case SP_SERVICE_SHUTDOWN_START:
/* confirm copying complete */
- if (GNUNET_OK != GNUNET_OS_process_status (d->proc, &type, &code))
+ if (GNUNET_OK != GNUNET_OS_process_status (d->proc_arm_srv_stop, &type,
&code))
{
if (GNUNET_TIME_absolute_get_remaining (d->max_timeout).rel_value == 0)
{
@@ -674,8 +679,8 @@
d->dead_cb (d->dead_cb_cls, NULL);
break;
case SP_SHUTDOWN_START:
- /* confirm copying complete */
- if (GNUNET_OK != GNUNET_OS_process_status (d->proc, &type, &code))
+ /* confirm copying complete !??? */
+ if (GNUNET_OK != GNUNET_OS_process_status (d->proc_arm_stop, &type, &code))
{
if (GNUNET_TIME_absolute_get_remaining (d->max_timeout).rel_value == 0)
{
@@ -704,8 +709,8 @@
GNUNET_free_non_null (d->hostname);
GNUNET_free_non_null (d->username);
GNUNET_free_non_null (d->shortname);
- GNUNET_free_non_null (d->proc);
- d->proc = NULL;
+ // GNUNET_free_non_null (d->proc); // !? FIXME
+ // d->proc_arm_stop = NULL;
GNUNET_free (d);
return;
}
@@ -740,8 +745,8 @@
GNUNET_free_non_null (d->hostname);
GNUNET_free_non_null (d->username);
GNUNET_free_non_null (d->shortname);
- GNUNET_free_non_null (d->proc);
- d->proc = NULL;
+ // GNUNET_free_non_null (d->proc); // !? FIXME!
+ // d->proc = NULL; // !? FIXME!
GNUNET_free (d);
return;
}
@@ -776,8 +781,8 @@
GNUNET_free_non_null (d->hello);
d->hello = NULL;
GNUNET_free_non_null (d->shortname);
- GNUNET_free_non_null (d->proc);
- d->proc = NULL;
+ // GNUNET_free_non_null (d->proc); // !? FIXME
+ // d->proc = NULL; // !? FIXME!
d->shortname = NULL;
if (d->churn == GNUNET_NO)
GNUNET_free (d);
@@ -785,7 +790,7 @@
break;
case SP_CONFIG_UPDATE:
/* confirm copying complete */
- if (GNUNET_OK != GNUNET_OS_process_status (d->proc, &type, &code))
+ if (GNUNET_OK != GNUNET_OS_process_status (d->proc_arm_copying, &type,
&code))
{
if (GNUNET_TIME_absolute_get_remaining (d->max_timeout).rel_value == 0)
/* FIXME: config update should take timeout parameter! */
{
@@ -902,7 +907,7 @@
else
arg = GNUNET_strdup (d->hostname);
- d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL,
"ssh", "ssh",
#if !DEBUG_TESTING
"-q",
#endif
@@ -923,7 +928,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting gnunet-arm with config `%s' locally.\n", d->cfgfile);
- d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm",
"gnunet-arm",
+ d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL,
"gnunet-arm", "gnunet-arm",
#if DEBUG_TESTING
"-L", "DEBUG",
#endif
@@ -978,7 +983,7 @@
else
arg = GNUNET_strdup (d->hostname);
- d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL,
"ssh", "ssh",
#if !DEBUG_TESTING
"-q",
#endif
@@ -1000,7 +1005,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting gnunet-arm with config `%s' locally.\n", d->cfgfile);
- d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm",
"gnunet-arm",
+ d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL,
"gnunet-arm", "gnunet-arm",
#if DEBUG_TESTING
"-L", "DEBUG",
#endif
@@ -1210,7 +1215,7 @@
GNUNET_free (baseservicehome);
if (ret->ssh_port_str == NULL)
{
- ret->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp",
"scp", "-r",
+ ret->proc_arm_copying = GNUNET_OS_start_process (GNUNET_NO, NULL,
NULL, "scp", "scp", "-r",
#if !DEBUG_TESTING
"-q",
#endif
@@ -1221,7 +1226,7 @@
}
else
{
- ret->proc =
+ ret->proc_arm_copying =
GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", "-r",
"-P",
ret->ssh_port_str,
#if !DEBUG_TESTING
@@ -1230,7 +1235,7 @@
servicehome, arg, NULL);
}
GNUNET_free (arg);
- if (NULL == ret->proc)
+ if (NULL == ret->proc_arm_copying)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_
@@ -1324,6 +1329,7 @@
d->phase = SP_START_ARMING;
/* Check if this is a local or remote process */
+ fprintf (stderr, "Stopping\n");
if (NULL != d->hostname)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1334,7 +1340,7 @@
else
arg = GNUNET_strdup (d->hostname);
- d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh",
"ssh",
#if !DEBUG_TESTING
"-q",
#endif
@@ -1351,7 +1357,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile);
- d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm",
"gnunet-arm",
+ d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL,
"gnunet-arm", "gnunet-arm",
#if DEBUG_TESTING
"-L", "DEBUG",
#endif
@@ -1414,8 +1420,9 @@
GNUNET_asprintf (&arg, "address@hidden", d->username, d->hostname);
else
arg = GNUNET_strdup (d->hostname);
-
- d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+
+ fprintf (stderr, "Stopping\n");
+ d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL,
"ssh", "ssh",
#if !DEBUG_TESTING
"-q",
#endif
@@ -1436,7 +1443,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile);
- d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm",
"gnunet-arm",
+ d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL,
"gnunet-arm", "gnunet-arm",
#if DEBUG_TESTING
"-L", "DEBUG",
#endif
@@ -1537,6 +1544,7 @@
d->th = NULL;
}
/* Check if this is a local or remote process */
+ fprintf (stderr, "Stopping\n");
if (NULL != d->hostname)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1547,7 +1555,7 @@
else
arg = GNUNET_strdup (d->hostname);
- d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh",
"ssh",
#if !DEBUG_TESTING
"-q",
#endif
@@ -1568,14 +1576,14 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile);
- d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "gnunet-arm",
"gnunet-arm",
+ d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL,
"gnunet-arm", "gnunet-arm",
#if DEBUG_TESTING
"-L", "DEBUG",
#endif
"-c", d->cfgfile, "-e", "-q", "-T",
GNUNET_TIME_relative_to_string
(timeout),
del_arg, NULL);
- GNUNET_assert (NULL != d->proc);
+ GNUNET_assert (NULL != d->proc_arm_stop);
}
GNUNET_free_non_null (del_arg);
@@ -1635,13 +1643,13 @@
GNUNET_asprintf (&arg, "address@hidden:%s", d->username, d->hostname,
d->cfgfile);
else
GNUNET_asprintf (&arg, "%s:%s", d->hostname, d->cfgfile);
- d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp",
+ d->proc_arm_copying = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp",
"scp",
#if !DEBUG_TESTING
"-q",
#endif
d->cfgfile, arg, NULL);
GNUNET_free (arg);
- if (NULL == d->proc)
+ if (NULL == d->proc_arm_copying)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Could not start `%s' process to copy configuration
file.\n"),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20403 - in gnunet/src: include testing,
gnunet <=