diff options
Diffstat (limited to 'src/testing/testing_api_cmd_netjail_start.c')
-rw-r--r-- | src/testing/testing_api_cmd_netjail_start.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/testing/testing_api_cmd_netjail_start.c b/src/testing/testing_api_cmd_netjail_start.c index 536b356a6..1815b64d2 100644 --- a/src/testing/testing_api_cmd_netjail_start.c +++ b/src/testing/testing_api_cmd_netjail_start.c | |||
@@ -49,8 +49,10 @@ struct NetJailState | |||
49 | */ | 49 | */ |
50 | struct GNUNET_OS_Process *start_proc; | 50 | struct GNUNET_OS_Process *start_proc; |
51 | 51 | ||
52 | // Flag indication if the script finished. | 52 | /** |
53 | unsigned int finished; | 53 | * Flag indication if the script finished. |
54 | */ | ||
55 | enum GNUNET_GenericReturnValue finished; | ||
54 | }; | 56 | }; |
55 | 57 | ||
56 | 58 | ||
@@ -59,8 +61,7 @@ struct NetJailState | |||
59 | * | 61 | * |
60 | */ | 62 | */ |
61 | static void | 63 | static void |
62 | netjail_start_cleanup (void *cls, | 64 | netjail_start_cleanup (void *cls) |
63 | const struct GNUNET_TESTING_Command *cmd) | ||
64 | { | 65 | { |
65 | struct NetJailState *ns = cls; | 66 | struct NetJailState *ns = cls; |
66 | 67 | ||
@@ -90,13 +91,13 @@ netjail_start_cleanup (void *cls, | |||
90 | * Trait function of this cmd does nothing. | 91 | * Trait function of this cmd does nothing. |
91 | * | 92 | * |
92 | */ | 93 | */ |
93 | static int | 94 | static enum GNUNET_GenericReturnValue |
94 | netjail_start_traits (void *cls, | 95 | netjail_start_traits (void *cls, |
95 | const void **ret, | 96 | const void **ret, |
96 | const char *trait, | 97 | const char *trait, |
97 | unsigned int index) | 98 | unsigned int index) |
98 | { | 99 | { |
99 | return GNUNET_OK; | 100 | return GNUNET_NO; |
100 | } | 101 | } |
101 | 102 | ||
102 | 103 | ||
@@ -126,17 +127,14 @@ child_completed_callback (void *cls, | |||
126 | } | 127 | } |
127 | 128 | ||
128 | 129 | ||
129 | |||
130 | /** | 130 | /** |
131 | * The run method starts the script which setup the network namespaces. | 131 | * The run method starts the script which setup the network namespaces. |
132 | * | 132 | * |
133 | * @param cls closure. | 133 | * @param cls closure. |
134 | * @param cmd CMD being run. | ||
135 | * @param is interpreter state. | 134 | * @param is interpreter state. |
136 | */ | 135 | */ |
137 | static void | 136 | static void |
138 | netjail_start_run (void *cls, | 137 | netjail_start_run (void *cls, |
139 | const struct GNUNET_TESTING_Command *cmd, | ||
140 | struct GNUNET_TESTING_Interpreter *is) | 138 | struct GNUNET_TESTING_Interpreter *is) |
141 | { | 139 | { |
142 | struct NetJailState *ns = cls; | 140 | struct NetJailState *ns = cls; |
@@ -154,14 +152,14 @@ netjail_start_run (void *cls, | |||
154 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 152 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
155 | "No SUID for %s!\n", | 153 | "No SUID for %s!\n", |
156 | NETJAIL_START_SCRIPT); | 154 | NETJAIL_START_SCRIPT); |
157 | GNUNET_TESTING_interpreter_fail (); | 155 | GNUNET_TESTING_interpreter_fail (is); |
158 | } | 156 | } |
159 | else if (GNUNET_NO == helper_check) | 157 | else if (GNUNET_NO == helper_check) |
160 | { | 158 | { |
161 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 159 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
162 | "%s not found!\n", | 160 | "%s not found!\n", |
163 | NETJAIL_START_SCRIPT); | 161 | NETJAIL_START_SCRIPT); |
164 | GNUNET_TESTING_interpreter_fail (); | 162 | GNUNET_TESTING_interpreter_fail (is); |
165 | } | 163 | } |
166 | 164 | ||
167 | ns->start_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, | 165 | ns->start_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, |
@@ -182,7 +180,7 @@ netjail_start_run (void *cls, | |||
182 | * This function checks the flag NetJailState#finished, if this cmd finished. | 180 | * This function checks the flag NetJailState#finished, if this cmd finished. |
183 | * | 181 | * |
184 | */ | 182 | */ |
185 | static int | 183 | static enum GNUNET_GenericReturnValue |
186 | netjail_start_finish (void *cls, | 184 | netjail_start_finish (void *cls, |
187 | GNUNET_SCHEDULER_TaskCallback cont, | 185 | GNUNET_SCHEDULER_TaskCallback cont, |
188 | void *cont_cls) | 186 | void *cont_cls) |
@@ -196,6 +194,7 @@ netjail_start_finish (void *cls, | |||
196 | return ns->finished; | 194 | return ns->finished; |
197 | } | 195 | } |
198 | 196 | ||
197 | |||
199 | /** | 198 | /** |
200 | * Create command. | 199 | * Create command. |
201 | * | 200 | * |
@@ -214,16 +213,16 @@ GNUNET_TESTING_cmd_netjail_start (const char *label, | |||
214 | ns = GNUNET_new (struct NetJailState); | 213 | ns = GNUNET_new (struct NetJailState); |
215 | ns->local_m = local_m; | 214 | ns->local_m = local_m; |
216 | ns->global_n = global_n; | 215 | ns->global_n = global_n; |
217 | ns->finished = GNUNET_NO; | 216 | { |
218 | 217 | struct GNUNET_TESTING_Command cmd = { | |
219 | struct GNUNET_TESTING_Command cmd = { | 218 | .cls = ns, |
220 | .cls = ns, | 219 | .label = label, |
221 | .label = label, | 220 | .run = &netjail_start_run, |
222 | .run = &netjail_start_run, | 221 | .finish = &netjail_start_finish, |
223 | .finish = &netjail_start_finish, | 222 | .cleanup = &netjail_start_cleanup, |
224 | .cleanup = &netjail_start_cleanup, | 223 | .traits = &netjail_start_traits |
225 | .traits = &netjail_start_traits | 224 | }; |
226 | }; | 225 | |
227 | 226 | return cmd; | |
228 | return cmd; | 227 | } |
229 | } | 228 | } |