gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 02/02: - moved test code from testbed to testing


From: gnunet
Subject: [gnunet] 02/02: - moved test code from testbed to testing
Date: Tue, 17 Aug 2021 20:01:13 +0200

This is an automated email from the git hooks/post-receive script.

t3sserakt pushed a commit to branch master
in repository gnunet.

commit 32a8c505c1fa27bb43c4e7c8d288566d51417f56
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Tue Aug 17 19:57:12 2021 +0200

    - moved test code from testbed to testing
---
 po/POTFILES.in                                     |  16 +-
 src/include/Makefile.am                            |   1 -
 src/include/gnunet_testbed_ng_service.h            | 110 -----
 src/include/gnunet_testing_ng_lib.h                |  68 +++
 src/testbed/Makefile.am                            |  41 --
 src/testbed/testbed_api.h                          |   6 +-
 src/testbed/testbed_api_cmd_send_peer_ready.c      | 103 ----
 src/testbed/testbed_api_hosts.c                    |  53 +-
 src/testbed/testbed_helper.h                       |  54 --
 src/testing/Makefile.am                            |  41 ++
 src/{testbed => testing}/gnunet-cmds-helper.c      |  11 +-
 .../test_testing_api_cmd_netjail.c}                |   1 -
 .../test_testing_plugin_testcmd.c}                 |   2 +-
 ...esting_api_cmd_block_until_all_peers_started.c} |   0
 .../testing_api_cmd_local_test_finished.c}         |   2 +-
 .../testing_api_cmd_netjail_start.c}               |   1 -
 .../testing_api_cmd_netjail_start_testsystem.c     | 541 +++++++++++++++++++++
 .../testing_api_cmd_netjail_stop.c}                |   1 -
 .../testing_api_cmd_netjail_stop_testsystem.c}     |   4 +-
 src/testing/testing_api_cmd_send_peer_ready.c      |   5 +-
 .../testbed_helper.h => testing/testing_cmds.h}    |  71 +--
 src/transport/Makefile.am                          |  27 +-
 src/transport/test_transport_api_cmd_simple_send.c |   3 +-
 ...d.c => test_transport_plugin_cmd_simple_send.c} |  32 +-
 24 files changed, 728 insertions(+), 466 deletions(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8ed952089..6675d0d25 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -396,7 +396,6 @@ src/template/gnunet-template.c
 src/testbed-logger/gnunet-service-testbed-logger.c
 src/testbed-logger/testbed_logger_api.c
 src/testbed/generate-underlay-topology.c
-src/testbed/gnunet-cmds-helper.c
 src/testbed/gnunet-daemon-latency-logger.c
 src/testbed/gnunet-daemon-testbed-blacklist.c
 src/testbed/gnunet-daemon-testbed-underlay.c
@@ -414,16 +413,9 @@ src/testbed/gnunet-service-testbed_peers.c
 src/testbed/gnunet-testbed-profiler.c
 src/testbed/gnunet_mpi_test.c
 src/testbed/gnunet_testbed_mpi_spawn.c
-src/testbed/plugin_testcmd.c
 src/testbed/testbed_api.c
 src/testbed/testbed_api_barriers.c
-src/testbed/testbed_api_cmd_block_until_all_peers_started.c
-src/testbed/testbed_api_cmd_local_test_finished.c
-src/testbed/testbed_api_cmd_netjail_start.c
 src/testbed/testbed_api_cmd_netjail_start_testbed.c
-src/testbed/testbed_api_cmd_netjail_stop.c
-src/testbed/testbed_api_cmd_netjail_stop_testbed.c
-src/testbed/testbed_api_cmd_send_peer_ready.c
 src/testbed/testbed_api_hosts.c
 src/testbed/testbed_api_operations.c
 src/testbed/testbed_api_peers.c
@@ -434,12 +426,19 @@ src/testbed/testbed_api_test.c
 src/testbed/testbed_api_testbed.c
 src/testbed/testbed_api_topology.c
 src/testbed/testbed_api_underlay.c
+src/testing/gnunet-cmds-helper.c
 src/testing/gnunet-testing.c
 src/testing/list-keys.c
 src/testing/testing.c
 src/testing/testing_api_cmd_batch.c
+src/testing/testing_api_cmd_block_until_all_peers_started.c
 src/testing/testing_api_cmd_hello_world.c
 src/testing/testing_api_cmd_hello_world_birth.c
+src/testing/testing_api_cmd_local_test_finished.c
+src/testing/testing_api_cmd_netjail_start.c
+src/testing/testing_api_cmd_netjail_start_testbed.c
+src/testing/testing_api_cmd_netjail_stop.c
+src/testing/testing_api_cmd_netjail_stop_testbed.c
 src/testing/testing_api_cmd_send_peer_ready.c
 src/testing/testing_api_cmd_system_create.c
 src/testing/testing_api_loop.c
@@ -466,7 +465,6 @@ src/transport/gnunet-transport-profiler.c
 src/transport/gnunet-transport-wlan-receiver.c
 src/transport/gnunet-transport-wlan-sender.c
 src/transport/gnunet-transport.c
-src/transport/plugin_cmd_simple_send.c
 src/transport/plugin_transport_http_client.c
 src/transport/plugin_transport_http_common.c
 src/transport/plugin_transport_http_server.c
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 16ff25350..9c22b5977 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -115,7 +115,6 @@ gnunetinclude_HEADERS = \
   gnunet_strings_lib.h \
   gnunet_testbed_service.h \
   gnunet_testbed_logger_service.h \
-  gnunet_testbed_ng_service.h \
   gnunet_testing_lib.h \
   gnunet_testing_plugin.h \
   gnunet_testing_ng_lib.h \
diff --git a/src/include/gnunet_testbed_ng_service.h 
b/src/include/gnunet_testbed_ng_service.h
deleted file mode 100644
index 5979cd85a..000000000
--- a/src/include/gnunet_testbed_ng_service.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-      This file is part of GNUnet
-      Copyright (C) 2021 GNUnet e.V.
-
-      GNUnet is free software: you can redistribute it and/or modify it
-      under the terms of the GNU Affero General Public License as published
-      by the Free Software Foundation, either version 3 of the License,
-      or (at your option) any later version.
-
-      GNUnet is distributed in the hope that it will be useful, but
-      WITHOUT ANY WARRANTY; without even the implied warranty of
-      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-      Affero General Public License for more details.
-
-      You should have received a copy of the GNU Affero General Public License
-      along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @author t3sserakt
- *
- * @file
- * API for writing tests and creating large-scale emulation testbeds for 
GNUnet with command pattern.
- *
- * @defgroup testbed  Testbed service
- * Writing tests and creating large-scale emulation testbeds for GNUnet with 
command pattern.
- *
- * @see 
[Documentation](https://docs.gnunet.org/handbook/gnunet.html#TESTBED-NG-Subsystem)
- *
- * @{
- */
-
-#ifndef GNUNET_TESTBED_NG_SERVICE_H
-#define GNUNET_TESTBED_NG_SERVICE_H
-
-#include "gnunet_util_lib.h"
-#include "gnunet_testing_ng_lib.h"
-
-
-/**
- * Create command.
- *
- * @param label name for command.
- * @param binaryname to start.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_start (const char *label,
-                                  char *local_m,
-                                  char *global_n);
-
-
-/**
- * Create command.
- *
- * @param label name for command.
- * @param binaryname to exec.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label,
-                                                 char *local_m,
-                                                 char *global_n,
-                                                 char *plugin_name,
-                                                 unsigned int *rv);
-
-
-/**
- * Create command.
- *
- * @param label name for command.
- * @param binaryname to stop.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_stop (const char *label,
-                                 char *local_m,
-                                 char *global_n);
-
-
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_stop_testing_system (const char *label,
-                                        const char *helper_start_label,
-                                        char *local_m,
-                                        char *global_n);
-
-
-int
-GNUNET_TESTING_get_trait_helper_handles (const struct
-                                         GNUNET_TESTING_Command *cmd,
-                                         struct GNUNET_HELPER_Handle 
***helper);
-
-
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label,
-                                                  unsigned int *
-                                                  all_peers_started);
-
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_send_peer_ready (const char *label,
-                                    TESTING_CMD_HELPER_write_cb write_message);
-
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_local_test_finished (const char *label,
-                                        TESTING_CMD_HELPER_write_cb
-                                        write_message);
-
-#endif
diff --git a/src/include/gnunet_testing_ng_lib.h 
b/src/include/gnunet_testing_ng_lib.h
index aad7ddec2..035d1bcad 100644
--- a/src/include/gnunet_testing_ng_lib.h
+++ b/src/include/gnunet_testing_ng_lib.h
@@ -842,4 +842,72 @@ struct GNUNET_TESTING_Command
 GNUNET_TESTING_cmd_system_create (const char *label,
                                   const char *testdir);
 
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param binaryname to start.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_netjail_start (const char *label,
+                                  char *local_m,
+                                  char *global_n);
+
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param binaryname to exec.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label,
+                                                 char *local_m,
+                                                 char *global_n,
+                                                 char *plugin_name,
+                                                 unsigned int *rv);
+
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param binaryname to stop.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_netjail_stop (const char *label,
+                                 char *local_m,
+                                 char *global_n);
+
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_stop_testing_system (const char *label,
+                                        const char *helper_start_label,
+                                        char *local_m,
+                                        char *global_n);
+
+
+int
+GNUNET_TESTING_get_trait_helper_handles (const struct
+                                         GNUNET_TESTING_Command *cmd,
+                                         struct GNUNET_HELPER_Handle 
***helper);
+
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label,
+                                                  unsigned int *
+                                                  all_peers_started);
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_send_peer_ready (const char *label,
+                                    TESTING_CMD_HELPER_write_cb write_message);
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_local_test_finished (const char *label,
+                                        TESTING_CMD_HELPER_write_cb
+                                        write_message);
 #endif
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am
index 5a221cd69..d1f43f0f6 100644
--- a/src/testbed/Makefile.am
+++ b/src/testbed/Makefile.am
@@ -23,7 +23,6 @@ if HAVE_SQLITE
 endif
 
 libexec_PROGRAMS = \
-  gnunet-cmds-helper \
   gnunet-service-testbed \
   gnunet-helper-testbed \
   gnunet-daemon-testbed-blacklist \
@@ -36,21 +35,6 @@ bin_PROGRAMS = \
 noinst_PROGRAMS = \
   $(generate_underlay)
 
-plugin_LTLIBRARIES = \
-  libgnunet_plugin_testcmd.la
-
-libgnunet_plugin_testcmd_la_SOURCES = \
-  plugin_testcmd.c
-libgnunet_plugin_testcmd_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/arm/libgnunetarm.la \
-  $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  libgnunettestbed.la \
-  $(LTLIBINTL)
-libgnunet_plugin_testcmd_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS)
-
 gnunet_service_testbed_SOURCES = \
   gnunet-service-testbed.c gnunet-service-testbed.h \
   gnunet-service-testbed_links.c gnunet-service-testbed_links.h \
@@ -89,15 +73,6 @@ gnunet_helper_testbed_LDADD = $(XLIB) \
  libgnunettestbed.la \
  $(LTLIBINTL) $(Z_LIBS)
 
-gnunet_cmds_helper_SOURCES = \
-  gnunet-cmds-helper.c
-gnunet_cmds_helper_LDADD = $(XLIB) \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/transport/libgnunettransporttesting2.la \
- libgnunettestbed.la \
- $(LTLIBINTL) $(Z_LIBS)
-
 gnunet_daemon_testbed_blacklist_SOURCES = gnunet-daemon-testbed-blacklist.c
 gnunet_daemon_testbed_blacklist_LDADD = $(XLIB) \
  $(top_builddir)/src/transport/libgnunettransport.la \
@@ -120,13 +95,6 @@ lib_LTLIBRARIES = \
   libgnunettestbed.la
 
 libgnunettestbed_la_SOURCES = \
-  testbed_api_cmd_local_test_finished.c \
-  testbed_api_cmd_send_peer_ready.c \
-  testbed_api_cmd_block_until_all_peers_started.c \
-  testbed_api_cmd_netjail_start.c \
-  testbed_api_cmd_netjail_start_testbed.c \
-  testbed_api_cmd_netjail_stop_testbed.c \
-  testbed_api_cmd_netjail_stop.c \
   testbed_api.c testbed_api.h testbed.h \
   testbed_api_hosts.c testbed_api_hosts.h testbed_helper.h \
   testbed_api_operations.c testbed_api_operations.h \
@@ -165,7 +133,6 @@ generate_underlay_topology_LDADD = $(XLIB) \
  $(LTLIBINTL) -lsqlite3
 
 check_PROGRAMS = \
-  test_testbed_api_cmd_netjail \
   test_testbed_api_hosts \
   test_gnunet_helper_testbed \
   test_testbed_api_controllerlink \
@@ -200,7 +167,6 @@ check_PROGRAMS = \
 if ENABLE_TEST_RUN
  AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
  TESTS = \
-  test_testbed_api_cmd_netjail \
   test_testbed_api \
   test_testbed_api_sd \
   test_testbed_api_operations \
@@ -231,13 +197,6 @@ if ENABLE_TEST_RUN
   $(underlay_testcases)
 endif
 
-test_testbed_api_cmd_netjail_SOURCES = \
- test_testbed_api_cmd_netjail.c
-test_testbed_api_cmd_netjail_LDADD = \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettestbed.la
-
 test_testbed_api_SOURCES = \
  test_testbed_api.c
 test_testbed_api_LDADD = \
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h
index 9a54ca36c..d4ef832ad 100644
--- a/src/testbed/testbed_api.h
+++ b/src/testbed/testbed_api.h
@@ -37,11 +37,6 @@
  */
 #define HELPER_TESTBED_BINARY "gnunet-helper-testbed"
 
-/**
- * Cmds Helper binary name
- */
-#define HELPER_CMDS_BINARY "gnunet-cmds-helper"
-
 
 /**
  * Enumeration of operations
@@ -185,6 +180,7 @@ struct OperationContext
 typedef void
 (*TESTBED_opcq_empty_cb) (void *cls);
 
+
 /**
  * Handle to interact with a GNUnet testbed controller.  Each
  * controller has at least one master handle which is created when the
diff --git a/src/testbed/testbed_api_cmd_send_peer_ready.c 
b/src/testbed/testbed_api_cmd_send_peer_ready.c
deleted file mode 100644
index 987f0853e..000000000
--- a/src/testbed/testbed_api_cmd_send_peer_ready.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-      This file is part of GNUnet
-      Copyright (C) 2021 GNUnet e.V.
-
-      GNUnet is free software: you can redistribute it and/or modify it
-      under the terms of the GNU Affero General Public License as published
-      by the Free Software Foundation, either version 3 of the License,
-      or (at your option) any later version.
-
-      GNUnet is distributed in the hope that it will be useful, but
-      WITHOUT ANY WARRANTY; without even the implied warranty of
-      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-      Affero General Public License for more details.
-
-      You should have received a copy of the GNU Affero General Public License
-      along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file testing_api_cmd_send_peer_ready.c
- * @brief cmd to send a helper message if peer is ready.
- * @author t3sserakt
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_testing_ng_lib.h"
-#include "testbed_helper.h"
-
-
-struct SendPeerReadyState
-{
-  TESTING_CMD_HELPER_write_cb write_message;
-
-  struct GNUNET_CMDS_PEER_STARTED *reply;
-};
-
-
-static int
-send_peer_ready_traits (void *cls,
-                        const void **ret,
-                        const char *trait,
-                        unsigned int index)
-{
-  return GNUNET_OK;
-}
-
-
-static void
-send_peer_ready_cleanup (void *cls,
-                         const struct GNUNET_TESTING_Command *cmd)
-{
-  struct SendPeerReadyState *sprs = cls;
-
-  GNUNET_free (sprs->reply);
-  GNUNET_free (sprs);
-}
-
-
-static void
-send_peer_ready_run (void *cls,
-                     const struct GNUNET_TESTING_Command *cmd,
-                     struct GNUNET_TESTING_Interpreter *is)
-{
-  struct SendPeerReadyState *sprs = cls;
-  struct GNUNET_CMDS_PEER_STARTED *reply;
-  size_t msg_length;
-
-  msg_length = sizeof(struct GNUNET_CMDS_PEER_STARTED);
-  reply = GNUNET_new (struct GNUNET_CMDS_PEER_STARTED);
-  reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED);
-  reply->header.size = htons ((uint16_t) msg_length);
-  sprs->reply = reply;
-  sprs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
-}
-
-
-/**
- * Create command.
- *
- * @param label name for command.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_send_peer_ready (const char *label,
-                                    TESTING_CMD_HELPER_write_cb write_message)
-{
-  struct SendPeerReadyState *sprs;
-
-  sprs = GNUNET_new (struct SendPeerReadyState);
-  sprs->write_message = write_message;
-
-  struct GNUNET_TESTING_Command cmd = {
-    .cls = sprs,
-    .label = label,
-    .run = &send_peer_ready_run,
-    .cleanup = &send_peer_ready_cleanup,
-    .traits = &send_peer_ready_traits
-  };
-
-  return cmd;
-}
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index d0a460fe6..1a8d9976d 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -964,10 +964,22 @@ gen_rsh_suffix_args (const char *const *append_args)
 }
 
 
-void
-GNUNET_TESTBED_extract_cfg (struct GNUNET_TESTBED_Host *host, const struct
-                            GNUNET_MessageHeader *message)
+/**
+ * Functions with this signature are called whenever a
+ * complete message is received by the tokenizer.
+ *
+ * Do not call GNUNET_SERVER_mst_destroy in callback
+ *
+ * @param cls closure
+ * @param client identification of the client
+ * @param message the actual message
+ *
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
+ */
+static int
+helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
 {
+  struct GNUNET_TESTBED_ControllerProc *cp = cls;
   const struct GNUNET_TESTBED_HelperReply *msg;
   const char *hostname;
   char *config;
@@ -989,43 +1001,22 @@ GNUNET_TESTBED_extract_cfg (struct GNUNET_TESTBED_Host 
*host, const struct
                                      xconfig_size));
   /* Replace the configuration template present in the host with the
      controller's running configuration */
-  GNUNET_CONFIGURATION_destroy (host->cfg);
-  host->cfg = GNUNET_CONFIGURATION_create ();
-  GNUNET_assert (GNUNET_CONFIGURATION_deserialize (host->cfg,
+  GNUNET_CONFIGURATION_destroy (cp->host->cfg);
+  cp->host->cfg = GNUNET_CONFIGURATION_create ();
+  GNUNET_assert (GNUNET_CONFIGURATION_deserialize (cp->host->cfg,
                                                    config,
                                                    config_size,
                                                    NULL));
   GNUNET_free (config);
-  if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (host)))
+  if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (cp->host)))
     hostname = "localhost";
   /* Change the hostname so that we can connect to it */
-  GNUNET_CONFIGURATION_set_value_string (host->cfg,
+  GNUNET_CONFIGURATION_set_value_string (cp->host->cfg,
                                          "testbed",
                                          "hostname",
                                          hostname);
-  host->locked = GNUNET_NO;
-}
-
-/**
- * Functions with this signature are called whenever a
- * complete message is received by the tokenizer.
- *
- * Do not call GNUNET_SERVER_mst_destroy in callback
- *
- * @param cls closure
- * @param client identification of the client
- * @param message the actual message
- *
- * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
- */
-static int
-helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
-{
-  struct GNUNET_TESTBED_ControllerProc *cp = cls;
-  struct GNUNET_TESTBED_Host *host = cp->host;
-
-  GNUNET_TESTBED_extract_cfg (host, message);
-
+  cp->host->locked = GNUNET_NO;
+  cp->host->controller_started = GNUNET_YES;
   cp->cb (cp->cls, cp->host->cfg, GNUNET_OK);
   return GNUNET_OK;
 }
diff --git a/src/testbed/testbed_helper.h b/src/testbed/testbed_helper.h
index af90ce85d..817ad559d 100644
--- a/src/testbed/testbed_helper.h
+++ b/src/testbed/testbed_helper.h
@@ -84,60 +84,6 @@ struct GNUNET_TESTBED_HelperReply
    * un-compressed */
 };
 
-/**
- * Initialization message for gnunet-cmds-testbed to start cmd binary.
- */
-struct GNUNET_CMDS_HelperInit
-{
-  /**
-   * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   *
-   */
-  uint16_t plugin_name_size GNUNET_PACKED;
-
-  /* Followed by plugin name of the plugin running the test case. This is not 
NULL
-   * terminated */
-};
-
-/**
- * Reply message from cmds helper process
- */
-struct GNUNET_CMDS_HelperReply
-{
-  /**
-   * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY
-   */
-  struct GNUNET_MessageHeader header;
-};
-
-struct GNUNET_CMDS_PEER_STARTED
-{
-  /**
-   * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED
-   */
-  struct GNUNET_MessageHeader header;
-};
-
-struct GNUNET_CMDS_ALL_PEERS_STARTED
-{
-  /**
-   * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED
-   */
-  struct GNUNET_MessageHeader header;
-};
-
-struct GNUNET_CMDS_LOCAL_FINISHED
-{
-  /**
-   * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED
-   */
-  struct GNUNET_MessageHeader header;
-};
-
 GNUNET_NETWORK_STRUCT_END
 #endif
 /* end of testbed_helper.h */
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 8b28e6e23..15469a310 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -11,10 +11,43 @@ pkgcfgdir= $(pkgdatadir)/config.d/
 dist_pkgcfg_DATA = \
   testing.conf
 
+libexec_PROGRAMS = \
+  gnunet-cmds-helper
+
+plugindir = $(libdir)/gnunet
+
+plugin_LTLIBRARIES = \
+  libgnunet_test_testing_plugin_testcmd.la
+
 lib_LTLIBRARIES = \
   libgnunettesting.la
 
+gnunet_cmds_helper_SOURCES = \
+  gnunet-cmds-helper.c
+gnunet_cmds_helper_LDADD = $(XLIB) \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ libgnunettesting.la \
+ $(LTLIBINTL) $(Z_LIBS)
+
+libgnunet_test_testing_plugin_testcmd_la_SOURCES = \
+  test_testing_plugin_testcmd.c
+libgnunet_test_testing_plugin_testcmd_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/arm/libgnunetarm.la \
+  libgnunettesting.la \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+  $(LTLIBINTL)
+libgnunet_test_testing_plugin_testcmd_la_LDFLAGS = \
+ $(GN_PLUGIN_LDFLAGS)
+
 libgnunettesting_la_SOURCES = \
+  testing_api_cmd_local_test_finished.c \
+  testing_api_cmd_send_peer_ready.c \
+  testing_api_cmd_block_until_all_peers_started.c \
+  testing_api_cmd_netjail_start.c \
+  testing_api_cmd_netjail_start_testsystem.c \
+  testing_api_cmd_netjail_stop_testsystem.c \
+  testing_api_cmd_netjail_stop.c \
   testing.c testing.h \
   testing_api_cmd_system_create.c \
   testing_api_cmd_batch.c \
@@ -56,6 +89,7 @@ list_keys_LDADD = \
 
 
 check_PROGRAMS = \
+ test_testing_api_cmd_netjail \
  test_testing_hello_world \
  test_testing_portreservation \
  test_testing_servicestartup \
@@ -66,6 +100,7 @@ check_PROGRAMS = \
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
 TESTS = \
+ test_testing_api_cmd_netjail \
  test_testing_hello_world \
  test_testing_portreservation \
  test_testing_peerstartup \
@@ -73,6 +108,12 @@ TESTS = \
  test_testing_servicestartup
 endif
 
+test_testing_api_cmd_netjail_SOURCES = \
+ test_testing_api_cmd_netjail.c
+test_testing_api_cmd_netjail_LDADD = \
+ libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
 test_testing_hello_world_SOURCES = \
  test_testing_hello_world.c
 test_testing_hello_world_LDADD = \
diff --git a/src/testbed/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c
similarity index 98%
rename from src/testbed/gnunet-cmds-helper.c
rename to src/testing/gnunet-cmds-helper.c
index 4bc0656de..d9fcf3541 100644
--- a/src/testbed/gnunet-cmds-helper.c
+++ b/src/testing/gnunet-cmds-helper.c
@@ -39,9 +39,8 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_testing_lib.h"
-#include "gnunet_testbed_service.h"
-#include "testbed_helper.h"
-#include "testbed_api.h"
+#include "gnunet_testing_ng_lib.h"
+#include "testing_cmds.h"
 #include "gnunet_testing_plugin.h"
 #include <zlib.h>
 
@@ -124,7 +123,7 @@ struct Plugin *plugin;
 
 /**
  * The process handle to the testbed service
- 
+
 static struct GNUNET_OS_Process *cmd_binary_process;*/
 
 /**
@@ -284,7 +283,7 @@ child_death_task (void *cls)
 
   pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
   child_death_task_id = NULL;
-  // consume the signal 
+  // consume the signal
   GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof(c)));
   LOG_DEBUG ("Got SIGCHLD\n");
 
@@ -411,7 +410,7 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader 
*message)
     plugin = GNUNET_new (struct Plugin);
     plugin->api = GNUNET_PLUGIN_load (plugin_name,
                                       NULL);
-    plugin->library_name = GNUNET_strdup (basename(plugin_name));
+    plugin->library_name = GNUNET_strdup (basename (plugin_name));
 
     plugin->global_n = ni->global_n;
     plugin->local_m = ni->local_m;
diff --git a/src/testbed/test_testbed_api_cmd_netjail.c 
b/src/testing/test_testing_api_cmd_netjail.c
similarity index 98%
rename from src/testbed/test_testbed_api_cmd_netjail.c
rename to src/testing/test_testing_api_cmd_netjail.c
index 85da39f0e..543642109 100644
--- a/src/testbed/test_testbed_api_cmd_netjail.c
+++ b/src/testing/test_testing_api_cmd_netjail.c
@@ -25,7 +25,6 @@
  */
 #include "platform.h"
 #include "gnunet_testing_ng_lib.h"
-#include "gnunet_testbed_ng_service.h"
 #include "gnunet_util_lib.h"
 
 
diff --git a/src/testbed/plugin_testcmd.c 
b/src/testing/test_testing_plugin_testcmd.c
similarity index 98%
rename from src/testbed/plugin_testcmd.c
rename to src/testing/test_testing_plugin_testcmd.c
index b74b67240..aeb0db5dc 100644
--- a/src/testbed/plugin_testcmd.c
+++ b/src/testing/test_testing_plugin_testcmd.c
@@ -26,7 +26,7 @@
 #include "platform.h"
 #include "gnunet_testing_ng_lib.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_testbed_ng_service.h"
+#include "gnunet_testing_ng_lib.h"
 
 /**
  * Generic logging shortcut
diff --git a/src/testbed/testbed_api_cmd_block_until_all_peers_started.c 
b/src/testing/testing_api_cmd_block_until_all_peers_started.c
similarity index 100%
rename from src/testbed/testbed_api_cmd_block_until_all_peers_started.c
rename to src/testing/testing_api_cmd_block_until_all_peers_started.c
diff --git a/src/testbed/testbed_api_cmd_local_test_finished.c 
b/src/testing/testing_api_cmd_local_test_finished.c
similarity index 99%
rename from src/testbed/testbed_api_cmd_local_test_finished.c
rename to src/testing/testing_api_cmd_local_test_finished.c
index c02546945..5b74d4e04 100644
--- a/src/testbed/testbed_api_cmd_local_test_finished.c
+++ b/src/testing/testing_api_cmd_local_test_finished.c
@@ -26,7 +26,7 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_testing_ng_lib.h"
-#include "testbed_helper.h"
+#include "testing_cmds.h"
 
 /**
  * Generic logging shortcut
diff --git a/src/testbed/testbed_api_cmd_netjail_start.c 
b/src/testing/testing_api_cmd_netjail_start.c
similarity index 99%
rename from src/testbed/testbed_api_cmd_netjail_start.c
rename to src/testing/testing_api_cmd_netjail_start.c
index 0cc020275..c82392a08 100644
--- a/src/testbed/testbed_api_cmd_netjail_start.c
+++ b/src/testing/testing_api_cmd_netjail_start.c
@@ -26,7 +26,6 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_testing_ng_lib.h"
-#include "gnunet_testbed_ng_service.h"
 
 #define NETJAIL_START_SCRIPT "./../testing/netjail_start.sh"
 
diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem.c 
b/src/testing/testing_api_cmd_netjail_start_testsystem.c
new file mode 100644
index 000000000..5c2f71168
--- /dev/null
+++ b/src/testing/testing_api_cmd_netjail_start_testsystem.c
@@ -0,0 +1,541 @@
+/*
+      This file is part of GNUnet
+      Copyright (C) 2021 GNUnet e.V.
+
+      GNUnet is free software: you can redistribute it and/or modify it
+      under the terms of the GNU Affero General Public License as published
+      by the Free Software Foundation, either version 3 of the License,
+      or (at your option) any later version.
+
+      GNUnet is distributed in the hope that it will be useful, but
+      WITHOUT ANY WARRANTY; without even the implied warranty of
+      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+      Affero General Public License for more details.
+
+      You should have received a copy of the GNU Affero General Public License
+      along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
+ */
+
+/**
+ * @file testing/testing_api_cmd_hello_world.c
+ * @brief Command to start the netjail peers.
+ * @author t3sserakt
+ */
+#include "platform.h"
+#include "gnunet_testing_ng_lib.h"
+#include "testing_cmds.h"
+
+#define NETJAIL_EXEC_SCRIPT "./../testing/netjail_exec.sh"
+
+struct HelperMessage;
+
+struct HelperMessage
+{
+
+  struct HelperMessage *next;
+
+  struct HelperMessage *prev;
+
+  /**
+   * Size of the original message.
+   */
+  uint16_t bytes_msg;
+
+  /* Followed by @e bytes_msg of msg.*/
+};
+
+
+
+struct NetJailState
+{
+
+  unsigned int *rv;
+
+  struct HelperMessage *hp_messages_head;
+
+  struct HelperMessage *hp_messages_tail;
+
+  /**
+   * The process handle
+   */
+  struct GNUNET_HELPER_Handle **helper;
+
+  unsigned int n_helper;
+
+  char *binary_name;
+
+  char *local_m;
+
+  char *global_n;
+
+  /**
+   * The send handle for the helper
+   */
+  struct GNUNET_HELPER_SendHandle **shandle;
+
+  unsigned int n_shandle;
+
+  /**
+   * The message corresponding to send handle
+   */
+  struct GNUNET_MessageHeader **msg;
+
+  unsigned int n_msg;
+
+  unsigned int number_of_testsystems_started;
+
+  unsigned int number_of_peers_started;
+
+  unsigned int number_of_local_test_finished;
+
+  char *plugin_name;
+};
+
+struct TestingSystemCount
+{
+  unsigned int count;
+
+  struct NetJailState *ns;
+};
+
+/**
+*
+*
+* @param cls closure
+* @param cmd current CMD being cleaned up.
+*/
+static void
+netjail_exec_cleanup (void *cls,
+                      const struct GNUNET_TESTING_Command *cmd)
+{
+  struct NetJailState *ns = cls;
+
+  GNUNET_free (ns->binary_name);
+}
+
+
+/**
+*
+*
+* @param cls closure.
+* @param[out] ret result
+* @param trait name of the trait.
+* @param index index number of the object to offer.
+* @return #GNUNET_OK on success.
+*/
+static int
+netjail_exec_traits (void *cls,
+                     const void **ret,
+                     const char *trait,
+                     unsigned int index)
+{
+  struct NetJailState *ns = cls;
+  struct GNUNET_HELPER_Handle **helper = ns->helper;
+  struct HelperMessage *hp_messages_head = ns->hp_messages_head;
+
+
+  struct GNUNET_TESTING_Trait traits[] = {
+    {
+      .index = 0,
+      .trait_name = "helper_handles",
+      .ptr = (const void *) helper,
+    },
+    {
+      .index = 1,
+      .trait_name = "hp_msgs_head",
+      .ptr = (const void *) hp_messages_head,
+    },
+    GNUNET_TESTING_trait_end ()
+  };
+
+  return GNUNET_TESTING_get_trait (traits,
+                                   ret,
+                                   trait,
+                                   index);
+}
+
+
+/**
+ * Offer handles to testing cmd helper from trait
+ *
+ * @param cmd command to extract the message from.
+ * @param pt pointer to message.
+ * @return #GNUNET_OK on success.
+ */
+int
+GNUNET_TESTING_get_trait_helper_handles (const struct
+                                         GNUNET_TESTING_Command *cmd,
+                                         struct GNUNET_HELPER_Handle ***helper)
+{
+  return cmd->traits (cmd->cls,
+                      (const void **) helper,
+                      "helper_handles",
+                      (unsigned int) 0);
+}
+
+/**
+ * Offer messages received via testing cmd helper from trait
+ *
+ * @param cmd command to extract the message from.
+ * @param pt pointer to message.
+ * @return #GNUNET_OK on success.
+ */
+int
+GNUNET_TESTING_get_trait_helper_messages (const struct
+                                          GNUNET_TESTING_Command *cmd,
+                                          struct HelperMessage ***
+                                          hp_messages_head)
+{
+  return cmd->traits (cmd->cls,
+                      (const void **) hp_messages_head,
+                      "hp_msgs_head",
+                      (unsigned int) 1);
+}
+
+
+/**
+ * Continuation function from GNUNET_HELPER_send()
+ *
+ * @param cls closure
+ * @param result GNUNET_OK on success,
+ *               GNUNET_NO if helper process died
+ *               GNUNET_SYSERR during GNUNET_HELPER_stop
+ */
+static void
+clear_msg (void *cls, int result)
+{
+  struct TestingSystemCount *tbc = cls;
+  struct NetJailState *ns = tbc->ns;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "clear_msg tbc->count: %d\n",
+              tbc->count);
+  GNUNET_assert (NULL != ns->shandle[tbc->count - 1]);
+  ns->shandle[tbc->count - 1] = NULL;
+  GNUNET_free (ns->msg[tbc->count - 1]);
+  ns->msg[tbc->count - 1] = NULL;
+}
+
+
+/**
+ * Functions with this signature are called whenever a
+ * complete message is received by the tokenizer.
+ *
+ * Do not call GNUNET_SERVER_mst_destroy in callback
+ *
+ * @param cls closure
+ * @param client identification of the client
+ * @param message the actual message
+ *
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
+ */
+static int
+helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
+{
+  struct TestingSystemCount *tbc = cls;
+  struct NetJailState *ns = tbc->ns;
+  struct HelperMessage *hp_msg;
+
+  if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY == ntohs (message->type))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "helper_mst tbc->count: %d\n",
+                tbc->count);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Received message from helper.\n");
+    ns->number_of_testsystems_started++;
+  }
+  else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED == ntohs (
+             message->type))
+  {
+    ns->number_of_peers_started++;
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "number_of_peers_started: %d\n",
+                ns->number_of_peers_started);
+  }
+  else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED == ntohs (
+             message->type))
+  {
+    ns->number_of_local_test_finished++;
+  }
+  else
+  {
+    hp_msg = GNUNET_new (struct HelperMessage);
+    hp_msg->bytes_msg = message->size;
+    memcpy (&hp_msg[1], message, message->size);
+    GNUNET_CONTAINER_DLL_insert (ns->hp_messages_head, ns->hp_messages_tail,
+                                 hp_msg);
+  }
+
+  return GNUNET_OK;
+}
+
+
+static void
+exp_cb (void *cls)
+{
+  struct NetJailState *ns = cls;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n");
+  *ns->rv = 1;
+}
+
+
+static struct GNUNET_CMDS_HelperInit *
+create_helper_init_msg_ (char *m_char,
+                         char *n_char,
+                         const char *plugin_name)
+{
+  struct GNUNET_CMDS_HelperInit *msg;
+  uint16_t plugin_name_len;
+  uint16_t msg_size;
+
+  GNUNET_assert (NULL != plugin_name);
+  plugin_name_len = strlen (plugin_name);
+  msg_size = sizeof(struct GNUNET_CMDS_HelperInit) + plugin_name_len;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "msg_size: %d \n",
+              msg_size);
+  msg = GNUNET_malloc (msg_size);
+  msg->header.size = htons (msg_size);
+  msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT);
+  msg->plugin_name_size = htons (plugin_name_len);
+  GNUNET_memcpy ((char *) &msg[1],
+                 plugin_name,
+                 plugin_name_len);
+  return msg;
+}
+
+
+static void
+start_helper (struct NetJailState *ns, struct
+              GNUNET_CONFIGURATION_Handle *config,
+              char *m_char,
+              char *n_char)
+{
+  // struct GNUNET_CONFIGURATION_Handle *cfg;
+  struct GNUNET_CMDS_HelperInit *msg;
+  struct TestingSystemCount *tbc;
+  char *const script_argv[] = {NETJAIL_EXEC_SCRIPT,
+                               m_char,
+                               n_char,
+                               GNUNET_OS_get_libexec_binary_path (
+                                 HELPER_CMDS_BINARY),
+                               ns->global_n,
+                               ns->local_m,
+                               NULL};
+  unsigned int m = atoi (m_char);
+  unsigned int n = atoi (n_char);
+  unsigned int helper_check = GNUNET_OS_check_helper_binary (
+    NETJAIL_EXEC_SCRIPT,
+    GNUNET_YES,
+    NULL);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "m: %d n: %d\n",
+              m,
+              n);
+
+  tbc = GNUNET_new (struct TestingSystemCount);
+  tbc->ns = ns;
+  tbc->count = (n - 1) * atoi (ns->local_m) + m;
+
+
+  if (GNUNET_NO == helper_check)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "No SUID for %s!\n",
+                NETJAIL_EXEC_SCRIPT);
+    *ns->rv = 1;
+  }
+  else if (GNUNET_NO == helper_check)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "%s not found!\n",
+                NETJAIL_EXEC_SCRIPT);
+    *ns->rv = 1;
+  }
+
+  GNUNET_array_append (ns->helper, ns->n_helper, GNUNET_HELPER_start (
+                         GNUNET_YES,
+                         NETJAIL_EXEC_SCRIPT,
+                         script_argv,
+                         &helper_mst,
+                         &exp_cb,
+                         tbc));
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "First using helper %d %d\n",
+              tbc->count - 1,
+              ns->n_helper);
+  struct GNUNET_HELPER_Handle *helper = ns->helper[tbc->count - 1];
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "First using helper %d %d %p\n",
+              tbc->count - 1,
+              ns->n_helper,
+              helper);
+
+  msg = create_helper_init_msg_ (m_char,
+                                 n_char,
+                                 ns->plugin_name);
+  GNUNET_array_append (ns->msg, ns->n_msg, &msg->header);
+
+  GNUNET_array_append (ns->shandle, ns->n_shandle, GNUNET_HELPER_send (
+                         helper,
+                         &msg->header,
+                         GNUNET_NO,
+                         &clear_msg,
+                         tbc));
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Message %d send!\n",
+              tbc->count);
+
+  if (NULL == ns->shandle[tbc->count - 1])
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Send handle is NULL!\n");
+    GNUNET_free (msg);
+    *ns->rv = 1;
+  }
+}
+
+
+/**
+* Run the "hello world" CMD.
+*
+* @param cls closure.
+* @param cmd CMD being run.
+* @param is interpreter state.
+*/
+static void
+netjail_exec_run (void *cls,
+                  const struct GNUNET_TESTING_Command *cmd,
+                  struct GNUNET_TESTING_Interpreter *is)
+{
+  char str_m[12];
+  char str_n[12];
+  struct NetJailState *ns = cls;
+  struct GNUNET_CONFIGURATION_Handle *config =
+    GNUNET_CONFIGURATION_create ();
+
+  for (int i = 1; i <= atoi (ns->global_n); i++) {
+    for (int j = 1; j <= atoi (ns->local_m); j++)
+    {
+      sprintf (str_n, "%d", i);
+      sprintf (str_m, "%d", j);
+      start_helper (ns, config,
+                    str_m,
+                    str_n);
+    }
+  }
+}
+
+
+static int
+netjail_start_finish (void *cls,
+                      GNUNET_SCHEDULER_TaskCallback cont,
+                      void *cont_cls)
+{
+  unsigned int ret = GNUNET_NO;
+  struct NetJailState *ns = cls;
+  unsigned int total_number = atoi (ns->local_m) * atoi (ns->global_n);
+  struct GNUNET_CMDS_ALL_PEERS_STARTED *reply;
+  size_t msg_length;
+  struct GNUNET_HELPER_Handle *helper;
+  struct TestingSystemCount *tbc;
+
+  if (ns->number_of_local_test_finished == total_number)
+  {
+    ret = GNUNET_YES;
+    cont (cont_cls);
+  }
+
+  if (ns->number_of_testsystems_started == total_number)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "All helpers started!\n");
+    ns->number_of_testsystems_started = 0;
+  }
+
+  if (ns->number_of_peers_started == total_number)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "All peers started!\n");
+
+    for (int i = 1; i <= atoi (ns->global_n); i++) {
+      for (int j = 1; j <= atoi (ns->local_m); j++)
+      {
+        tbc = GNUNET_new (struct TestingSystemCount);
+        tbc->ns = ns;
+        // TODO This needs to be more generic. As we send more messages back 
and forth, we can not grow the arrays again and again, because this is to error 
prone.
+        tbc->count = (i - 1) * atoi (ns->local_m) + j + total_number;
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "Second using helper %d %d %d\n",
+                    tbc->count - 1 - total_number,
+                    i,
+                    j);
+        helper = ns->helper[tbc->count - 1 - total_number];
+        msg_length = sizeof(struct GNUNET_CMDS_ALL_PEERS_STARTED);
+        reply = GNUNET_new (struct GNUNET_CMDS_ALL_PEERS_STARTED);
+        reply->header.type = htons (
+          GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED);
+        reply->header.size = htons ((uint16_t) msg_length);
+
+        GNUNET_array_append (ns->msg, ns->n_msg, &reply->header);
+
+        struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send (
+          helper,
+          &reply->header,
+          GNUNET_NO,
+          &clear_msg,
+          tbc);
+
+        GNUNET_array_append (ns->shandle, ns->n_shandle, sh);
+
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "All peers started message %d send!\n",
+                    tbc->count);
+      }
+    }
+    ns->number_of_peers_started = 0;
+  }
+  return ret;
+}
+
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param binaryname to exec.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label,
+                                                 char *local_m,
+                                                 char *global_n,
+                                                 char *plugin_name,
+                                                 unsigned int *rv)
+{
+  struct NetJailState *ns;
+
+  ns = GNUNET_new (struct NetJailState);
+  ns->local_m = local_m;
+  ns->global_n = global_n;
+  ns->plugin_name = plugin_name;
+  ns->rv = rv;
+
+  struct GNUNET_TESTING_Command cmd = {
+    .cls = ns,
+    .label = label,
+    .run = &netjail_exec_run,
+    .finish = &netjail_start_finish,
+    .cleanup = &netjail_exec_cleanup,
+    .traits = &netjail_exec_traits
+  };
+
+  return cmd;
+}
diff --git a/src/testbed/testbed_api_cmd_netjail_stop.c 
b/src/testing/testing_api_cmd_netjail_stop.c
similarity index 99%
rename from src/testbed/testbed_api_cmd_netjail_stop.c
rename to src/testing/testing_api_cmd_netjail_stop.c
index f837ec08c..710b4fbf4 100644
--- a/src/testbed/testbed_api_cmd_netjail_stop.c
+++ b/src/testing/testing_api_cmd_netjail_stop.c
@@ -26,7 +26,6 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_testing_ng_lib.h"
-#include "gnunet_testbed_ng_service.h"
 
 
 #define NETJAIL_STOP_SCRIPT "./../testing/netjail_stop.sh"
diff --git a/src/testbed/testbed_api_cmd_netjail_stop_testbed.c 
b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
similarity index 97%
rename from src/testbed/testbed_api_cmd_netjail_stop_testbed.c
rename to src/testing/testing_api_cmd_netjail_stop_testsystem.c
index c74c1e94f..bed9f3ebf 100644
--- a/src/testbed/testbed_api_cmd_netjail_stop_testbed.c
+++ b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
@@ -25,9 +25,7 @@
  */
 #include "platform.h"
 #include "gnunet_testing_ng_lib.h"
-#include "gnunet_testbed_ng_service.h"
-#include "testbed_api.h"
-#include "testbed_api_hosts.h"
+#include "testing_cmds.h"
 
 
 struct StopHelperState
diff --git a/src/testing/testing_api_cmd_send_peer_ready.c 
b/src/testing/testing_api_cmd_send_peer_ready.c
index e5e004924..afe28de77 100644
--- a/src/testing/testing_api_cmd_send_peer_ready.c
+++ b/src/testing/testing_api_cmd_send_peer_ready.c
@@ -26,8 +26,7 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_testing_ng_lib.h"
-#include "testbed_api.h"
-#include "testbed_helper.h"
+#include "testing_cmds.h"
 
 
 struct SendPeerReadyState
@@ -68,7 +67,7 @@ send_peer_ready_run (void *cls,
   struct GNUNET_CMDS_PEER_STARTED *reply;
   size_t msg_length;
 
-  msg_length = sizeof(struct GNUNET_CMDS_HelperInit);// 
GNUNET_CMDS_PEER_STARTED);
+  msg_length = sizeof(struct GNUNET_CMDS_PEER_STARTED);
   reply = GNUNET_new (struct GNUNET_CMDS_PEER_STARTED);
   reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED);
   reply->header.size = htons ((uint16_t) msg_length);
diff --git a/src/testbed/testbed_helper.h b/src/testing/testing_cmds.h
similarity index 53%
copy from src/testbed/testbed_helper.h
copy to src/testing/testing_cmds.h
index af90ce85d..7a5860aea 100644
--- a/src/testbed/testbed_helper.h
+++ b/src/testing/testing_cmds.h
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      Copyright (C) 2008--2013 GNUnet e.V.
+      Copyright (C) 2021 GNUnet e.V.
 
       GNUnet is free software: you can redistribute it and/or modify it
       under the terms of the GNU Affero General Public License as published
@@ -19,70 +19,17 @@
  */
 
 /**
- * @file testbed/testbed_helper.h
- * @brief Message formats for communication between testbed api and
- *          gnunet-helper-testbed process
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
+ * @file testing/testing_cmds.h
+ * @brief Message formats for communication between testing cmds helper and 
testcase plugins.
+ * @author t3sserakt
  */
 
-#ifndef TESTBED_HELPER_H
-#define TESTBED_HELPER_H
+#ifndef TESTING_CMDS_H
+#define TESTING_CMDS_H
 
-GNUNET_NETWORK_STRUCT_BEGIN
-/**
- * Initialization message for gnunet-helper-testbed to start testbed service
- */
-struct GNUNET_TESTBED_HelperInit
-{
-  /**
-   * Type is GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * The controller hostname size excluding the NULL termination character -
-   * strlen (hostname); cannot be zero
-   */
-  uint16_t trusted_ip_size GNUNET_PACKED;
-
-  /**
-   * The hostname size excluding the NULL termination character - strlen
-   * (hostname); cannot be zero
-   */
-  uint16_t hostname_size GNUNET_PACKED;
-
-  /**
-   * The size of the uncompressed configuration
-   */
-  uint16_t config_size GNUNET_PACKED;
-
-  /* Followed by NULL terminated trusted ip */
+#define HELPER_CMDS_BINARY "gnunet-cmds-helper"
 
-  /* Followed by hostname of the machine on which helper runs. This is not NULL
-   * terminated */
-
-  /* Followed by serialized and compressed configuration which should be
-   * config_size long when un-compressed */
-};
-
-/**
- * Reply message from helper process
- */
-struct GNUNET_TESTBED_HelperReply
-{
-  /**
-   * Type is GNUNET_MESSAGE_TYPE_TESTBED_HELPER_REPLY
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Size of the uncompressed configuration
-   */
-  uint16_t config_size GNUNET_PACKED;
-
-  /* Followed by compressed configuration which should be config_size long when
-   * un-compressed */
-};
+GNUNET_NETWORK_STRUCT_BEGIN
 
 /**
  * Initialization message for gnunet-cmds-testbed to start cmd binary.
@@ -140,4 +87,4 @@ struct GNUNET_CMDS_LOCAL_FINISHED
 
 GNUNET_NETWORK_STRUCT_END
 #endif
-/* end of testbed_helper.h */
+/* end of testing_cmds.h */
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 0782a631b..0696188c5 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -398,20 +398,19 @@ plugin_LTLIBRARIES = \
   $(HTTP_SERVER_PLUGIN_LA) \
   $(HTTPS_SERVER_PLUGIN_LA) \
   $(WLAN_PLUGIN_LA) \
-  $(BT_PLUGIN_LA) 
-#  libgnunet_plugin_cmd_simple_send.la
-
-#libgnunet_plugin_cmd_simple_send_la_SOURCES = \
-# plugin_cmd_simple_send.c
-#libgnunet_plugin_cmd_simple_send_la_LIBADD = \
-#  $(top_builddir)/src/util/libgnunetutil.la \
-#  $(top_builddir)/src/testing/libgnunettesting.la \
-#  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-#  $(top_builddir)/src/testbed/libgnunettestbed.la \
-#  libgnunettransporttesting2.la \
-#  $(LTLIBINTL)
-#libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \
-#  $(GN_PLUGIN_LDFLAGS)
+  $(BT_PLUGIN_LA) \
+  libgnunet_test_transport_plugin_cmd_simple_send.la
+
+libgnunet_test_transport_plugin_cmd_simple_send_la_SOURCES = \
+ test_transport_plugin_cmd_simple_send.c
+libgnunet_test_transport_plugin_cmd_simple_send_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+  libgnunettransporttesting2.la \
+  $(LTLIBINTL)
+libgnunet_test_transport_plugin_cmd_simple_send_la_LDFLAGS = \
+  $(GN_PLUGIN_LDFLAGS)
 
 if HAVE_EXPERIMENTAL
 plugin_LTLIBRARIES += libgnunet_plugin_transport_udp.la
diff --git a/src/transport/test_transport_api_cmd_simple_send.c 
b/src/transport/test_transport_api_cmd_simple_send.c
index 1cc16f307..13497366e 100644
--- a/src/transport/test_transport_api_cmd_simple_send.c
+++ b/src/transport/test_transport_api_cmd_simple_send.c
@@ -25,7 +25,6 @@
  */
 #include "platform.h"
 #include "gnunet_testing_ng_lib.h"
-#include "gnunet_testbed_ng_service.h"
 #include "gnunet_util_lib.h"
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
@@ -49,7 +48,7 @@ run (void *cls)
     GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed-1",
                                                      "2",
                                                      "1",
-                                                     
"libgnunet_plugin_cmd_simple_send",
+                                                     
"libgnunet_test_transport_plugin_cmd_simple_send",
                                                      &rv),
     GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed",
                                             "netjail-start-testbed-1",
diff --git a/src/transport/plugin_cmd_simple_send.c 
b/src/transport/test_transport_plugin_cmd_simple_send.c
similarity index 82%
rename from src/transport/plugin_cmd_simple_send.c
rename to src/transport/test_transport_plugin_cmd_simple_send.c
index 468f4e48a..c4f7fcfe3 100644
--- a/src/transport/plugin_cmd_simple_send.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send.c
@@ -1,19 +1,19 @@
 /*
-     This file is part of GNUnet
-     Copyright (C) 2013, 2014 GNUnet e.V.
+      This file is part of GNUnet
+      Copyright (C) 2021 GNUnet e.V.
 
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
+      GNUnet is free software: you can redistribute it and/or modify it
+      under the terms of the GNU Affero General Public License as published
+      by the Free Software Foundation, either version 3 of the License,
+      or (at your option) any later version.
 
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
+      GNUnet is distributed in the hope that it will be useful, but
+      WITHOUT ANY WARRANTY; without even the implied warranty of
+      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+      Affero General Public License for more details.
 
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+      You should have received a copy of the GNU Affero General Public License
+      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
      SPDX-License-Identifier: AGPL3.0-or-later
  */
@@ -27,8 +27,6 @@
 #include "gnunet_testing_ng_lib.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_transport_application_service.h"
-// #include "gnunet_transport_service.h"
-#include "gnunet_testbed_ng_service.h"
 #include "transport-testing2.h"
 #include "transport-testing-cmds.h"
 
@@ -166,7 +164,7 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, 
char *router_ip,
  * @return the exported block API
  */
 void *
-libgnunet_plugin_cmd_simple_send_init (void *cls)
+libgnunet_test_transport_plugin_cmd_simple_send_init (void *cls)
 {
   struct GNUNET_TESTING_PluginFunctions *api;
 
@@ -180,11 +178,11 @@ libgnunet_plugin_cmd_simple_send_init (void *cls)
 /**
  * Exit point from the plugin.
  *
- * @param cls the return value from #libgnunet_plugin_block_test_init
+ * @param cls the return value from 
#libgnunet_test_transport_plugin_block_test_init
  * @return NULL
  */
 void *
-libgnunet_plugin_cmd_simple_send_done (void *cls)
+libgnunet_test_transport_plugin_cmd_simple_send_done (void *cls)
 {
   struct GNUNET_TESTING_PluginFunctions *api = cls;
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]