GNUnet 0.21.1
testing.h
Go to the documentation of this file.
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
24#ifndef TESTING_H
25#define TESTING_H
26#include "gnunet_util_lib.h"
28
30
35{
40
41 /* followed by 0-terminated barrier name */
42};
43
49{
54
59
64
65 /* followed by 0-terminated barrier name */
66};
67
69{
74
79
84
85 /* followed by 0-terminated barrier name */
86};
87
89
94{
99
104
109 char *node_ip;
110
116
121 char *global_n;
122
127 char *local_m;
128
133 char *n;
134
139 char *m;
140};
141
143{
145
147
149};
150
151
153{
158
163
168
173
178
182 const char *name;
183
187 unsigned int running_on_master;
188
192 unsigned int expected_reaches;
193
197 unsigned int reached;
198
204
210
211 /*
212 * No barrier locally. Shadow created. Real barrier created elsewhere.
213 */
214 unsigned int shadow;
215};
216
217
225bool
227
228
234bool
236
237
245
246
256void
258 unsigned int new_ip);
259
260
268bool
270
271
277void
279 const char *barrier_name);
280
281
292void
294 const char *barrier_name,
295 unsigned int global_node_number,
296 unsigned int expected_reaches,
298
299
313 unsigned int node_number);
314
315
325 const char *barrier_name);
326
327
334void
336 struct GNUNET_TESTING_Barrier *barrier);
337
338
339#endif
struct GNUNET_TESTING_Interpreter * is
static int write_message(uint16_t message_type, const char *data, size_t data_length)
Write message to the master process.
void(* GNUNET_TESTING_cmd_helper_write_cb)(struct GNUNET_MessageHeader *message, size_t msg_length)
Callback function to write messages from the helper process running on a netjail node to the master p...
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_PACKED
gcc-ism to get packed structs.
Message send by a child loop to inform the master loop how much GNUNET_CMDS_BARRIER_REACHED messages ...
Definition: testing.h:49
uint32_t expected_reaches
How often the child loop will reach the barrier.
Definition: testing.h:58
uint32_t node_number
The number of the node the barrier is running on.
Definition: testing.h:63
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED.
Definition: testing.h:53
Message send to a child loop to inform the child loop about a barrier being advanced.
Definition: testing.h:35
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE.
Definition: testing.h:39
struct CommandListEntry * prev
Definition: testing.h:146
struct CommandListEntry * next
Definition: testing.h:144
struct GNUNET_TESTING_Command * command
Definition: testing.h:148
Internal representation of the hash map.
Header for all communications.
const char * name
Name of the barrier.
Definition: testing.h:182
unsigned int shadow
Definition: testing.h:214
struct GNUNET_TESTING_Barrier * next
Pointer to the next prefix in the DLL.
Definition: testing.h:162
unsigned int number_to_be_reached
Number of commands which need to reach the barrier to change state.
Definition: testing.h:209
struct GNUNET_CONTAINER_MultiShortmap * nodes
Hash map containing the global known nodes which are not natted.
Definition: testing.h:177
struct CommandListEntry * cmds_tail
Tail of the DLL with local commands the barrier is attached too.
Definition: testing.h:172
struct CommandListEntry * cmds_head
Head of the DLL with local commands the barrier is attached too.
Definition: testing.h:167
unsigned int running_on_master
Is this barrier running on the master.
Definition: testing.h:187
double percentage_to_be_reached
Percentage of of commands which need to reach the barrier to change state.
Definition: testing.h:203
struct GNUNET_TESTING_Barrier * prev
Pointer to the previous prefix in the DLL.
Definition: testing.h:157
unsigned int reached
Number of commands which reached this barrier.
Definition: testing.h:197
unsigned int expected_reaches
Number of commands attached to this barrier.
Definition: testing.h:192
uint32_t expected_number_of_reached_messages
The number of reach messages which most likely will send.
Definition: testing.h:83
uint32_t node_number
The number of the node the barrier is reached.
Definition: testing.h:78
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED.
Definition: testing.h:73
A command to be run by the interpreter.
Global state of the interpreter, used by a command to access information about other commands.
Node in the netjail topology.
unsigned int node_number
The overall number of the node in the whole test system.
The plugin API every test case plugin has to implement.
Handle for a plugin.
Definition: testing.h:94
char * global_n
The number of namespaces.
Definition: testing.h:121
char * node_ip
IP address of the specific node the helper is running for.
Definition: testing.h:109
char * local_m
The number of local nodes per namespace.
Definition: testing.h:127
char * plugin_name
Name of the test case plugin.
Definition: testing.h:115
char * n
The number of the namespace this node is in.
Definition: testing.h:133
char * m
The number of the node in the namespace.
Definition: testing.h:139
char * library_name
Name of the shared library.
Definition: testing.h:98
struct GNUNET_TESTING_PluginFunctions * api
Plugin API.
Definition: testing.h:103
struct GNUNET_TESTING_Command * GNUNET_TESTING_cmd_batch_get_current_(const struct GNUNET_TESTING_Command *cmd)
Obtain what command the batch is at.
struct GNUNET_TESTING_Barrier * GNUNET_TESTING_get_barrier_(struct GNUNET_TESTING_Interpreter *is, const char *barrier_name)
Getting a barrier from the interpreter.
void GNUNET_TESTING_cmd_batch_set_current_(const struct GNUNET_TESTING_Command *cmd, unsigned int new_ip)
Set what command the batch should be at.
bool GNUNET_TESTING_cmd_batch_next_(void *cls)
Advance internal pointer to next command.
bool GNUNET_TESTING_cmd_is_batch_(const struct GNUNET_TESTING_Command *cmd)
Test if this command is a batch command.
void GNUNET_TESTING_finish_barrier_(struct GNUNET_TESTING_Interpreter *is, const char *barrier_name)
Finish all "barrier reached" commands attached to this barrier.
struct GNUNET_TESTING_NetjailNode * GNUNET_TESTING_barrier_get_node(struct GNUNET_TESTING_Barrier *barrier, unsigned int node_number)
Getting a node from a map by global node number.
void GNUNET_TESTING_send_barrier_attach_(struct GNUNET_TESTING_Interpreter *is, const char *barrier_name, unsigned int global_node_number, unsigned int expected_reaches, GNUNET_TESTING_cmd_helper_write_cb write_message)
Send message to master loop that cmds being attached to a barrier.
bool GNUNET_TESTING_barrier_crossable_(struct GNUNET_TESTING_Barrier *barrier)
This function checks, if a barrier can be crossed, which actually means that the cmd representing the...
void GNUNET_TESTING_add_barrier_(struct GNUNET_TESTING_Interpreter *is, struct GNUNET_TESTING_Barrier *barrier)
Add a barrier to the loop.