diff options
Diffstat (limited to 'src/testbed/plugin_testcmd.c')
-rw-r--r-- | src/testbed/plugin_testcmd.c | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/testbed/plugin_testcmd.c b/src/testbed/plugin_testcmd.c new file mode 100644 index 000000000..90e4a90a1 --- /dev/null +++ b/src/testbed/plugin_testcmd.c | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2013, 2014 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 testbed/plugin_testcmd.c | ||
23 | * @brief a plugin to provide the API for running test cases. | ||
24 | * @author t3sserakt | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_testing_ng_lib.h" | ||
28 | #include "gnunet_util_lib.h" | ||
29 | #include "gnunet_testing_plugin.h" | ||
30 | |||
31 | |||
32 | |||
33 | |||
34 | |||
35 | static void | ||
36 | start_testcase () | ||
37 | { | ||
38 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | ||
39 | |||
40 | struct GNUNET_TESTING_Command commands[] = { | ||
41 | GNUNET_TESTING_cmd_hello_world_birth ("hello-world-birth-0", | ||
42 | &now), | ||
43 | GNUNET_TESTING_cmd_hello_world ("hello-world-0","hello-world-birth-0",""), | ||
44 | GNUNET_TESTING_cmd_end () | ||
45 | }; | ||
46 | |||
47 | GNUNET_TESTING_run (NULL, | ||
48 | commands, | ||
49 | GNUNET_TIME_UNIT_FOREVER_REL); | ||
50 | |||
51 | } | ||
52 | |||
53 | |||
54 | /** | ||
55 | * Entry point for the plugin. | ||
56 | * | ||
57 | * @param cls NULL | ||
58 | * @return the exported block API | ||
59 | */ | ||
60 | void * | ||
61 | libgnunet_plugin_testcmd_init (void *cls) | ||
62 | { | ||
63 | struct GNUNET_TESTING_PluginFunctions *api; | ||
64 | |||
65 | api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions); | ||
66 | api->start_testcase = &start_testcase; | ||
67 | return api; | ||
68 | } | ||
69 | |||
70 | |||
71 | /** | ||
72 | * Exit point from the plugin. | ||
73 | * | ||
74 | * @param cls the return value from #libgnunet_plugin_block_test_init | ||
75 | * @return NULL | ||
76 | */ | ||
77 | void * | ||
78 | libgnunet_plugin_testcmd_done (void *cls) | ||
79 | { | ||
80 | struct GNUNET_TESTING_PluginFunctions *api = cls; | ||
81 | |||
82 | GNUNET_free (api); | ||
83 | return NULL; | ||
84 | } | ||
85 | |||
86 | |||
87 | /* end of plugin_gnsrecord_dns.c */ | ||