diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-03-06 14:03:36 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-03-06 14:03:36 +0100 |
commit | 901c07d786144b095cc4805be1336312f7835438 (patch) | |
tree | 1c047cced286326b66c55aa972454c553e4cc5e6 /src/include | |
parent | 2925310d67483aca6e055e1ce0593c6463cd6c72 (diff) | |
download | gnunet-901c07d786144b095cc4805be1336312f7835438.tar.gz gnunet-901c07d786144b095cc4805be1336312f7835438.zip |
revisit testing-NG header
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_testing_ng_lib.h | 453 |
1 files changed, 35 insertions, 418 deletions
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h index 2131952eb..bfdce7557 100644 --- a/src/include/gnunet_testing_ng_lib.h +++ b/src/include/gnunet_testing_ng_lib.h | |||
@@ -44,27 +44,6 @@ | |||
44 | return; \ | 44 | return; \ |
45 | } while (0) | 45 | } while (0) |
46 | 46 | ||
47 | /** | ||
48 | * Remove files from previous runs | ||
49 | * | ||
50 | * @param config_name configuration file to use+ | ||
51 | */ | ||
52 | void | ||
53 | GNUNET_TESTING_cleanup_files (const char *config_name); | ||
54 | |||
55 | |||
56 | /** | ||
57 | * Remove files from previous runs | ||
58 | * | ||
59 | * @param cls NULL | ||
60 | * @param cfg configuration | ||
61 | * @return #GNUNET_OK on success | ||
62 | */ | ||
63 | int | ||
64 | GNUNET_TESTING_cleanup_files_cfg (void *cls, | ||
65 | const struct | ||
66 | GNUNET_CONFIGURATION_Handle *cfg); | ||
67 | |||
68 | 47 | ||
69 | /* ******************* Generic interpreter logic ************ */ | 48 | /* ******************* Generic interpreter logic ************ */ |
70 | 49 | ||
@@ -86,12 +65,6 @@ struct GNUNET_TESTING_Interpreter | |||
86 | struct GNUNET_SCHEDULER_Task *task; | 65 | struct GNUNET_SCHEDULER_Task *task; |
87 | 66 | ||
88 | /** | 67 | /** |
89 | * ID of task called whenever we get a SIGCHILD. | ||
90 | * Used for #GNUNET_TESTING_wait_for_sigchld(). | ||
91 | */ | ||
92 | struct GNUNET_SCHEDULER_Task *child_death_task; | ||
93 | |||
94 | /** | ||
95 | * Our configuration. | 68 | * Our configuration. |
96 | */ | 69 | */ |
97 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 70 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -102,16 +75,6 @@ struct GNUNET_TESTING_Interpreter | |||
102 | struct GNUNET_SCHEDULER_Task *timeout_task; | 75 | struct GNUNET_SCHEDULER_Task *timeout_task; |
103 | 76 | ||
104 | /** | 77 | /** |
105 | * Function to call for cleanup at the end. Can be NULL. | ||
106 | */ | ||
107 | GNUNET_SCHEDULER_TaskCallback final_cleanup_cb; | ||
108 | |||
109 | /** | ||
110 | * Closure for #final_cleanup_cb(). | ||
111 | */ | ||
112 | void *final_cleanup_cb_cls; | ||
113 | |||
114 | /** | ||
115 | * Instruction pointer. Tells #interpreter_run() which instruction to run | 78 | * Instruction pointer. Tells #interpreter_run() which instruction to run |
116 | * next. Need (signed) int because it gets -1 when rewinding the | 79 | * next. Need (signed) int because it gets -1 when rewinding the |
117 | * interpreter to the first CMD. | 80 | * interpreter to the first CMD. |
@@ -123,50 +86,6 @@ struct GNUNET_TESTING_Interpreter | |||
123 | */ | 86 | */ |
124 | int result; | 87 | int result; |
125 | 88 | ||
126 | /** | ||
127 | * Handle to the auditor. NULL unless specifically initialized | ||
128 | * as part of #GNUNET_TESTING_auditor_setup(). | ||
129 | */ | ||
130 | struct AUDITOR_Handle *auditor; | ||
131 | |||
132 | /** | ||
133 | * Handle to exchange process; some commands need it | ||
134 | * to send signals. E.g. to trigger the key state reload. | ||
135 | */ | ||
136 | struct GNUNET_OS_Process *exchanged; | ||
137 | |||
138 | /** | ||
139 | * URL of the auditor (as per configuration). | ||
140 | */ | ||
141 | char *auditor_url; | ||
142 | |||
143 | /** | ||
144 | * URL of the exchange (as per configuration). | ||
145 | */ | ||
146 | char *exchange_url; | ||
147 | |||
148 | /** | ||
149 | * Is the interpreter running (#GNUNET_YES) or waiting | ||
150 | * for /keys (#GNUNET_NO)? | ||
151 | */ | ||
152 | int working; | ||
153 | |||
154 | /** | ||
155 | * Is the auditor running (#GNUNET_YES) or waiting | ||
156 | * for /version (#GNUNET_NO)? | ||
157 | */ | ||
158 | int auditor_working; | ||
159 | |||
160 | /** | ||
161 | * How often have we gotten a /keys response so far? | ||
162 | */ | ||
163 | unsigned int key_generation; | ||
164 | |||
165 | /** | ||
166 | * Exchange keys from last download. | ||
167 | */ | ||
168 | const struct EXCHANGE_Keys *keys; | ||
169 | |||
170 | }; | 89 | }; |
171 | 90 | ||
172 | 91 | ||
@@ -266,9 +185,9 @@ struct GNUNET_TESTING_Command | |||
266 | * @return the command, if it is found, or NULL. | 185 | * @return the command, if it is found, or NULL. |
267 | */ | 186 | */ |
268 | const struct GNUNET_TESTING_Command * | 187 | const struct GNUNET_TESTING_Command * |
269 | GNUNET_TESTING_interpreter_lookup_command (struct | 188 | GNUNET_TESTING_interpreter_lookup_command ( |
270 | GNUNET_TESTING_Interpreter *is, | 189 | struct GNUNET_TESTING_Interpreter *is, |
271 | const char *label); | 190 | const char *label); |
272 | 191 | ||
273 | 192 | ||
274 | /** | 193 | /** |
@@ -281,6 +200,7 @@ const char * | |||
281 | GNUNET_TESTING_interpreter_get_current_label ( | 200 | GNUNET_TESTING_interpreter_get_current_label ( |
282 | struct GNUNET_TESTING_Interpreter *is); | 201 | struct GNUNET_TESTING_Interpreter *is); |
283 | 202 | ||
203 | |||
284 | /** | 204 | /** |
285 | * Current command is done, run the next one. | 205 | * Current command is done, run the next one. |
286 | * | 206 | * |
@@ -289,6 +209,7 @@ GNUNET_TESTING_interpreter_get_current_label ( | |||
289 | void | 209 | void |
290 | GNUNET_TESTING_interpreter_next (struct GNUNET_TESTING_Interpreter *is); | 210 | GNUNET_TESTING_interpreter_next (struct GNUNET_TESTING_Interpreter *is); |
291 | 211 | ||
212 | |||
292 | /** | 213 | /** |
293 | * Current command failed, clean up and fail the test case. | 214 | * Current command failed, clean up and fail the test case. |
294 | * | 215 | * |
@@ -297,6 +218,7 @@ GNUNET_TESTING_interpreter_next (struct GNUNET_TESTING_Interpreter *is); | |||
297 | void | 218 | void |
298 | GNUNET_TESTING_interpreter_fail (struct GNUNET_TESTING_Interpreter *is); | 219 | GNUNET_TESTING_interpreter_fail (struct GNUNET_TESTING_Interpreter *is); |
299 | 220 | ||
221 | |||
300 | /** | 222 | /** |
301 | * Create command array terminator. | 223 | * Create command array terminator. |
302 | * | 224 | * |
@@ -322,196 +244,34 @@ GNUNET_TESTING_cmd_rewind_ip (const char *label, | |||
322 | 244 | ||
323 | 245 | ||
324 | /** | 246 | /** |
325 | * Wait until we receive SIGCHLD signal. | 247 | * Wait until we receive SIGCHLD signal. Then obtain the process trait of the |
326 | * Then obtain the process trait of the current | 248 | * current command, wait on the the zombie and continue with the next command. |
327 | * command, wait on the the zombie and continue | ||
328 | * with the next command. | ||
329 | * | 249 | * |
330 | * @param is interpreter state. | 250 | * @param is interpreter state. |
331 | */ | 251 | */ |
332 | void | 252 | // void |
333 | GNUNET_TESTING_wait_for_sigchld (struct GNUNET_TESTING_Interpreter *is); | 253 | // GNUNET_TESTING_wait_for_sigchld (struct GNUNET_TESTING_Interpreter *is); |
334 | 254 | // => replace with child_management.c | |
335 | |||
336 | /** | ||
337 | * Schedule the first CMD in the CMDs array. | ||
338 | * | ||
339 | * @param is interpreter state. | ||
340 | * @param commands array of all the commands to execute. | ||
341 | */ | ||
342 | void | ||
343 | GNUNET_TESTING_run (struct GNUNET_TESTING_Interpreter *is, | ||
344 | struct GNUNET_TESTING_Command *commands); | ||
345 | 255 | ||
346 | 256 | ||
347 | /** | 257 | /** |
348 | * Run the testsuite. Note, CMDs are copied into | 258 | * Start scheduling loop with signal handlers and run the |
349 | * the interpreter state because they are _usually_ | 259 | * test suite with the @a commands. |
350 | * defined into the "run" method that returns after | ||
351 | * having scheduled the test interpreter. | ||
352 | * | 260 | * |
353 | * @param is the interpreter state | 261 | * @param cfg_name name of configuration file to use |
354 | * @param commands the list of command to execute | 262 | * @param commands the list of command to execute |
355 | * @param timeout how long to wait | 263 | * @param timeout how long to wait for each command to execute |
356 | */ | ||
357 | void | ||
358 | GNUNET_TESTING_run2 (struct GNUNET_TESTING_Interpreter *is, | ||
359 | struct GNUNET_TESTING_Command *commands, | ||
360 | struct GNUNET_TIME_Relative timeout); | ||
361 | |||
362 | /** | ||
363 | * The function that contains the array of all the CMDs to run, | ||
364 | * which is then on charge to call some fashion of | ||
365 | * GNUNET_TESTING_run*. In all the test cases, this function is | ||
366 | * always the GNUnet-ish "run" method. | ||
367 | * | ||
368 | * @param cls closure. | ||
369 | * @param is interpreter state. | ||
370 | */ | ||
371 | typedef void | ||
372 | (*GNUNET_TESTING_Main)(void *cls, | ||
373 | struct GNUNET_TESTING_Interpreter *is); | ||
374 | |||
375 | |||
376 | /** | ||
377 | * Install signal handlers plus schedules the main wrapper | ||
378 | * around the "run" method. | ||
379 | * | ||
380 | * @param main_cb the "run" method which coontains all the | ||
381 | * commands. | ||
382 | * @param main_cb_cls a closure for "run", typically NULL. | ||
383 | * @param cfg configuration to use | ||
384 | * @param exchanged exchange process handle: will be put in the | ||
385 | * state as some commands - e.g. revoke - need to send | ||
386 | * signal to it, for example to let it know to reload the | ||
387 | * key state.. if NULL, the interpreter will run without | ||
388 | * trying to connect to the exchange first. | ||
389 | * @param exchange_connect GNUNET_YES if the test should connect | ||
390 | * to the exchange, GNUNET_NO otherwise | ||
391 | * @return #GNUNET_OK if all is okay, != #GNUNET_OK otherwise. | ||
392 | * non-GNUNET_OK codes are #GNUNET_SYSERR most of the | ||
393 | * times. | ||
394 | */ | ||
395 | int | ||
396 | GNUNET_TESTING_setup (GNUNET_TESTING_Main main_cb, | ||
397 | void *main_cb_cls, | ||
398 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
399 | struct GNUNET_OS_Process *exchanged, | ||
400 | int exchange_connect); | ||
401 | |||
402 | |||
403 | /** | ||
404 | * Install signal handlers plus schedules the main wrapper | ||
405 | * around the "run" method. | ||
406 | * | ||
407 | * @param main_cb the "run" method which contains all the | ||
408 | * commands. | ||
409 | * @param main_cb_cls a closure for "run", typically NULL. | ||
410 | * @param config_filename configuration filename. | ||
411 | * @return #GNUNET_OK if all is okay, != #GNUNET_OK otherwise. | 264 | * @return #GNUNET_OK if all is okay, != #GNUNET_OK otherwise. |
412 | * non-GNUNET_OK codes are #GNUNET_SYSERR most of the | 265 | * non-GNUNET_OK codes are #GNUNET_SYSERR most of the |
413 | * times. | 266 | * times. |
414 | */ | 267 | */ |
415 | int | 268 | int |
416 | GNUNET_TESTING_auditor_setup (GNUNET_TESTING_Main main_cb, | 269 | GNUNET_TESTING_run (const char *cfg_filename, |
417 | void *main_cb_cls, | 270 | struct GNUNET_TESTING_Command *commands, |
418 | const char *config_filename); | 271 | struct GNUNET_TIME_Relative timeout); |
419 | |||
420 | |||
421 | /** | ||
422 | * Closure for #GNUNET_TESTING_setup_with_exchange_cfg(). | ||
423 | */ | ||
424 | struct GNUNET_TESTING_SetupContext | ||
425 | { | ||
426 | /** | ||
427 | * Main function of the test to run. | ||
428 | */ | ||
429 | GNUNET_TESTING_Main main_cb; | ||
430 | |||
431 | /** | ||
432 | * Closure for @e main_cb. | ||
433 | */ | ||
434 | void *main_cb_cls; | ||
435 | |||
436 | /** | ||
437 | * Name of the configuration file. | ||
438 | */ | ||
439 | const char *config_filename; | ||
440 | }; | ||
441 | |||
442 | |||
443 | /** | ||
444 | * Initialize scheduler loop and curl context for the test case | ||
445 | * including starting and stopping the exchange using the given | ||
446 | * configuration file. | ||
447 | * | ||
448 | * @param cls must be a `struct GNUNET_TESTING_SetupContext *` | ||
449 | * @param cfg configuration to use. | ||
450 | * @return #GNUNET_OK if no errors occurred. | ||
451 | */ | ||
452 | int | ||
453 | GNUNET_TESTING_setup_with_exchange_cfg ( | ||
454 | void *cls, | ||
455 | const struct GNUNET_CONFIGURATION_Handle *cfg); | ||
456 | 272 | ||
457 | 273 | ||
458 | /** | 274 | /** |
459 | * Initialize scheduler loop and curl context for the test case | ||
460 | * including starting and stopping the exchange using the given | ||
461 | * configuration file. | ||
462 | * | ||
463 | * @param main_cb main method. | ||
464 | * @param main_cb_cls main method closure. | ||
465 | * @param config_file configuration file name. Is is used | ||
466 | * by both this function and the exchange itself. In the | ||
467 | * first case it gives out the exchange port number and | ||
468 | * the exchange base URL so as to check whether the port | ||
469 | * is available and the exchange responds when requested | ||
470 | * at its base URL. | ||
471 | * @return #GNUNET_OK if no errors occurred. | ||
472 | */ | ||
473 | int | ||
474 | GNUNET_TESTING_setup_with_exchange (GNUNET_TESTING_Main main_cb, | ||
475 | void *main_cb_cls, | ||
476 | const char *config_file); | ||
477 | |||
478 | |||
479 | /** | ||
480 | * Initialize scheduler loop and curl context for the test case | ||
481 | * including starting and stopping the auditor and exchange using | ||
482 | * the given configuration file. | ||
483 | * | ||
484 | * @param cls must be a `struct GNUNET_TESTING_SetupContext *` | ||
485 | * @param cfg configuration to use. | ||
486 | * @return #GNUNET_OK if no errors occurred. | ||
487 | */ | ||
488 | int | ||
489 | GNUNET_TESTING_setup_with_auditor_and_exchange_cfg ( | ||
490 | void *cls, | ||
491 | const struct GNUNET_CONFIGURATION_Handle *cfg); | ||
492 | |||
493 | |||
494 | /** | ||
495 | * Initialize scheduler loop and curl context for the test case | ||
496 | * including starting and stopping the auditor and exchange using | ||
497 | * the given configuration file. | ||
498 | * | ||
499 | * @param main_cb main method. | ||
500 | * @param main_cb_cls main method closure. | ||
501 | * @param config_file configuration file name. Is is used | ||
502 | * by both this function and the exchange itself. In the | ||
503 | * first case it gives out the exchange port number and | ||
504 | * the exchange base URL so as to check whether the port | ||
505 | * is available and the exchange responds when requested | ||
506 | * at its base URL. | ||
507 | * @return #GNUNET_OK if no errors occurred. | ||
508 | */ | ||
509 | int | ||
510 | GNUNET_TESTING_setup_with_auditor_and_exchange (GNUNET_TESTING_Main main_cb, | ||
511 | void *main_cb_cls, | ||
512 | const char *config_file); | ||
513 | |||
514 | /** | ||
515 | * Look for substring in a programs' name. | 275 | * Look for substring in a programs' name. |
516 | * | 276 | * |
517 | * @param prog program's name to look into | 277 | * @param prog program's name to look into |
@@ -525,175 +285,41 @@ GNUNET_TESTING_has_in_name (const char *prog, | |||
525 | /* ************** Specific interpreter commands ************ */ | 285 | /* ************** Specific interpreter commands ************ */ |
526 | 286 | ||
527 | /** | 287 | /** |
528 | * Make the "exec-auditor" CMD. | ||
529 | * | ||
530 | * @param label command label. | ||
531 | * @param config_filename configuration filename. | ||
532 | * @return the command. | ||
533 | */ | ||
534 | struct GNUNET_TESTING_Command | ||
535 | GNUNET_TESTING_cmd_exec_auditor (const char *label, | ||
536 | const char *config_filename); | ||
537 | |||
538 | |||
539 | /** | ||
540 | * Make a "wirewatch" CMD. | ||
541 | * | ||
542 | * @param label command label. | ||
543 | * @param config_filename configuration filename. | ||
544 | * | ||
545 | * @return the command. | ||
546 | */ | ||
547 | struct GNUNET_TESTING_Command | ||
548 | GNUNET_TESTING_cmd_exec_wirewatch (const char *label, | ||
549 | const char *config_filename); | ||
550 | |||
551 | /** | ||
552 | * Make a "aggregator" CMD. | ||
553 | * | ||
554 | * @param label command label. | ||
555 | * @param config_filename configuration file for the | ||
556 | * aggregator to use. | ||
557 | * @return the command. | ||
558 | */ | ||
559 | struct GNUNET_TESTING_Command | ||
560 | GNUNET_TESTING_cmd_exec_aggregator (const char *label, | ||
561 | const char *config_filename); | ||
562 | |||
563 | |||
564 | /** | ||
565 | * Make a "closer" CMD. Note that it is right now not supported to run the | ||
566 | * closer to close multiple reserves in combination with a subsequent reserve | ||
567 | * status call, as we cannot generate the traits necessary for multiple closed | ||
568 | * reserves. You can work around this by using multiple closer commands, one | ||
569 | * per reserve that is being closed. | ||
570 | * | ||
571 | * @param label command label. | ||
572 | * @param config_filename configuration file for the | ||
573 | * closer to use. | ||
574 | * @param expected_amount amount we expect to see wired from a @a expected_reserve_ref | ||
575 | * @param expected_fee closing fee we expect to see | ||
576 | * @param expected_reserve_ref reference to a reserve we expect the closer to drain; | ||
577 | * NULL if we do not expect the closer to do anything | ||
578 | * @return the command. | ||
579 | */ | ||
580 | struct GNUNET_TESTING_Command | ||
581 | GNUNET_TESTING_cmd_exec_closer (const char *label, | ||
582 | const char *config_filename, | ||
583 | const char *expected_amount, | ||
584 | const char *expected_fee, | ||
585 | const char *expected_reserve_ref); | ||
586 | |||
587 | |||
588 | /** | ||
589 | * Make a "transfer" CMD. | ||
590 | * | ||
591 | * @param label command label. | ||
592 | * @param config_filename configuration file for the | ||
593 | * transfer to use. | ||
594 | * @return the command. | ||
595 | */ | ||
596 | struct GNUNET_TESTING_Command | ||
597 | GNUNET_TESTING_cmd_exec_transfer (const char *label, | ||
598 | const char *config_filename); | ||
599 | |||
600 | |||
601 | /** | ||
602 | * Create a withdraw command, letting the caller specify | ||
603 | * the desired amount as string. | ||
604 | * | ||
605 | * @param label command label. | ||
606 | * @param reserve_reference command providing us with a reserve to withdraw from | ||
607 | * @param amount how much we withdraw. | ||
608 | * @param expected_response_code which HTTP response code | ||
609 | * we expect from the exchange. | ||
610 | * @return the withdraw command to be executed by the interpreter. | ||
611 | */ | ||
612 | struct GNUNET_TESTING_Command | ||
613 | GNUNET_TESTING_cmd_withdraw_amount (const char *label, | ||
614 | const char *reserve_reference, | ||
615 | const char *amount, | ||
616 | unsigned int expected_response_code); | ||
617 | |||
618 | /** | ||
619 | * Create a "wire" command. | ||
620 | * | ||
621 | * @param label the command label. | ||
622 | * @param expected_method which wire-transfer method is expected | ||
623 | * to be offered by the exchange. | ||
624 | * @param expected_fee the fee the exchange should charge. | ||
625 | * @param expected_response_code the HTTP response the exchange | ||
626 | * should return. | ||
627 | * @return the command. | ||
628 | */ | ||
629 | struct GNUNET_TESTING_Command | ||
630 | GNUNET_TESTING_cmd_wire (const char *label, | ||
631 | const char *expected_method, | ||
632 | const char *expected_fee, | ||
633 | unsigned int expected_response_code); | ||
634 | |||
635 | |||
636 | /** | ||
637 | * Create a GET "reserves" command. | ||
638 | * | ||
639 | * @param label the command label. | ||
640 | * @param reserve_reference reference to the reserve to check. | ||
641 | * @param expected_balance expected balance for the reserve. | ||
642 | * @param expected_response_code expected HTTP response code. | ||
643 | * @return the command. | ||
644 | */ | ||
645 | struct GNUNET_TESTING_Command | ||
646 | GNUNET_TESTING_cmd_status (const char *label, | ||
647 | const char *reserve_reference, | ||
648 | const char *expected_balance, | ||
649 | unsigned int expected_response_code); | ||
650 | |||
651 | /** | ||
652 | * Index of the deposit value trait of a deposit command. | ||
653 | */ | ||
654 | #define GNUNET_TESTING_CMD_DEPOSIT_TRAIT_IDX_DEPOSIT_VALUE 0 | ||
655 | |||
656 | /** | ||
657 | * Index of the deposit fee trait of a deposit command. | ||
658 | */ | ||
659 | #define GNUNET_TESTING_CMD_DEPOSIT_TRAIT_IDX_DEPOSIT_FEE 1 | ||
660 | |||
661 | /** | ||
662 | * Create a "signal" CMD. | 288 | * Create a "signal" CMD. |
663 | * | 289 | * |
664 | * @param label command label. | 290 | * @param label command label. |
665 | * @param process handle to the process to signal. | 291 | * @param process_label label of a command that has a process trait |
666 | * @param signal signal to send. | 292 | * @param process_index index of the process trait at @a process_label |
667 | * | 293 | * @param signal signal to send to @a process. |
668 | * @return the command. | 294 | * @return the command. |
669 | */ | 295 | */ |
670 | struct GNUNET_TESTING_Command | 296 | struct GNUNET_TESTING_Command |
671 | GNUNET_TESTING_cmd_signal (const char *label, | 297 | GNUNET_TESTING_cmd_signal (const char *label, |
672 | struct GNUNET_OS_Process *process, | 298 | const char *process_label, |
299 | unsigned int process_index, | ||
673 | int signal); | 300 | int signal); |
674 | 301 | ||
675 | 302 | ||
676 | /** | 303 | /** |
677 | * Sleep for @a duration_s seconds. | 304 | * Sleep for @a duration. |
678 | * | 305 | * |
679 | * @param label command label. | 306 | * @param label command label. |
680 | * @param duration_s number of seconds to sleep | 307 | * @param duration time to sleep |
681 | * @return the command. | 308 | * @return the command. |
682 | */ | 309 | */ |
683 | struct GNUNET_TESTING_Command | 310 | struct GNUNET_TESTING_Command |
684 | GNUNET_TESTING_cmd_sleep (const char *label, | 311 | GNUNET_TESTING_cmd_sleep (const char *label, |
685 | unsigned int duration_s); | 312 | struct GNUNET_TIME_Relative duration); |
313 | |||
686 | 314 | ||
687 | /** | 315 | /** |
688 | * Create a "batch" command. Such command takes a | 316 | * Create a "batch" command. Such command takes a end_CMD-terminated array of |
689 | * end_CMD-terminated array of CMDs and executed them. | 317 | * CMDs and executed them. Once it hits the end CMD, it passes the control to |
690 | * Once it hits the end CMD, it passes the control | 318 | * the next top-level CMD, regardless of it being another batch or ordinary |
691 | * to the next top-level CMD, regardless of it being | 319 | * CMD. |
692 | * another batch or ordinary CMD. | ||
693 | * | 320 | * |
694 | * @param label the command label. | 321 | * @param label the command label. |
695 | * @param batch array of CMDs to execute. | 322 | * @param batch array of CMDs to execute. |
696 | * | ||
697 | * @return the command. | 323 | * @return the command. |
698 | */ | 324 | */ |
699 | struct GNUNET_TESTING_Command | 325 | struct GNUNET_TESTING_Command |
@@ -709,6 +335,7 @@ GNUNET_TESTING_cmd_batch (const char *label, | |||
709 | int | 335 | int |
710 | GNUNET_TESTING_cmd_is_batch (const struct GNUNET_TESTING_Command *cmd); | 336 | GNUNET_TESTING_cmd_is_batch (const struct GNUNET_TESTING_Command *cmd); |
711 | 337 | ||
338 | |||
712 | /** | 339 | /** |
713 | * Advance internal pointer to next command. | 340 | * Advance internal pointer to next command. |
714 | * | 341 | * |
@@ -861,6 +488,7 @@ struct GNUNET_TESTING_Trait | |||
861 | GNUNET_TESTING_make_trait_process (unsigned int index, | 488 | GNUNET_TESTING_make_trait_process (unsigned int index, |
862 | struct GNUNET_OS_Process **processp); | 489 | struct GNUNET_OS_Process **processp); |
863 | 490 | ||
491 | |||
864 | /** | 492 | /** |
865 | * Offer number trait, 32-bit version. | 493 | * Offer number trait, 32-bit version. |
866 | * | 494 | * |
@@ -1051,6 +679,7 @@ struct GNUNET_TESTING_Trait | |||
1051 | GNUNET_TESTING_make_trait_uuid (unsigned int index, | 679 | GNUNET_TESTING_make_trait_uuid (unsigned int index, |
1052 | const struct GNUNET_Uuid *uuid); | 680 | const struct GNUNET_Uuid *uuid); |
1053 | 681 | ||
682 | |||
1054 | /** | 683 | /** |
1055 | * Obtain a absolute time from @a cmd. | 684 | * Obtain a absolute time from @a cmd. |
1056 | * | 685 | * |
@@ -1108,19 +737,7 @@ GNUNET_TESTING_make_trait_relative_time ( | |||
1108 | unsigned int index, | 737 | unsigned int index, |
1109 | const struct GNUNET_TIME_Relative *time); | 738 | const struct GNUNET_TIME_Relative *time); |
1110 | 739 | ||
1111 | /** | 740 | |
1112 | * Offer data from trait | ||
1113 | * | ||
1114 | * @param cmd command to extract the url from. | ||
1115 | * @param pt which url is to be picked, in case | ||
1116 | * multiple are offered. | ||
1117 | * @param[out] url where to write the url. | ||
1118 | * @return #GNUNET_OK on success. | ||
1119 | */ | ||
1120 | int | ||
1121 | GNUNET_TESTING_get_trait_what_am_i (const struct | ||
1122 | GNUNET_TESTING_Command *cmd, | ||
1123 | char *what_am_i); | ||
1124 | /** | 741 | /** |
1125 | * Create command. | 742 | * Create command. |
1126 | * | 743 | * |