From f146e80752e73247acb9d6c7463188a82d26a774 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 4 Oct 2021 12:15:43 +0200 Subject: -taking a first stab at cleaning up the testing mess --- src/testing/testing_api_cmd_netjail_stop_v2.c | 42 +++++++++++++-------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'src/testing/testing_api_cmd_netjail_stop_v2.c') diff --git a/src/testing/testing_api_cmd_netjail_stop_v2.c b/src/testing/testing_api_cmd_netjail_stop_v2.c index 8c1f3cedd..348e8c9f7 100644 --- a/src/testing/testing_api_cmd_netjail_stop_v2.c +++ b/src/testing/testing_api_cmd_netjail_stop_v2.c @@ -19,7 +19,7 @@ */ /** - * @file testing/testing_api_cmd_hello_world.c + * @file testing/testing_api_cmd_netjail_stop_v2.c * @brief Command to stop the netjail script. * @author t3sserakt */ @@ -50,7 +50,7 @@ struct NetJailState struct GNUNET_OS_Process *stop_proc; // Flag indication if the script finished. - unsigned int finished; + enum GNUNET_GenericReturnValue finished; }; @@ -59,8 +59,7 @@ struct NetJailState * */ static void -netjail_stop_cleanup (void *cls, - const struct GNUNET_TESTING_Command *cmd) +netjail_stop_cleanup (void *cls) { struct NetJailState *ns = cls; @@ -86,13 +85,13 @@ netjail_stop_cleanup (void *cls, * Trait function of this cmd does nothing. * */ -static int +static enum GNUNET_GenericReturnValue netjail_stop_traits (void *cls, const void **ret, const char *trait, unsigned int index) { - return GNUNET_OK; + return GNUNET_NO; } @@ -125,12 +124,10 @@ child_completed_callback (void *cls, * The run method starts the script which deletes the network namespaces. * * @param cls closure. -* @param cmd CMD being run. * @param is interpreter state. */ static void netjail_stop_run (void *cls, - const struct GNUNET_TESTING_Command *cmd, struct GNUNET_TESTING_Interpreter *is) { struct NetJailState *ns = cls; @@ -152,14 +149,14 @@ netjail_stop_run (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No SUID for %s!\n", NETJAIL_STOP_SCRIPT); - GNUNET_TESTING_interpreter_fail (); + GNUNET_TESTING_interpreter_fail (is); } else if (GNUNET_NO == helper_check) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s not found!\n", NETJAIL_STOP_SCRIPT); - GNUNET_TESTING_interpreter_fail (); + GNUNET_TESTING_interpreter_fail (is); } ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, @@ -181,7 +178,7 @@ netjail_stop_run (void *cls, * This function checks the flag NetJailState#finished, if this cmd finished. * */ -static int +static enum GNUNET_GenericReturnValue netjail_stop_finish (void *cls, GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls) @@ -211,15 +208,16 @@ GNUNET_TESTING_cmd_netjail_stop_v2 (const char *label, ns = GNUNET_new (struct NetJailState); ns->topology_config = topology_config; - - struct GNUNET_TESTING_Command cmd = { - .cls = ns, - .label = label, - .run = &netjail_stop_run, - .finish = &netjail_stop_finish, - .cleanup = &netjail_stop_cleanup, - .traits = &netjail_stop_traits - }; - - return cmd; + { + struct GNUNET_TESTING_Command cmd = { + .cls = ns, + .label = label, + .run = &netjail_stop_run, + .finish = &netjail_stop_finish, + .cleanup = &netjail_stop_cleanup, + .traits = &netjail_stop_traits + }; + + return cmd; + } } -- cgit v1.2.3