testing api addition
authorNathan S. Evans <evans@in.tum.de>
Fri, 17 Sep 2010 15:56:15 +0000 (15:56 +0000)
committerNathan S. Evans <evans@in.tum.de>
Fri, 17 Sep 2010 15:56:15 +0000 (15:56 +0000)
src/include/gnunet_testing_lib.h
src/testing/testing.c

index 10b1d5a87cd09a9549751c25a5379649f49576e3..488d1a94be4ca35dd2abdb72c2d6aa2eeadec017 100644 (file)
@@ -447,6 +447,17 @@ GNUNET_TESTING_daemon_start (struct GNUNET_SCHEDULER_Handle *sched,
 void
 GNUNET_TESTING_daemon_continue_startup(struct GNUNET_TESTING_Daemon *daemon);
 
+/**
+ * Check whether the given daemon is running.
+ *
+ * @param daemon the daemon to check
+ *
+ * @return GNUNET_YES if the daemon is up, GNUNET_NO if the
+ *         daemon is down, GNUNET_SYSERR on error.
+ */
+int
+GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon);
+
 /**
  * Restart (stop and start) a GNUnet daemon.
  *
index e493f5f6c7ee9111eec932fd83e2df98cc2a3ece..f2150697fcb91e3a2570a2721acc369e46a1b3f1 100644 (file)
@@ -696,6 +696,25 @@ GNUNET_TESTING_daemon_continue_startup(struct GNUNET_TESTING_Daemon *daemon)
   daemon->phase = SP_TOPOLOGY_SETUP;
 }
 
+/**
+ * Check whether the given daemon is running.
+ *
+ * @param daemon the daemon to check
+ *
+ * @return GNUNET_YES if the daemon is up, GNUNET_NO if the
+ *         daemon is down, GNUNET_SYSERR on error.
+ */
+int
+GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon)
+{
+  if (daemon == NULL)
+    return GNUNET_SYSERR;
+
+  if (daemon->running == GNUNET_YES)
+    return GNUNET_YES;
+  return GNUNET_NO;
+}
+
 
 /**
  * Start a peer that has previously been stopped using the daemon_stop