diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-03-14 18:58:18 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-03-14 18:58:18 +0000 |
commit | 322c455eb73468596b9ea3a4db8961dfa9664f7b (patch) | |
tree | f5b0db6670c9007aa109d9dbffa91f39800fcb25 /src/testing | |
parent | 86559fb594b8a9c9c99575d4915caa4937b14311 (diff) | |
download | gnunet-322c455eb73468596b9ea3a4db8961dfa9664f7b.tar.gz gnunet-322c455eb73468596b9ea3a4db8961dfa9664f7b.zip |
better exception handling
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/testing_group.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 083e67750..b08ef64d5 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -5594,6 +5594,8 @@ start_peer_helper (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
5594 | struct GNUNET_OS_Process *proc; | 5594 | struct GNUNET_OS_Process *proc; |
5595 | unsigned int i; | 5595 | unsigned int i; |
5596 | char *arg; | 5596 | char *arg; |
5597 | enum GNUNET_OS_ProcessStatusType type; | ||
5598 | unsigned long code; | ||
5597 | GNUNET_TESTING_NotifyDaemonRunning cb; | 5599 | GNUNET_TESTING_NotifyDaemonRunning cb; |
5598 | /* ssh user@host peerStartHelper /path/to/basedirectory */ | 5600 | /* ssh user@host peerStartHelper /path/to/basedirectory */ |
5599 | 5601 | ||
@@ -5612,6 +5614,7 @@ start_peer_helper (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
5612 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "starting peers with cmd ssh %s %s %s\n", arg, "peerStartHelper.pl", tempdir); | 5614 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "starting peers with cmd ssh %s %s %s\n", arg, "peerStartHelper.pl", tempdir); |
5613 | 5615 | ||
5614 | GNUNET_OS_process_wait (proc); | 5616 | GNUNET_OS_process_wait (proc); |
5617 | GNUNET_OS_process_status (proc, &type, &code); | ||
5615 | GNUNET_OS_process_close(proc); | 5618 | GNUNET_OS_process_close(proc); |
5616 | GNUNET_free (tempdir); | 5619 | GNUNET_free (tempdir); |
5617 | GNUNET_free (baseservicehome); | 5620 | GNUNET_free (baseservicehome); |
@@ -5625,11 +5628,23 @@ start_peer_helper (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
5625 | { | 5628 | { |
5626 | cb = helper->pg->peers[i].daemon->cb; | 5629 | cb = helper->pg->peers[i].daemon->cb; |
5627 | helper->pg->peers[i].daemon->cb = NULL; | 5630 | helper->pg->peers[i].daemon->cb = NULL; |
5631 | |||
5628 | if (NULL != cb) | 5632 | if (NULL != cb) |
5629 | cb (helper->pg->peers[i].daemon->cb_cls, | 5633 | { |
5630 | &helper->pg->peers[i].daemon->id, | 5634 | if ((type != GNUNET_OS_PROCESS_EXITED) || (code != 0)) |
5631 | helper->pg->peers[i].daemon->cfg, helper->pg->peers[i].daemon, | 5635 | { |
5632 | NULL); | 5636 | cb (helper->pg->peers[i].daemon->cb_cls, |
5637 | &helper->pg->peers[i].daemon->id, | ||
5638 | helper->pg->peers[i].daemon->cfg, helper->pg->peers[i].daemon, | ||
5639 | "Failed to execute peerStartHelper.pl, or return code bad!"); | ||
5640 | } | ||
5641 | else | ||
5642 | cb (helper->pg->peers[i].daemon->cb_cls, | ||
5643 | &helper->pg->peers[i].daemon->id, | ||
5644 | helper->pg->peers[i].daemon->cfg, helper->pg->peers[i].daemon, | ||
5645 | NULL); | ||
5646 | |||
5647 | } | ||
5633 | 5648 | ||
5634 | } | 5649 | } |
5635 | } | 5650 | } |
@@ -5978,7 +5993,7 @@ GNUNET_TESTING_daemons_start(const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
5978 | if ((pg->hostkey_data != NULL) && (hostcnt > 0)) | 5993 | if ((pg->hostkey_data != NULL) && (hostcnt > 0)) |
5979 | { | 5994 | { |
5980 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Have hostkey data and running on remote hosts!\n"); | 5995 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Have hostkey data and running on remote hosts!\n"); |
5981 | GNUNET_TESTING_daemon_start (pcfg, | 5996 | pg->peers[off].daemon = GNUNET_TESTING_daemon_start (pcfg, |
5982 | timeout, | 5997 | timeout, |
5983 | GNUNET_YES, | 5998 | GNUNET_YES, |
5984 | hostname, | 5999 | hostname, |