aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-12-09 14:06:20 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-12-09 14:06:20 +0900
commit5357758fd97902f748bd3eb500d71c4ca0956065 (patch)
tree829f686992bab1714cee1940d2bb135e25ac6f8f /src/include
parent4f46e2f2e72a07871b14c0a9aed70438616c4dd5 (diff)
downloadgnunet-5357758fd97902f748bd3eb500d71c4ca0956065.tar.gz
gnunet-5357758fd97902f748bd3eb500d71c4ca0956065.zip
TESTING: Various notes on API
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_testing_barrier.h13
-rw-r--r--src/include/gnunet_testing_netjail_lib.h19
-rw-r--r--src/include/gnunet_testing_ng_lib.h30
3 files changed, 46 insertions, 16 deletions
diff --git a/src/include/gnunet_testing_barrier.h b/src/include/gnunet_testing_barrier.h
index ed4624e1b..b02499d14 100644
--- a/src/include/gnunet_testing_barrier.h
+++ b/src/include/gnunet_testing_barrier.h
@@ -67,6 +67,7 @@ struct GNUNET_TESTING_BarrierList
67 67
68/** 68/**
69 * Message send to a child loop to inform the child loop about a barrier being advanced. 69 * Message send to a child loop to inform the child loop about a barrier being advanced.
70 * FIXME: This is not packed and contains a char*... no payload documentation.
70 */ 71 */
71struct GNUNET_TESTING_CommandBarrierAdvanced 72struct GNUNET_TESTING_CommandBarrierAdvanced
72{ 73{
@@ -84,6 +85,7 @@ struct GNUNET_TESTING_CommandBarrierAdvanced
84/** 85/**
85 * Message send by a child loop to inform the master loop how much 86 * Message send by a child loop to inform the master loop how much
86 * GNUNET_CMDS_BARRIER_REACHED messages the child will send. 87 * GNUNET_CMDS_BARRIER_REACHED messages the child will send.
88 * FIXME: Not packed and contains char*; int in NBO? bitlength undefined.
87 */ 89 */
88struct GNUNET_TESTING_CommandBarrierAttached 90struct GNUNET_TESTING_CommandBarrierAttached
89{ 91{
@@ -109,6 +111,7 @@ struct GNUNET_TESTING_CommandBarrierAttached
109}; 111};
110 112
111 113
114// FIXME: See above
112struct GNUNET_TESTING_CommandBarrierReached 115struct GNUNET_TESTING_CommandBarrierReached
113{ 116{
114 /** 117 /**
@@ -138,6 +141,12 @@ struct GNUNET_TESTING_CommandBarrierReached
138struct GNUNET_TESTING_Barrier* 141struct GNUNET_TESTING_Barrier*
139GNUNET_TESTING_barrier_new (const char *testcase_name); 142GNUNET_TESTING_barrier_new (const char *testcase_name);
140 143
144/**
145 * FIXME: documentation
146 * FIXME: high-level it is baffling how we need both the GNUNET_TESTING_Barrier
147 * and the Command that creates barriers. Conceptually this seems to be
148 * very much separate. Can we move _Barrier completely into testing as private?
149 */
141struct GNUNET_TESTING_Command 150struct GNUNET_TESTING_Command
142GNUNET_TESTING_cmd_barrier_create ( 151GNUNET_TESTING_cmd_barrier_create (
143 const char *label, 152 const char *label,
@@ -149,6 +158,7 @@ GNUNET_TESTING_cmd_barrier_create (
149// async version implies reached but does not 158// async version implies reached but does not
150// wait on other peers to reach it. 159// wait on other peers to reach it.
151/** 160/**
161 * FIXME: Documentation
152 * Create command. 162 * Create command.
153 * 163 *
154 * @param label name for command. 164 * @param label name for command.
@@ -171,6 +181,8 @@ GNUNET_TESTING_cmd_barrier_reached (
171 181
172 182
173/** 183/**
184 * FIXME: Return type
185 * FIXME: Documentation
174 * Can we advance the barrier? 186 * Can we advance the barrier?
175 * 187 *
176 * @param barrier The barrier in question. 188 * @param barrier The barrier in question.
@@ -181,6 +193,7 @@ GNUNET_TESTING_can_barrier_advance (struct GNUNET_TESTING_Barrier *barrier);
181 193
182 194
183/** 195/**
196 * FIXME: Naming
184 * Send Message to netjail nodes that a barrier can be advanced. 197 * Send Message to netjail nodes that a barrier can be advanced.
185 * 198 *
186 * @param is The interpreter loop. 199 * @param is The interpreter loop.
diff --git a/src/include/gnunet_testing_netjail_lib.h b/src/include/gnunet_testing_netjail_lib.h
index 53cae38c6..eb16f6b86 100644
--- a/src/include/gnunet_testing_netjail_lib.h
+++ b/src/include/gnunet_testing_netjail_lib.h
@@ -50,6 +50,7 @@ struct GNUNET_TESTING_NetjailRouter
50 50
51 51
52/** 52/**
53 * FIXME: Naming
53 * Enum for the different types of nodes. 54 * Enum for the different types of nodes.
54 */ 55 */
55enum GNUNET_TESTING_NODE_TYPE 56enum GNUNET_TESTING_NODE_TYPE
@@ -265,6 +266,7 @@ GNUNET_TESTING_get_topo_from_file (const char *filename);
265 266
266 267
267/** 268/**
269 * FIXME: this could use a "to_string".
268 * Parse the topology data. 270 * Parse the topology data.
269 * 271 *
270 * @param data The topology data. 272 * @param data The topology data.
@@ -386,6 +388,7 @@ struct GNUNET_TESTING_TestState
386}; 388};
387 389
388/** 390/**
391 * FIXME: This was also not namespaces.
389 * Struct with information for callbacks. 392 * Struct with information for callbacks.
390 * 393 *
391 */ 394 */
@@ -408,6 +411,7 @@ struct GNUNET_TESTING_BlockState
408}; 411};
409 412
410/** 413/**
414 * FIXME: This was also not namespaced
411 * Struct to hold information for callbacks. 415 * Struct to hold information for callbacks.
412 * 416 *
413 */ 417 */
@@ -426,7 +430,7 @@ struct GNUNET_TESTING_LocalPreparedState
426}; 430};
427 431
428/** 432/**
429 * Create command. 433 * Create command. FIXME: What?
430 * 434 *
431 * @param label name for command. 435 * @param label name for command.
432 * @param create_label Label of the cmd which started the test system. 436 * @param create_label Label of the cmd which started the test system.
@@ -437,13 +441,14 @@ struct GNUNET_TESTING_Command
437GNUNET_TESTING_cmd_system_destroy (const char *label, 441GNUNET_TESTING_cmd_system_destroy (const char *label,
438 const char *create_label); 442 const char *create_label);
439 443
440 444//FIXME
441struct GNUNET_TESTING_Command 445struct GNUNET_TESTING_Command
442GNUNET_TESTING_cmd_system_create (const char *label, 446GNUNET_TESTING_cmd_system_create (const char *label,
443 const char *testdir); 447 const char *testdir);
444 448
445 449
446/** 450/**
451 * FIXME
447 * Create command. 452 * Create command.
448 * 453 *
449 * @param label name for command. 454 * @param label name for command.
@@ -458,6 +463,7 @@ GNUNET_TESTING_cmd_netjail_start (const char *label,
458 463
459 464
460/** 465/**
466 * FIXME
461 * Create command. 467 * Create command.
462 * 468 *
463 * @param label name for command. 469 * @param label name for command.
@@ -472,6 +478,8 @@ GNUNET_TESTING_cmd_netjail_stop (const char *label,
472 478
473 479
474/** 480/**
481 * FIXME
482 * FIXME Naming?
475 * Create command. 483 * Create command.
476 * 484 *
477 * @param label Name for the command. 485 * @param label Name for the command.
@@ -506,6 +514,8 @@ GNUNET_TESTING_cmd_stop_testing_system (
506 514
507/** 515/**
508 * Create a GNUNET_CMDS_LOCAL_FINISHED message. 516 * Create a GNUNET_CMDS_LOCAL_FINISHED message.
517 * FIXME: This is strange as messages are not really used
518 * like this. Consider removing.
509 * 519 *
510 * @return The GNUNET_CMDS_LOCAL_FINISHED message. 520 * @return The GNUNET_CMDS_LOCAL_FINISHED message.
511 */ 521 */
@@ -513,6 +523,7 @@ struct GNUNET_MessageHeader *
513GNUNET_TESTING_send_local_test_finished_msg (); 523GNUNET_TESTING_send_local_test_finished_msg ();
514 524
515 525
526//FIXME
516struct GNUNET_TESTING_Command 527struct GNUNET_TESTING_Command
517GNUNET_TESTING_cmd_block_until_all_peers_started ( 528GNUNET_TESTING_cmd_block_until_all_peers_started (
518 const char *label, 529 const char *label,
@@ -520,6 +531,7 @@ GNUNET_TESTING_cmd_block_until_all_peers_started (
520 531
521 532
522/** 533/**
534 * FIXME
523 * Create command. 535 * Create command.
524 * 536 *
525 * @param label name for command. 537 * @param label name for command.
@@ -532,6 +544,7 @@ GNUNET_TESTING_cmd_block_until_external_trigger (
532 const char *label); 544 const char *label);
533 545
534/** 546/**
547 * FIXME
535 * Create command. 548 * Create command.
536 * 549 *
537 * @param label name for command. 550 * @param label name for command.
@@ -544,6 +557,7 @@ GNUNET_TESTING_cmd_send_peer_ready (const char *label,
544 557
545 558
546/** 559/**
560 * FIXME
547 * Create command. 561 * Create command.
548 * 562 *
549 * @param label name for command. 563 * @param label name for command.
@@ -556,6 +570,7 @@ GNUNET_TESTING_cmd_local_test_finished (
556 GNUNET_TESTING_cmd_helper_write_cb write_message); 570 GNUNET_TESTING_cmd_helper_write_cb write_message);
557 571
558/** 572/**
573 * FIXME
559 * Create command. 574 * Create command.
560 * 575 *
561 * @param label name for command. 576 * @param label name for command.
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h
index d218a65db..270fdab26 100644
--- a/src/include/gnunet_testing_ng_lib.h
+++ b/src/include/gnunet_testing_ng_lib.h
@@ -328,6 +328,9 @@ GNUNET_TESTING_cmd_end (void);
328 328
329/** 329/**
330 * Turn asynchronous command into non blocking command by setting asynchronous_finish to true. 330 * Turn asynchronous command into non blocking command by setting asynchronous_finish to true.
331 * FIXME: what is this API doing? Is it returning a new cmd which is unblocking?
332 * Is it modifying cmd?
333 * Looking at the code, it both modifying cmd AND returning a copy oO
331 * 334 *
332 * @param cmd command to make synchronous. 335 * @param cmd command to make synchronous.
333 * @return a finish-command. 336 * @return a finish-command.
@@ -370,6 +373,8 @@ GNUNET_TESTING_cmd_rewind_ip (const char *label,
370 373
371/** 374/**
372 * Function called with the final result of the test. 375 * Function called with the final result of the test.
376 * FIXME: This may want to use a GNUNET_ErrorCode (namespaced, e.g.
377 * GNUNET_EC_TESTING_*)
373 * 378 *
374 * @param cls closure 379 * @param cls closure
375 * @param rv #GNUNET_OK if the test passed 380 * @param rv #GNUNET_OK if the test passed
@@ -385,7 +390,7 @@ typedef void
385 * defined into the "run" method that returns after 390 * defined into the "run" method that returns after
386 * having scheduled the test interpreter. 391 * having scheduled the test interpreter.
387 * 392 *
388 * @param commands the list of command to execute 393 * @param commands the array of command to execute
389 * @param timeout how long to wait for each command to execute 394 * @param timeout how long to wait for each command to execute
390 * @param rc function to call with the final result 395 * @param rc function to call with the final result
391 * @param rc_cls closure for @a rc 396 * @param rc_cls closure for @a rc
@@ -402,6 +407,7 @@ GNUNET_TESTING_run (const struct GNUNET_TESTING_Command *commands,
402 * Start a GNUnet scheduler event loop and 407 * Start a GNUnet scheduler event loop and
403 * run the testsuite. Return 0 upon success. 408 * run the testsuite. Return 0 upon success.
404 * Expected to be called directly from main(). 409 * Expected to be called directly from main().
410 * FIXME: Why is this commands array here not const?
405 * 411 *
406 * @param commands the list of command to execute 412 * @param commands the list of command to execute
407 * @param timeout how long to wait for each command to execute 413 * @param timeout how long to wait for each command to execute
@@ -413,19 +419,6 @@ GNUNET_TESTING_main (struct GNUNET_TESTING_Command *commands,
413 419
414 420
415/** 421/**
416 * Look for substring in a programs' name.
417 *
418 * @param prog program's name to look into
419 * @param marker chunk to find in @a prog
420 * // FIXME: this does not belong here! => libgnunetutil, maybe?
421 * // FIXME: return bool? document return value!
422 * // FIXME: man strstr??
423 */
424int
425GNUNET_TESTING_has_in_name (const char *prog,
426 const char *marker);
427
428/**
429 * Deleting all barriers create in the context of this interpreter. 422 * Deleting all barriers create in the context of this interpreter.
430 * 423 *
431 * @param is The interpreter. 424 * @param is The interpreter.
@@ -473,6 +466,8 @@ GNUNET_TESTING_add_netjail_helper (struct GNUNET_TESTING_Interpreter *is,
473 466
474/** 467/**
475 * Send Message to netjail nodes that a barrier can be advanced. 468 * Send Message to netjail nodes that a barrier can be advanced.
469 * FIXME: Naming. No "netjail" in argument. Or is there a
470 * GNUNET_TESTING_send_message without "to_netjail"??
476 * 471 *
477 * @param is The interpreter. 472 * @param is The interpreter.
478 * @param global_node_number The node to inform. 473 * @param global_node_number The node to inform.
@@ -486,6 +481,8 @@ GNUNET_TESTING_send_message_to_netjail (struct GNUNET_TESTING_Interpreter *is,
486 481
487/** 482/**
488 * Returns the actual running command. 483 * Returns the actual running command.
484 * FIXME: Is Command allocated? Is it constant? Should this be a private
485 * function? => not used outside of testing
489 * 486 *
490 * @param is Global state of the interpreter, used by a command 487 * @param is Global state of the interpreter, used by a command
491 * to access information about other commands. 488 * to access information about other commands.
@@ -498,6 +495,7 @@ GNUNET_TESTING_interpreter_get_current_command (
498 495
499/** 496/**
500 * Check if the command is running. 497 * Check if the command is running.
498 * FIXME: Unused function.
501 * 499 *
502 * @param command The command to check. 500 * @param command The command to check.
503 * @return GNUNET_NO if the command is not running, GNUNET_YES if it is running. 501 * @return GNUNET_NO if the command is not running, GNUNET_YES if it is running.
@@ -508,6 +506,7 @@ GNUNET_TESTING_running (const struct GNUNET_TESTING_Command *command);
508 506
509/** 507/**
510 * Check if a command is finished. 508 * Check if a command is finished.
509 * FIXME: Unused function
511 * 510 *
512 * @param command The command to check. 511 * @param command The command to check.
513 * @return GNUNET_NO if the command is not finished, GNUNET_YES if it is finished. 512 * @return GNUNET_NO if the command is not finished, GNUNET_YES if it is finished.
@@ -595,6 +594,7 @@ struct GNUNET_TESTING_Timer
595 594
596/** 595/**
597 * Retrieve the public key from the test system with the unique node id. 596 * Retrieve the public key from the test system with the unique node id.
597 * FIXME: Naming. => get_peer? This returns a PeerIdentity not a PublicKey
598 * 598 *
599 * @param num The unique node id. 599 * @param num The unique node id.
600 * @param tl_system The test system. 600 * @param tl_system The test system.
@@ -618,6 +618,7 @@ GNUNET_TESTING_cmd_stat (struct GNUNET_TESTING_Timer *timers);
618/* *** Generic trait logic for implementing traits ********* */ 618/* *** Generic trait logic for implementing traits ********* */
619 619
620/** 620/**
621 * FIXME: Documentation
621 * A trait. 622 * A trait.
622 */ 623 */
623struct GNUNET_TESTING_Trait 624struct GNUNET_TESTING_Trait
@@ -652,6 +653,7 @@ GNUNET_TESTING_trait_end (void);
652 653
653/** 654/**
654 * Extract a trait. 655 * Extract a trait.
656 * FIXME: Naming. This is something like "contains trait".
655 * 657 *
656 * @param traits the array of all the traits. 658 * @param traits the array of all the traits.
657 * @param[out] ret where to store the result. 659 * @param[out] ret where to store the result.