aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_testing_plugin_testcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/test_testing_plugin_testcmd.c')
-rw-r--r--src/testing/test_testing_plugin_testcmd.c123
1 files changed, 0 insertions, 123 deletions
diff --git a/src/testing/test_testing_plugin_testcmd.c b/src/testing/test_testing_plugin_testcmd.c
deleted file mode 100644
index 32e2b38a7..000000000
--- a/src/testing/test_testing_plugin_testcmd.c
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 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 * @file testbed/plugin_testcmd.c
22 * @brief a plugin to provide the API for running test cases.
23 * @author t3sserakt
24 *
25 * // FIXME: too verbose, no logic to return final status, will segv!
26 */
27#include "platform.h"
28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_util_lib.h"
30#include "gnunet_testing_ng_lib.h"
31
32/**
33 * Generic logging shortcut
34 */
35#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
36
37
38// FIXME: bad global!
39unsigned int are_all_peers_started;
40
41
42static void
43all_peers_started ()
44{
45 are_all_peers_started = GNUNET_YES;
46 LOG (GNUNET_ERROR_TYPE_ERROR,
47 "setting are_all_peers_started: %d\n",
48 are_all_peers_started);
49}
50
51
52static void
53start_testcase (TESTING_CMD_HELPER_write_cb write_message,
54 char *router_ip,
55 char *node_ip,
56 char *n,
57 char *m,
58 char *local_m)
59{
60 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
61
62 LOG (GNUNET_ERROR_TYPE_ERROR,
63 "We got here 6!\n");
64
65 are_all_peers_started = GNUNET_NO;
66
67 struct GNUNET_TESTING_Command commands[] = {
68 GNUNET_TESTING_cmd_hello_world_birth ("hello-world-birth-0",
69 &now),
70 GNUNET_TESTING_cmd_hello_world ("hello-world-0","hello-world-birth-0",""),
71 GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1",
72 write_message),
73 GNUNET_TESTING_cmd_block_until_all_peers_started ("block-1",
74 &are_all_peers_started),
75 GNUNET_TESTING_cmd_local_test_finished ("local-test-finished-1",
76 write_message)
77 };
78
79 GNUNET_TESTING_run (commands,
80 GNUNET_TIME_UNIT_FOREVER_REL,
81 NULL, /* FIXME: pass continuation! */
82 NULL);
83 LOG (GNUNET_ERROR_TYPE_ERROR,
84 "We got here 7!\n");
85
86}
87
88
89/**
90 * Entry point for the plugin.
91 *
92 * @param cls NULL
93 * @return the exported block API
94 */
95void *
96libgnunet_plugin_testcmd_init (void *cls)
97{
98 struct GNUNET_TESTING_PluginFunctions *api;
99
100 api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions);
101 api->start_testcase = &start_testcase;
102 api->all_peers_started = &all_peers_started;
103 return api;
104}
105
106
107/**
108 * Exit point from the plugin.
109 *
110 * @param cls the return value from #libgnunet_plugin_block_test_init
111 * @return NULL
112 */
113void *
114libgnunet_plugin_testcmd_done (void *cls)
115{
116 struct GNUNET_TESTING_PluginFunctions *api = cls;
117
118 GNUNET_free (api);
119 return NULL;
120}
121
122
123