GNUnet 0.22.1
gnunet-testing-netjail-launcher.c
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
26#include "platform.h"
27#include "gnunet_testing_lib.h"
28#include "gnunet_util_lib.h"
29
30#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
31
32int
33main (int argc,
34 char *const *argv)
35{
36 char *filename = NULL;
37 char *topology_data = NULL;
38
39 GNUNET_log_setup ("test-netjail",
40 "INFO",
41 NULL);
42 if (NULL == argv[1])
43 {
44 GNUNET_break (0);
45 return EXIT_FAILURE;
46 }
47 if (0 == strcmp ("-s", argv[1]))
48 {
49 topology_data = argv[2];
50 if (NULL == topology_data)
51 {
52 GNUNET_break (0);
53 return EXIT_FAILURE;
54 }
55 }
56 else
57 {
58 filename = argv[1];
59 }
60 {
62 NULL == filename
64 "load-topology",
65 topology_data)
67 "load-topology",
68 filename),
69#if FUTURE
70 GNUNET_TESTING_cmd_barrier_create ("peers-started-barrier",
71 NUM_PEERS),
72#endif
75 "netjail-start",
77 "load-topology")),
78 GNUNET_TESTING_cmd_finish ("wait-netjail-start",
79 "netjail-start",
82 "netjail-start-testbed",
83 "load-topology",
84 TIMEOUT),
86 };
87
89 TIMEOUT);
90 }
91}
static struct VoipCommand commands[]
List of supported commands.
static char * filename
int main(int argc, char *const *argv)
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_netjail_start_helpers(const char *label, const char *topology_cmd_label, struct GNUNET_TIME_Relative timeout)
Create command.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_barrier_create(const char *label, unsigned int number_to_be_reached)
Command to create a barrier.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_netjail_setup(const char *label, const char *script, const char *topology_cmd_label)
This command executes a shell script to setup the netjail environment.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_load_topology_from_string(const char *label, const char *topology_data)
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_load_topology_from_file(const char *label, const char *filename)
#define GNUNET_TESTING_NETJAIL_START_SCRIPT
const struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_finish(const char *finish_label, const char *cmd_ref, struct GNUNET_TIME_Relative timeout)
Create (synchronous) command that waits for another command to finish.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_make_unblocking(struct GNUNET_TESTING_Command cmd)
Turn asynchronous command into non-blocking command by setting asynchronous_finish to true.
int GNUNET_TESTING_main(const struct GNUNET_TESTING_Command *commands, struct GNUNET_TIME_Relative timeout)
Start a GNUnet scheduler event loop and run the testsuite.
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_end(void)
Create command array terminator.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
enum GNUNET_GenericReturnValue GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
#define GNUNET_TIME_UNIT_SECONDS
One second.
A command to be run by the interpreter.
#define NUM_PEERS
Definition: testbed_test.c:8