diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-30 23:29:26 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-30 23:29:26 +0000 |
commit | b1e42cac7feee71c93d506d8c80f941efbe7b1cb (patch) | |
tree | ed36d76ac52e947ac3058a3febecd8aaafe3efe9 /src/core | |
parent | fd632634bcf2109f61a36bb3adf6d73bea0ae47a (diff) | |
download | gnunet-b1e42cac7feee71c93d506d8c80f941efbe7b1cb.tar.gz gnunet-b1e42cac7feee71c93d506d8c80f941efbe7b1cb.zip |
removing now unnecessary test
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Makefile.am | 12 | ||||
-rw-r--r-- | src/core/test_core_api_mq.c | 151 |
2 files changed, 1 insertions, 162 deletions
diff --git a/src/core/Makefile.am b/src/core/Makefile.am index d22c3e01f..a99f74af6 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am | |||
@@ -24,7 +24,6 @@ lib_LTLIBRARIES = \ | |||
24 | libgnunetcore_la_SOURCES = \ | 24 | libgnunetcore_la_SOURCES = \ |
25 | core_api.c core.h \ | 25 | core_api.c core.h \ |
26 | core_api_2.c \ | 26 | core_api_2.c \ |
27 | core_api_mq.c \ | ||
28 | core_api_monitor_peers.c | 27 | core_api_monitor_peers.c |
29 | libgnunetcore_la_LIBADD = \ | 28 | libgnunetcore_la_LIBADD = \ |
30 | $(top_builddir)/src/util/libgnunetutil.la \ | 29 | $(top_builddir)/src/util/libgnunetutil.la \ |
@@ -61,8 +60,7 @@ gnunet_core_LDADD = \ | |||
61 | 60 | ||
62 | if HAVE_TESTING | 61 | if HAVE_TESTING |
63 | TESTING_TESTS = \ | 62 | TESTING_TESTS = \ |
64 | test_core_api_send_to_self \ | 63 | test_core_api_send_to_self |
65 | test_core_api_mq | ||
66 | endif | 64 | endif |
67 | 65 | ||
68 | check_PROGRAMS = \ | 66 | check_PROGRAMS = \ |
@@ -103,14 +101,6 @@ test_core_api_send_to_self_LDADD = \ | |||
103 | $(top_builddir)/src/transport/libgnunettransport.la \ | 101 | $(top_builddir)/src/transport/libgnunettransport.la \ |
104 | $(top_builddir)/src/util/libgnunetutil.la | 102 | $(top_builddir)/src/util/libgnunetutil.la |
105 | 103 | ||
106 | test_core_api_mq_SOURCES = \ | ||
107 | test_core_api_mq.c | ||
108 | test_core_api_mq_LDADD = \ | ||
109 | libgnunetcore.la \ | ||
110 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
111 | $(top_builddir)/src/transport/libgnunettransport.la \ | ||
112 | $(top_builddir)/src/util/libgnunetutil.la | ||
113 | |||
114 | test_core_api_start_only_SOURCES = \ | 104 | test_core_api_start_only_SOURCES = \ |
115 | test_core_api_start_only.c | 105 | test_core_api_start_only.c |
116 | test_core_api_start_only_LDADD = \ | 106 | test_core_api_start_only_LDADD = \ |
diff --git a/src/core/test_core_api_mq.c b/src/core/test_core_api_mq.c deleted file mode 100644 index 8ece78e58..000000000 --- a/src/core/test_core_api_mq.c +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2013 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 | #include "platform.h" | ||
22 | #include "gnunet_util_lib.h" | ||
23 | #include "gnunet_testing_lib.h" | ||
24 | #include "gnunet_core_service.h" | ||
25 | |||
26 | |||
27 | #define NUM_MSG 5 | ||
28 | |||
29 | /** | ||
30 | * Has the test been successful? | ||
31 | */ | ||
32 | static int result; | ||
33 | |||
34 | static unsigned int num_received; | ||
35 | |||
36 | static struct GNUNET_CORE_Handle *core; | ||
37 | |||
38 | static struct GNUNET_MQ_Handle *mq; | ||
39 | |||
40 | static struct GNUNET_PeerIdentity myself; | ||
41 | |||
42 | |||
43 | static void | ||
44 | init_cb (void *cls, | ||
45 | const struct GNUNET_PeerIdentity *my_identity) | ||
46 | { | ||
47 | if (NULL == my_identity) | ||
48 | { | ||
49 | GNUNET_break (0); | ||
50 | return; | ||
51 | } | ||
52 | myself = *my_identity; | ||
53 | mq = GNUNET_CORE_mq_create (core, my_identity); | ||
54 | } | ||
55 | |||
56 | |||
57 | static void | ||
58 | connect_cb (void *cls, | ||
59 | const struct GNUNET_PeerIdentity *peer) | ||
60 | { | ||
61 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
62 | "Connected to peer %s.\n", | ||
63 | GNUNET_i2s (peer)); | ||
64 | if (0 == memcmp (peer, &myself, sizeof (struct GNUNET_PeerIdentity))) | ||
65 | { | ||
66 | unsigned int i; | ||
67 | struct GNUNET_MQ_Envelope *ev; | ||
68 | |||
69 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
70 | "Queueing messages.\n"); | ||
71 | for (i = 0; i < NUM_MSG; i++) | ||
72 | { | ||
73 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_TEST); | ||
74 | GNUNET_MQ_send (mq, ev); | ||
75 | } | ||
76 | } | ||
77 | } | ||
78 | |||
79 | |||
80 | static int | ||
81 | handle_test (void *cls, | ||
82 | const struct GNUNET_PeerIdentity *other, | ||
83 | const struct GNUNET_MessageHeader *message) | ||
84 | { | ||
85 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
86 | "Got test message %d\n", | ||
87 | num_received); | ||
88 | num_received++; | ||
89 | if (NUM_MSG == num_received) | ||
90 | { | ||
91 | result = GNUNET_OK; | ||
92 | GNUNET_SCHEDULER_shutdown (); | ||
93 | return GNUNET_SYSERR; | ||
94 | } | ||
95 | if (num_received > NUM_MSG) | ||
96 | { | ||
97 | GNUNET_assert (0); | ||
98 | return GNUNET_SYSERR; | ||
99 | } | ||
100 | return GNUNET_OK; | ||
101 | } | ||
102 | |||
103 | |||
104 | static void | ||
105 | shutdown_task (void *cls) | ||
106 | { | ||
107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
108 | "Shutting down\n"); | ||
109 | GNUNET_MQ_destroy (mq); | ||
110 | GNUNET_CORE_disconnect (core); | ||
111 | } | ||
112 | |||
113 | |||
114 | /** | ||
115 | * Initialize framework and start test | ||
116 | * | ||
117 | * @param cls Closure (unused). | ||
118 | * @param cfg Configuration handle. | ||
119 | * @param peer Testing peer handle. | ||
120 | */ | ||
121 | static void | ||
122 | run (void *cls, | ||
123 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
124 | struct GNUNET_TESTING_Peer *peer) | ||
125 | { | ||
126 | static const struct GNUNET_CORE_MessageHandler handlers[] = { | ||
127 | {&handle_test, GNUNET_MESSAGE_TYPE_TEST, 0}, | ||
128 | {NULL, 0, 0} | ||
129 | }; | ||
130 | core = GNUNET_CORE_connect (cfg, | ||
131 | NULL, &init_cb, &connect_cb, NULL, | ||
132 | NULL, GNUNET_NO, NULL, | ||
133 | GNUNET_NO, handlers); | ||
134 | if (NULL == core) | ||
135 | { | ||
136 | GNUNET_assert (0); | ||
137 | return; | ||
138 | } | ||
139 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | ||
140 | } | ||
141 | |||
142 | |||
143 | int | ||
144 | main (int argc, char *argv1[]) | ||
145 | { | ||
146 | if (0 != GNUNET_TESTING_peer_run ("test-core-api-mq", | ||
147 | "test_core_api_peer1.conf", | ||
148 | &run, NULL)) | ||
149 | return 2; | ||
150 | return (result == GNUNET_OK) ? 0 : 1; | ||
151 | } | ||