diff options
Diffstat (limited to 'src/testbed/test_testbed_api_test_timeout.c')
-rw-r--r-- | src/testbed/test_testbed_api_test_timeout.c | 126 |
1 files changed, 0 insertions, 126 deletions
diff --git a/src/testbed/test_testbed_api_test_timeout.c b/src/testbed/test_testbed_api_test_timeout.c deleted file mode 100644 index fe76ad441..000000000 --- a/src/testbed/test_testbed_api_test_timeout.c +++ /dev/null | |||
@@ -1,126 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2008--2013 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file src/testbed/test_testbed_api_test.c | ||
23 | * @brief testing cases for testing notifications via test master callback upon | ||
24 | * timeout while setting up testbed using functions | ||
25 | * GNUNET_TESTBED_test_run() | ||
26 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> | ||
27 | */ | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_util_lib.h" | ||
31 | #include "gnunet_testbed_service.h" | ||
32 | |||
33 | |||
34 | /** | ||
35 | * Generic logging shortcut | ||
36 | */ | ||
37 | #define LOG(kind, ...) \ | ||
38 | GNUNET_log (kind, __VA_ARGS__) | ||
39 | |||
40 | /** | ||
41 | * Number of peers we want to start | ||
42 | */ | ||
43 | #define NUM_PEERS 25 | ||
44 | |||
45 | /** | ||
46 | * Testing result | ||
47 | */ | ||
48 | static int result; | ||
49 | |||
50 | |||
51 | /** | ||
52 | * shortcut to exit during failure | ||
53 | */ | ||
54 | #define FAIL_TEST(cond) do { \ | ||
55 | if (! (cond)) { \ | ||
56 | GNUNET_break (0); \ | ||
57 | GNUNET_SCHEDULER_shutdown (); \ | ||
58 | return; \ | ||
59 | } \ | ||
60 | } while (0) | ||
61 | |||
62 | |||
63 | /** | ||
64 | * Controller event callback | ||
65 | * | ||
66 | * @param cls NULL | ||
67 | * @param event the controller event | ||
68 | */ | ||
69 | static void | ||
70 | controller_event_cb (void *cls, | ||
71 | const struct GNUNET_TESTBED_EventInformation *event) | ||
72 | { | ||
73 | FAIL_TEST (0); | ||
74 | } | ||
75 | |||
76 | |||
77 | /** | ||
78 | * Signature of a main function for a testcase. | ||
79 | * | ||
80 | * @param cls closure | ||
81 | * @param h the run handle | ||
82 | * @param num_peers number of peers in 'peers' | ||
83 | * @param peers- handle to peers run in the testbed | ||
84 | * @param links_succeeded the number of overlay link connection attempts that | ||
85 | * succeeded | ||
86 | * @param links_failed the number of overlay link connection attempts that | ||
87 | * failed | ||
88 | */ | ||
89 | static void | ||
90 | test_master (void *cls, | ||
91 | struct GNUNET_TESTBED_RunHandle *h, | ||
92 | unsigned int num_peers, | ||
93 | struct GNUNET_TESTBED_Peer **peers_, | ||
94 | unsigned int links_succeeded, | ||
95 | unsigned int links_failed) | ||
96 | { | ||
97 | FAIL_TEST (NULL == cls); | ||
98 | FAIL_TEST (0 == num_peers); | ||
99 | FAIL_TEST (NULL == peers_); | ||
100 | result = GNUNET_OK; | ||
101 | GNUNET_SCHEDULER_shutdown (); | ||
102 | } | ||
103 | |||
104 | |||
105 | /** | ||
106 | * Main function | ||
107 | */ | ||
108 | int | ||
109 | main (int argc, char **argv) | ||
110 | { | ||
111 | uint64_t event_mask; | ||
112 | |||
113 | result = GNUNET_SYSERR; | ||
114 | event_mask = 0; | ||
115 | (void) GNUNET_TESTBED_test_run ("test_testbed_api_test", | ||
116 | "test_testbed_api_test_timeout.conf", | ||
117 | NUM_PEERS, | ||
118 | event_mask, &controller_event_cb, NULL, | ||
119 | &test_master, NULL); | ||
120 | if (GNUNET_OK != result) | ||
121 | return 1; | ||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | |||
126 | /* end of test_testbed_api_test.c */ | ||