diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-10 14:54:34 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-10 14:54:34 +0000 |
commit | af85737a10af00264c3913d0c53efa9acb7f3535 (patch) | |
tree | ab16b6b19815473d5da003cda41646c935fa001a /src | |
parent | 9831eaa3161d6be1706db49b2ed5019c039ec5b3 (diff) | |
download | gnunet-af85737a10af00264c3913d0c53efa9acb7f3535.tar.gz gnunet-af85737a10af00264c3913d0c53efa9acb7f3535.zip |
remove redundant test
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/Makefile.am | 9 | ||||
-rw-r--r-- | src/transport/test_transport_testing.c | 223 |
2 files changed, 0 insertions, 232 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 43a87ed33..8054aa414 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -435,7 +435,6 @@ check_PROGRAMS = \ | |||
435 | test_transport_address_switch_udp \ | 435 | test_transport_address_switch_udp \ |
436 | test_transport_testing_startstop \ | 436 | test_transport_testing_startstop \ |
437 | test_transport_testing_restart \ | 437 | test_transport_testing_restart \ |
438 | test_transport_testing \ | ||
439 | test_transport_startonly \ | 438 | test_transport_startonly \ |
440 | test_plugin_tcp \ | 439 | test_plugin_tcp \ |
441 | test_plugin_udp \ | 440 | test_plugin_udp \ |
@@ -595,14 +594,6 @@ test_transport_testing_restart_LDADD = \ | |||
595 | $(top_builddir)/src/hello/libgnunethello.la \ | 594 | $(top_builddir)/src/hello/libgnunethello.la \ |
596 | libgnunettransporttesting.la | 595 | libgnunettransporttesting.la |
597 | 596 | ||
598 | test_transport_testing_SOURCES = \ | ||
599 | test_transport_testing.c | ||
600 | test_transport_testing_LDADD = \ | ||
601 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
602 | libgnunettransport.la \ | ||
603 | $(top_builddir)/src/hello/libgnunethello.la \ | ||
604 | libgnunettransporttesting.la | ||
605 | |||
606 | test_transport_api_blacklisting_SOURCES = \ | 597 | test_transport_api_blacklisting_SOURCES = \ |
607 | test_transport_api_blacklisting.c | 598 | test_transport_api_blacklisting.c |
608 | test_transport_api_blacklisting_LDADD = \ | 599 | test_transport_api_blacklisting_LDADD = \ |
diff --git a/src/transport/test_transport_testing.c b/src/transport/test_transport_testing.c deleted file mode 100644 index 2f11b5a1a..000000000 --- a/src/transport/test_transport_testing.c +++ /dev/null | |||
@@ -1,223 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2009, 2010 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | 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 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @file transport/test_transport_testing.c | ||
22 | * @brief base test case for transport implementations | ||
23 | * | ||
24 | * This test case serves as a base for tcp, udp, and udp-nat | ||
25 | * transport test cases. Based on the executable being run | ||
26 | * the correct test case will be performed. Conservation of | ||
27 | * C code apparently. | ||
28 | */ | ||
29 | #include "platform.h" | ||
30 | #include "gnunet_transport_service.h" | ||
31 | #include "transport-testing.h" | ||
32 | /** | ||
33 | * How long until we give up on transmitting the message? | ||
34 | */ | ||
35 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) | ||
36 | |||
37 | static struct GNUNET_SCHEDULER_Task * timeout_task; | ||
38 | |||
39 | static struct GNUNET_TRANSPORT_TESTING_PeerContext *p1; | ||
40 | |||
41 | static struct GNUNET_TRANSPORT_TESTING_PeerContext *p2; | ||
42 | |||
43 | static struct GNUNET_TRANSPORT_TESTING_ConnectRequest * cc; | ||
44 | |||
45 | struct GNUNET_TRANSPORT_TESTING_Handle *tth; | ||
46 | |||
47 | static int connected = GNUNET_NO; | ||
48 | |||
49 | static int ret = 0; | ||
50 | |||
51 | |||
52 | static void | ||
53 | end () | ||
54 | { | ||
55 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
56 | "Stopping peers\n"); | ||
57 | |||
58 | if (timeout_task != NULL) | ||
59 | GNUNET_SCHEDULER_cancel (timeout_task); | ||
60 | |||
61 | GNUNET_TRANSPORT_TESTING_stop_peer (p1); | ||
62 | GNUNET_TRANSPORT_TESTING_stop_peer (p2); | ||
63 | |||
64 | GNUNET_TRANSPORT_TESTING_done (tth); | ||
65 | } | ||
66 | |||
67 | |||
68 | static void | ||
69 | end_badly () | ||
70 | { | ||
71 | timeout_task = NULL; | ||
72 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
73 | "Timeout! Stopping peers\n"); | ||
74 | |||
75 | if (NULL != cc) | ||
76 | { | ||
77 | GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc); | ||
78 | cc = NULL; | ||
79 | } | ||
80 | |||
81 | if (p1 != NULL) | ||
82 | GNUNET_TRANSPORT_TESTING_stop_peer (p1); | ||
83 | if (p2 != NULL) | ||
84 | GNUNET_TRANSPORT_TESTING_stop_peer (p2); | ||
85 | |||
86 | if (NULL != tth) | ||
87 | GNUNET_TRANSPORT_TESTING_done (tth); | ||
88 | |||
89 | ret = GNUNET_SYSERR; | ||
90 | } | ||
91 | |||
92 | |||
93 | static void | ||
94 | testing_connect_cb (void *cls) | ||
95 | { | ||
96 | char *ps = GNUNET_strdup (GNUNET_i2s (&p1->id)); | ||
97 | |||
98 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
99 | "Peer %u (`%4s') connected to peer %u (`%s')!\n", p1->no, ps, | ||
100 | p2->no, GNUNET_i2s (&p2->id)); | ||
101 | GNUNET_free (ps); | ||
102 | GNUNET_SCHEDULER_add_now (&end, NULL); | ||
103 | } | ||
104 | |||
105 | |||
106 | static void | ||
107 | notify_connect (void *cls, | ||
108 | const struct GNUNET_PeerIdentity *peer) | ||
109 | { | ||
110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
111 | "Peer `%s' connected \n", | ||
112 | GNUNET_i2s (peer)); | ||
113 | connected++; | ||
114 | } | ||
115 | |||
116 | |||
117 | static void | ||
118 | notify_disconnect (void *cls, | ||
119 | const struct GNUNET_PeerIdentity *peer) | ||
120 | { | ||
121 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
122 | "Peer `%s' disconnected \n", | ||
123 | GNUNET_i2s (peer)); | ||
124 | } | ||
125 | |||
126 | |||
127 | static void | ||
128 | notify_receive (void *cls, | ||
129 | const struct GNUNET_PeerIdentity *peer, | ||
130 | const struct GNUNET_MessageHeader *message) | ||
131 | { | ||
132 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
133 | "Receiving\n"); | ||
134 | } | ||
135 | |||
136 | |||
137 | static void | ||
138 | start_cb (struct GNUNET_TRANSPORT_TESTING_PeerContext *p, void *cls) | ||
139 | { | ||
140 | static int started; | ||
141 | |||
142 | started++; | ||
143 | |||
144 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
145 | "Peer %u (`%s') started\n", p->no, | ||
146 | GNUNET_i2s (&p->id)); | ||
147 | |||
148 | if (started != 2) | ||
149 | return; | ||
150 | |||
151 | char *sender_c = GNUNET_strdup (GNUNET_i2s (&p1->id)); | ||
152 | |||
153 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
154 | "Test tries to connect peer %u (`%s') -> peer %u (`%s')\n", | ||
155 | p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id)); | ||
156 | GNUNET_free (sender_c); | ||
157 | |||
158 | cc = GNUNET_TRANSPORT_TESTING_connect_peers (p1, | ||
159 | p2, | ||
160 | &testing_connect_cb, | ||
161 | NULL); | ||
162 | } | ||
163 | |||
164 | |||
165 | static void | ||
166 | run (void *cls, char *const *args, const char *cfgfile, | ||
167 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
168 | { | ||
169 | tth = GNUNET_TRANSPORT_TESTING_init (); | ||
170 | |||
171 | timeout_task = | ||
172 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &end_badly, NULL); | ||
173 | |||
174 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting peer\n"); | ||
175 | p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth, | ||
176 | "test_transport_api_tcp_peer1.conf", | ||
177 | 1, ¬ify_receive, ¬ify_connect, | ||
178 | ¬ify_disconnect, &start_cb, p1); | ||
179 | |||
180 | p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth, | ||
181 | "test_transport_api_tcp_peer2.conf", | ||
182 | 2, ¬ify_receive, ¬ify_connect, | ||
183 | ¬ify_disconnect, &start_cb, p2); | ||
184 | |||
185 | if (p1 == NULL) | ||
186 | { | ||
187 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
188 | "Peer1 was not started successfully\n"); | ||
189 | GNUNET_SCHEDULER_shutdown (); | ||
190 | } | ||
191 | if (p2 == NULL) | ||
192 | { | ||
193 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
194 | "Peer2 was not started successfully\n"); | ||
195 | GNUNET_SCHEDULER_shutdown (); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | |||
200 | int | ||
201 | main (int argc, char *argv[]) | ||
202 | { | ||
203 | char *const argv_1[] = { | ||
204 | "test_transport_testing", | ||
205 | "-c", | ||
206 | "test_transport_api_data.conf", | ||
207 | NULL | ||
208 | }; | ||
209 | struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
210 | GNUNET_GETOPT_OPTION_END | ||
211 | }; | ||
212 | |||
213 | GNUNET_log_setup ("test_transport_testing", | ||
214 | "WARNING", | ||
215 | NULL); | ||
216 | GNUNET_PROGRAM_run ((sizeof (argv_1) / sizeof (char *)) - 1, argv_1, | ||
217 | "test_transport_testing", "nohelp", options, | ||
218 | &run, &ret); | ||
219 | |||
220 | return ret; | ||
221 | } | ||
222 | |||
223 | /* end of test_transport_testing.c */ | ||