[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27045 - in gnunet/src: include testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27045 - in gnunet/src: include testing |
Date: |
Tue, 7 May 2013 12:54:03 +0200 |
Author: harsha
Date: 2013-05-07 12:54:03 +0200 (Tue, 07 May 2013)
New Revision: 27045
Modified:
gnunet/src/include/gnunet_testing_lib.h
gnunet/src/testing/test_testing_peerstartup2.c
gnunet/src/testing/testing.c
Log:
- add GNUNET_TESTING_peer_stop_async_cancel()
Modified: gnunet/src/include/gnunet_testing_lib.h
===================================================================
--- gnunet/src/include/gnunet_testing_lib.h 2013-05-06 16:06:08 UTC (rev
27044)
+++ gnunet/src/include/gnunet_testing_lib.h 2013-05-07 10:54:03 UTC (rev
27045)
@@ -350,6 +350,19 @@
/**
+ * Cancel a previous asynchronous peer stop request.
+ * GNUNET_TESTING_peer_stop_async() should have been called before on the given
+ * peer. It is an error to call this function if the peer stop callback was
+ * already called
+ *
+ * @param peer the peer on which GNUNET_TESTING_peer_stop_async() was called
+ * before.
+ */
+void
+GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer);
+
+
+/**
* Signature of the 'main' function for a (single-peer) testcase that
* is run using 'GNUNET_TESTING_peer_run'.
*
Modified: gnunet/src/testing/test_testing_peerstartup2.c
===================================================================
--- gnunet/src/testing/test_testing_peerstartup2.c 2013-05-06 16:06:08 UTC
(rev 27044)
+++ gnunet/src/testing/test_testing_peerstartup2.c 2013-05-07 10:54:03 UTC
(rev 27045)
@@ -148,10 +148,9 @@
GNUNET_TESTING_peer_stop_async (test_ctx->peer,
&peer_status_cb,
test_ctx));
-
}
else
- do_shutdown (test_ctx, tc);
+ do_shutdown2 (test_ctx, tc);
}
@@ -187,6 +186,11 @@
if (GNUNET_OK != GNUNET_TESTING_peer_start (test_ctx->peer))
goto end;
test_ctx->state = PEER_STARTED;
+ FAIL_TEST (GNUNET_OK ==
+ GNUNET_TESTING_peer_stop_async (test_ctx->peer,
+ &peer_status_cb,
+ test_ctx));
+ GNUNET_TESTING_peer_stop_async_cancel (test_ctx->peer);
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
&do_shutdown, test_ctx);
return;
Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c 2013-05-06 16:06:08 UTC (rev 27044)
+++ gnunet/src/testing/testing.c 2013-05-07 10:54:03 UTC (rev 27045)
@@ -1539,6 +1539,24 @@
/**
+ * Cancel a previous asynchronous peer stop request.
+ * GNUNET_TESTING_peer_stop_async() should have been called before on the given
+ * peer. It is an error to call this function if the peer stop callback was
+ * already called
+ *
+ * @param peer the peer on which GNUNET_TESTING_peer_stop_async() was called
+ * before.
+ */
+void
+GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer)
+{
+ GNUNET_assert (NULL != peer->ah);
+ GNUNET_ARM_disconnect_and_free (peer->ah);
+ peer->ah = NULL;
+}
+
+
+/**
* Destroy the peer. Releases resources locked during peer configuration.
* If the peer is still running, it will be stopped AND a warning will be
* printed (users of the API should stop the peer explicitly first).
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27045 - in gnunet/src: include testing,
gnunet <=