/**
* @file testbed/test_testbed_api_statistics.c
* @brief testcase for testing GNUNET_TESTBED_get_statistics() implementation
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
+ * @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/
#include "platform.h"
-#include "gnunet_common.h"
+#include "gnunet_util_lib.h"
#include "gnunet_testbed_service.h"
/**
*/
static int result;
+/**
+ * The peers we have seen in the statistics iterator
+ */
+static struct GNUNET_TESTBED_Peer **seen_peers;
+
+/**
+ * Number of peers in the above array
+ */
+static unsigned int num_seen_peers;
+
+
/**
* Fail testcase
*/
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test timed out -- Aborting\n");
abort_task = GNUNET_SCHEDULER_NO_TASK;
if (NULL != op)
- {
+ {
GNUNET_TESTBED_operation_done (op);
op = NULL;
}
const char *subsystem, const char *name, uint64_t value,
int is_persistent)
{
- static struct GNUNET_TESTBED_Peer **seen_peers;
- static unsigned int num_seen_peers;
unsigned int cnt;
-
+
FAIL_TEST (cls == dummy_cls, return GNUNET_SYSERR);
for (cnt = 0; cnt < num_seen_peers; cnt++)
FAIL_TEST (peer != seen_peers[cnt], return GNUNET_SYSERR);
FAIL_TEST (NULL != subsystem, return GNUNET_SYSERR);
- FAIL_TEST (NULL != name, return GNUNET_SYSERR);
+ FAIL_TEST (NULL != name, return GNUNET_SYSERR);
GNUNET_array_append (seen_peers, num_seen_peers,
(struct GNUNET_TESTBED_Peer *) peer);
return GNUNET_SYSERR;
* Signature of a main function for a testcase.
*
* @param cls closure
+ * @param h the run handle
* @param num_peers number of peers in 'peers'
- * @param peers handle to peers run in the testbed
+ * @param peers_ handle to peers run in the testbed
+ * @param links_succeeded the number of overlay link connection attempts that
+ * succeeded
+ * @param links_failed the number of overlay link connection attempts that
+ * failed
*/
static void
-test_master (void *cls, unsigned int num_peers,
- struct GNUNET_TESTBED_Peer **peers_)
+test_master (void *cls,
+ struct GNUNET_TESTBED_RunHandle *h,
+ unsigned int num_peers,
+ struct GNUNET_TESTBED_Peer **peers_,
+ unsigned int links_succeeded,
+ unsigned int links_failed)
{
FAIL_TEST (NUM_PEERS == num_peers, return);
peers = peers_;
op = GNUNET_TESTBED_get_statistics (num_peers, peers,
+ NULL, NULL,
&stats_iterator,
&op_comp_cb,
dummy_cls);
NUM_PEERS,
1LL, NULL, NULL,
&test_master, NULL);
+ GNUNET_free_non_null (seen_peers);
if (GNUNET_OK != result)
return 1;
return 0;