diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-10-10 15:47:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-10-10 15:47:00 +0000 |
commit | 93085e8a2991fde229400b588a5930e9fcca0d75 (patch) | |
tree | 0384246adbd96fa0138a46ad5fecb777aa40e789 /src/testbed/test_testbed_api_barriers.c | |
parent | 2bf962c76bb82c1f38acea42c7bdfb241e2582e7 (diff) | |
download | gnunet-93085e8a2991fde229400b588a5930e9fcca0d75.tar.gz gnunet-93085e8a2991fde229400b588a5930e9fcca0d75.zip |
migrating testbed to new service API
Diffstat (limited to 'src/testbed/test_testbed_api_barriers.c')
-rw-r--r-- | src/testbed/test_testbed_api_barriers.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/testbed/test_testbed_api_barriers.c b/src/testbed/test_testbed_api_barriers.c index 8ee9c41af..01c745a75 100644 --- a/src/testbed/test_testbed_api_barriers.c +++ b/src/testbed/test_testbed_api_barriers.c | |||
@@ -50,7 +50,7 @@ struct GNUNET_TESTBED_Barrier *barrier; | |||
50 | /** | 50 | /** |
51 | * Identifier for the shutdown task | 51 | * Identifier for the shutdown task |
52 | */ | 52 | */ |
53 | static struct GNUNET_SCHEDULER_Task * shutdown_task; | 53 | static struct GNUNET_SCHEDULER_Task *shutdown_task; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Result of this test case | 56 | * Result of this test case |
@@ -85,9 +85,9 @@ do_shutdown (void *cls) | |||
85 | * @param cls the closure given to GNUNET_TESTBED_barrier_init() | 85 | * @param cls the closure given to GNUNET_TESTBED_barrier_init() |
86 | * @param name the name of the barrier | 86 | * @param name the name of the barrier |
87 | * @param barrier the barrier handle | 87 | * @param barrier the barrier handle |
88 | * @param status status of the barrier; GNUNET_OK if the barrier is crossed; | 88 | * @param status status of the barrier; #GNUNET_OK if the barrier is crossed; |
89 | * GNUNET_SYSERR upon error | 89 | * #GNUNET_SYSERR upon error |
90 | * @param emsg if the status were to be GNUNET_SYSERR, this parameter has the | 90 | * @param emsg if the status were to be #GNUNET_SYSERR, this parameter has the |
91 | * error messsage | 91 | * error messsage |
92 | */ | 92 | */ |
93 | static void | 93 | static void |
@@ -104,17 +104,20 @@ barrier_cb (void *cls, | |||
104 | switch (status) | 104 | switch (status) |
105 | { | 105 | { |
106 | case GNUNET_TESTBED_BARRIERSTATUS_INITIALISED: | 106 | case GNUNET_TESTBED_BARRIERSTATUS_INITIALISED: |
107 | LOG (GNUNET_ERROR_TYPE_INFO, "Barrier initialised\n"); | 107 | LOG (GNUNET_ERROR_TYPE_INFO, |
108 | "Barrier initialised\n"); | ||
108 | old_status = status; | 109 | old_status = status; |
109 | return; | 110 | return; |
110 | case GNUNET_TESTBED_BARRIERSTATUS_ERROR: | 111 | case GNUNET_TESTBED_BARRIERSTATUS_ERROR: |
111 | LOG (GNUNET_ERROR_TYPE_ERROR, "Barrier initialisation failed: %s", | 112 | LOG (GNUNET_ERROR_TYPE_ERROR, |
113 | "Barrier initialisation failed: %s", | ||
112 | (NULL == emsg) ? "unknown reason" : emsg); | 114 | (NULL == emsg) ? "unknown reason" : emsg); |
113 | barrier = NULL; | 115 | barrier = NULL; |
114 | GNUNET_SCHEDULER_shutdown (); | 116 | GNUNET_SCHEDULER_shutdown (); |
115 | return; | 117 | return; |
116 | case GNUNET_TESTBED_BARRIERSTATUS_CROSSED: | 118 | case GNUNET_TESTBED_BARRIERSTATUS_CROSSED: |
117 | LOG (GNUNET_ERROR_TYPE_INFO, "Barrier crossed\n"); | 119 | LOG (GNUNET_ERROR_TYPE_INFO, |
120 | "Barrier crossed\n"); | ||
118 | if (old_status == GNUNET_TESTBED_BARRIERSTATUS_INITIALISED) | 121 | if (old_status == GNUNET_TESTBED_BARRIERSTATUS_INITIALISED) |
119 | result = GNUNET_OK; | 122 | result = GNUNET_OK; |
120 | barrier = NULL; | 123 | barrier = NULL; |
@@ -151,13 +154,17 @@ test_master (void *cls, | |||
151 | GNUNET_assert (NULL == cls); | 154 | GNUNET_assert (NULL == cls); |
152 | if (NULL == peers_) | 155 | if (NULL == peers_) |
153 | { | 156 | { |
154 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failing test due to timeout\n"); | 157 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
158 | "Failing test due to timeout\n"); | ||
155 | return; | 159 | return; |
156 | } | 160 | } |
157 | GNUNET_assert (NUM_PEERS == num_peers); | 161 | GNUNET_assert (NUM_PEERS == num_peers); |
158 | c = GNUNET_TESTBED_run_get_controller_handle (h); | 162 | c = GNUNET_TESTBED_run_get_controller_handle (h); |
159 | barrier = GNUNET_TESTBED_barrier_init (c, TEST_BARRIER_NAME, 100, | 163 | barrier = GNUNET_TESTBED_barrier_init (c, |
160 | &barrier_cb, NULL); | 164 | TEST_BARRIER_NAME, |
165 | 100, | ||
166 | &barrier_cb, | ||
167 | NULL); | ||
161 | shutdown_task = | 168 | shutdown_task = |
162 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 169 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
163 | (GNUNET_TIME_UNIT_SECONDS, | 170 | (GNUNET_TIME_UNIT_SECONDS, |