diff options
Diffstat (limited to 'src/testbed/test_testbed_api_barriers.c')
-rw-r--r-- | src/testbed/test_testbed_api_barriers.c | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/src/testbed/test_testbed_api_barriers.c b/src/testbed/test_testbed_api_barriers.c index 1e6a8012d..b40fbc87a 100644 --- a/src/testbed/test_testbed_api_barriers.c +++ b/src/testbed/test_testbed_api_barriers.c | |||
@@ -24,8 +24,74 @@ | |||
24 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> | 24 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "platform.h" | ||
28 | #include "gnunet_util_lib.h" | ||
29 | #include "gnunet_testbed_service.h" | ||
27 | 30 | ||
28 | int main () | 31 | /** |
32 | * Number of peers we start in this test case | ||
33 | */ | ||
34 | #define NUM_PEERS 3 | ||
35 | |||
36 | /** | ||
37 | * Result of this test case | ||
38 | */ | ||
39 | static int result; | ||
40 | |||
41 | |||
42 | /** | ||
43 | * Signature of a main function for a testcase. | ||
44 | * | ||
45 | * @param cls closure | ||
46 | * @param h the run handle | ||
47 | * @param num_peers number of peers in 'peers' | ||
48 | * @param peers_ handle to peers run in the testbed | ||
49 | * @param links_succeeded the number of overlay link connection attempts that | ||
50 | * succeeded | ||
51 | * @param links_failed the number of overlay link connection attempts that | ||
52 | * failed | ||
53 | */ | ||
54 | static void | ||
55 | test_master (void *cls, | ||
56 | struct GNUNET_TESTBED_RunHandle *h, | ||
57 | unsigned int num_peers, | ||
58 | struct GNUNET_TESTBED_Peer **peers_, | ||
59 | unsigned int links_succeeded, | ||
60 | unsigned int links_failed) | ||
29 | { | 61 | { |
62 | |||
63 | GNUNET_assert (NULL == cls); | ||
64 | if (NULL == peers_) | ||
65 | { | ||
66 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failing test due to timeout\n"); | ||
67 | return; | ||
68 | } | ||
69 | GNUNET_assert (NUM_PEERS == num_peers); | ||
70 | |||
71 | result = GNUNET_OK; | ||
72 | GNUNET_SCHEDULER_shutdown (); | ||
73 | /* shutdown_task = */ | ||
74 | /* GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply */ | ||
75 | /* (GNUNET_TIME_UNIT_SECONDS, 300), */ | ||
76 | /* do_shutdown, NULL); */ | ||
77 | } | ||
78 | |||
79 | |||
80 | /** | ||
81 | * Main function | ||
82 | */ | ||
83 | int | ||
84 | main (int argc, char **argv) | ||
85 | { | ||
86 | uint64_t event_mask; | ||
87 | |||
88 | result = GNUNET_SYSERR; | ||
89 | event_mask = 0; | ||
90 | (void) GNUNET_TESTBED_test_run ("test_testbed_api_test", | ||
91 | "test_testbed_api_barriers.conf", NUM_PEERS, | ||
92 | event_mask, NULL, NULL, | ||
93 | &test_master, NULL); | ||
94 | if (GNUNET_OK != result) | ||
95 | return 1; | ||
30 | return 0; | 96 | return 0; |
31 | } | 97 | } |