[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21636 - gnunet/src/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21636 - gnunet/src/testing |
Date: |
Tue, 29 May 2012 23:25:54 +0200 |
Author: harsha
Date: 2012-05-29 23:25:53 +0200 (Tue, 29 May 2012)
New Revision: 21636
Modified:
gnunet/src/testing/testing_new.c
Log:
-peer start, stop, destroy
Modified: gnunet/src/testing/testing_new.c
===================================================================
--- gnunet/src/testing/testing_new.c 2012-05-29 16:01:10 UTC (rev 21635)
+++ gnunet/src/testing/testing_new.c 2012-05-29 21:25:53 UTC (rev 21636)
@@ -698,7 +698,7 @@
return NULL;
peer = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Peer));
peer->cfgfile = config_filename; /* Free in peer_destroy */
- peer->main_binary = GNUNET_strdup ("gnunet-service-arm");
+ peer->main_binary = GNUNET_strdup ("gnunet-arm");
return peer;
}
@@ -712,8 +712,15 @@
int
GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer)
{
- GNUNET_break (0);
- return GNUNET_SYSERR;
+ if (NULL != peer->main_process)
+ return GNUNET_SYSERR;
+ GNUNET_assert (NULL != peer->cfgfile);
+ peer->main_process = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL,
+ peer->main_binary, "-c",
+ peer->cfgfile,
+ "-s", "-q", NULL);
+ GNUNET_assert (NULL != peer->main_process);
+ return GNUNET_OK;
}
@@ -726,8 +733,13 @@
int
GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer)
{
- GNUNET_break (0);
- return GNUNET_SYSERR;
+ if (NULL == peer->main_process)
+ return GNUNET_SYSERR;
+ GNUNET_assert (0 == GNUNET_OS_process_kill (peer->main_process, SIGTERM));
+ GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (peer->main_process));
+ GNUNET_OS_process_destroy (peer->main_process);
+ peer->main_process = NULL;
+ return GNUNET_OK;
}
@@ -741,7 +753,16 @@
void
GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer)
{
- GNUNET_break (0);
+ if (NULL != peer->main_process)
+ {
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ _("%s called when peer is still running. Use
GNUNET_TESTING_peer_stop()\n"),
+ __func__);
+ GNUNET_TESTING_peer_stop (peer);
+ }
+ GNUNET_free (peer->cfgfile);
+ GNUNET_free (peer->main_binary);
+ GNUNET_free (peer);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21636 - gnunet/src/testing,
gnunet <=