[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22748 - in gnunet/src: include testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22748 - in gnunet/src: include testbed |
Date: |
Wed, 18 Jul 2012 15:03:17 +0200 |
Author: harsha
Date: 2012-07-18 15:03:17 +0200 (Wed, 18 Jul 2012)
New Revision: 22748
Added:
gnunet/src/testbed/valgrind-zlib.supp
Modified:
gnunet/src/include/gnunet_testbed_service.h
gnunet/src/testbed/Makefile.am
gnunet/src/testbed/test_testbed_api.c
gnunet/src/testbed/testbed_api.c
Log:
fix; modified testcase for test_testbed_api; valigrind suppression for zlib
Modified: gnunet/src/include/gnunet_testbed_service.h
===================================================================
--- gnunet/src/include/gnunet_testbed_service.h 2012-07-18 12:42:48 UTC (rev
22747)
+++ gnunet/src/include/gnunet_testbed_service.h 2012-07-18 13:03:17 UTC (rev
22748)
@@ -429,10 +429,11 @@
* configuration (port numbers, unix domain sockets and service home
* values are changed as per TESTING library on the remote host)
* @param cb function called when the controller is successfully started or
- * dies unexpectedly; GNUNET_TESTBED_controller_stop shouldn't be
- * called if cb is called with GNUNET_SYSERR as status. Will never be
- * called in the same task as 'GNUNET_TESTBED_controller_start'
- * (synchronous errors will be signalled by returning NULL)
+ * dies unexpectedly; GNUNET_TESTBED_controller_stop shouldn't be
+ * called if cb is called with GNUNET_SYSERR as status. Will never be
+ * called in the same task as 'GNUNET_TESTBED_controller_start'
+ * (synchronous errors will be signalled by returning NULL). This
+ * parameter cannot be NULL.
* @param cls closure for above callbacks
* @return the controller process handle, NULL on errors
*/
Modified: gnunet/src/testbed/Makefile.am
===================================================================
--- gnunet/src/testbed/Makefile.am 2012-07-18 12:42:48 UTC (rev 22747)
+++ gnunet/src/testbed/Makefile.am 2012-07-18 13:03:17 UTC (rev 22748)
@@ -71,6 +71,7 @@
if ENABLE_TEST_RUN
TESTS = \
+ test_testbed_api \
test_testbed_api_hosts \
test_gnunet_testbed_helper
endif
Modified: gnunet/src/testbed/test_testbed_api.c
===================================================================
--- gnunet/src/testbed/test_testbed_api.c 2012-07-18 12:42:48 UTC (rev
22747)
+++ gnunet/src/testbed/test_testbed_api.c 2012-07-18 13:03:17 UTC (rev
22748)
@@ -171,23 +171,21 @@
/**
- * Main run function.
+ * Callback to signal successfull startup of the controller process
*
- * @param cls NULL
- * @param args arguments passed to GNUNET_PROGRAM_run
- * @param cfgfile the path to configuration file
- * @param cfg the configuration file handle
+ * @param cls the closure from GNUNET_TESTBED_controller_start()
+ * @param cfg the configuration with which the controller has been started;
+ * NULL if status is not GNUNET_OK
+ * @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not,
+ * GNUNET_TESTBED_controller_stop() shouldn't be called in this case
*/
-static void
-run (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *config)
+static void
+status_cb (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg, int status)
{
uint64_t event_mask;
- host = GNUNET_TESTBED_host_create (NULL, NULL, 0);
- GNUNET_assert (NULL != host);
- cfg = GNUNET_CONFIGURATION_dup (config);
- cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, NULL, NULL);
+ GNUNET_assert (GNUNET_OK == status);
event_mask = 0;
event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START);
event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP);
@@ -201,7 +199,27 @@
reg_handle =
GNUNET_TESTBED_register_host (controller, neighbour, ®istration_comp,
neighbour);
- GNUNET_assert (NULL != reg_handle);
+ GNUNET_assert (NULL != reg_handle);
+}
+
+
+
+/**
+ * Main run function.
+ *
+ * @param cls NULL
+ * @param args arguments passed to GNUNET_PROGRAM_run
+ * @param cfgfile the path to configuration file
+ * @param cfg the configuration file handle
+ */
+static void
+run (void *cls, char *const *args, const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *config)
+{
+ host = GNUNET_TESTBED_host_create (NULL, NULL, 0);
+ GNUNET_assert (NULL != host);
+ cfg = GNUNET_CONFIGURATION_dup (config);
+ cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
NULL);
abort_task = GNUNET_SCHEDULER_add_delayed
(GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5), &do_abort,
NULL);
}
Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c 2012-07-18 12:42:48 UTC (rev 22747)
+++ gnunet/src/testbed/testbed_api.c 2012-07-18 13:03:17 UTC (rev 22748)
@@ -444,12 +444,18 @@
* The closure for the above callback
*/
void *cls;
+
/**
* The send handle for the helper
*/
struct GNUNET_HELPER_SendHandle *shandle;
/**
+ * The message corresponding to send handle
+ */
+ struct GNUNET_MessageHeader *msg;
+
+ /**
* The port number for ssh; used for helpers starting ssh
*/
char *port;
@@ -484,6 +490,7 @@
{
struct GNUNET_TESTBED_ControllerProc *cp = cls;
const struct GNUNET_TESTBED_HelperReply *msg;
+ const char *hostname;
char *config;
uLongf config_size;
uLongf xconfig_size;
@@ -503,10 +510,13 @@
cp->cfg = GNUNET_CONFIGURATION_create ();
GNUNET_assert (GNUNET_CONFIGURATION_deserialize (cp->cfg, config,
config_size, GNUNET_NO));
+ GNUNET_free (config);
+ if ((NULL == cp->host) ||
+ (NULL == (hostname = GNUNET_TESTBED_host_get_hostname_ (cp->host))))
+ hostname = "localhost";
/* Change the hostname so that we can connect to it */
GNUNET_CONFIGURATION_set_value_string (cp->cfg, "testbed", "hostname",
- (NULL == cp->host) ? "localhost" :
- GNUNET_TESTBED_host_get_hostname_
(cp->host));
+ hostname);
cp->cb (cp->cls, cp->cfg, GNUNET_OK);
return GNUNET_OK;
}
@@ -523,7 +533,11 @@
static void
clear_msg (void *cls, int result)
{
- GNUNET_free (cls);
+ struct GNUNET_TESTBED_ControllerProc *cp = cls;
+
+ GNUNET_assert (NULL != cp->shandle);
+ cp->shandle = NULL;
+ GNUNET_free (cp->msg);
}
@@ -561,10 +575,11 @@
* configuration (port numbers, unix domain sockets and service home
* values are changed as per TESTING library on the remote host)
* @param cb function called when the controller is successfully started or
- * dies unexpectedly; GNUNET_TESTBED_controller_stop shouldn't be
- * called if cb is called with GNUNET_SYSERR as status. Will never be
- * called in the same task as 'GNUNET_TESTBED_controller_start'
- * (synchronous errors will be signalled by returning NULL)
+ * dies unexpectedly; GNUNET_TESTBED_controller_stop shouldn't be
+ * called if cb is called with GNUNET_SYSERR as status. Will never be
+ * called in the same task as 'GNUNET_TESTBED_controller_start'
+ * (synchronous errors will be signalled by returning NULL). This
+ * parameter cannot be NULL.
* @param cls closure for above callbacks
* @return the controller process handle, NULL on errors
*/
@@ -625,8 +640,9 @@
cp->cb = cb;
cp->cls = cls;
msg = GNUNET_TESTBED_create_helper_init_msg_ (controller_ip, cfg);
+ cp->msg = &msg->header;
cp->shandle = GNUNET_HELPER_send (cp->helper, &msg->header, GNUNET_NO,
- &clear_msg, msg);
+ &clear_msg, cp);
if (NULL == cp->shandle)
{
GNUNET_free (msg);
@@ -650,6 +666,8 @@
if (NULL != cp->shandle)
GNUNET_HELPER_send_cancel (cp->shandle);
GNUNET_HELPER_stop (cp->helper);
+ if (NULL != cp->cfg)
+ GNUNET_CONFIGURATION_destroy (cp->cfg);
GNUNET_free_non_null (cp->port);
GNUNET_free_non_null (cp->dst);
GNUNET_free (cp);
Added: gnunet/src/testbed/valgrind-zlib.supp
===================================================================
--- gnunet/src/testbed/valgrind-zlib.supp (rev 0)
+++ gnunet/src/testbed/valgrind-zlib.supp 2012-07-18 13:03:17 UTC (rev
22748)
@@ -0,0 +1,7 @@
+{
+ <ZlibInflateReset2UninitJump>
+ Memcheck:Cond
+ fun:inflateReset2
+ obj:*
+ obj:*
+}
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22748 - in gnunet/src: include testbed,
gnunet <=