aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-01-11 17:13:44 +0100
committerChristian Grothoff <christian@grothoff.org>2023-01-11 17:13:44 +0100
commit0fd3a1d3cc5f3dab3f36ed2cdf194f76d7ab484a (patch)
treebc2a184f09fb3334614ed0ec1b2cbccc586b1a3e /src/testing
parent10c32ba4e18cb8a2d0a7410c18cf6756d1951036 (diff)
downloadgnunet-0fd3a1d3cc5f3dab3f36ed2cdf194f76d7ab484a.tar.gz
gnunet-0fd3a1d3cc5f3dab3f36ed2cdf194f76d7ab484a.zip
-fix include order
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing_api_loop.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 5385a53d7..7d719afc0 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -25,7 +25,6 @@
25 * @author Marcello Stanisci (GNU Taler testing) 25 * @author Marcello Stanisci (GNU Taler testing)
26 * @author t3sserakt 26 * @author t3sserakt
27 */ 27 */
28#include "gnunet_common.h"
29#include "platform.h" 28#include "platform.h"
30#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
31#include "gnunet_testing_ng_lib.h" 30#include "gnunet_testing_ng_lib.h"
@@ -520,6 +519,7 @@ GNUNET_TESTING_run (const struct GNUNET_TESTING_Command *commands,
520 return is; 519 return is;
521} 520}
522 521
522
523struct GNUNET_TESTING_Command 523struct GNUNET_TESTING_Command
524GNUNET_TESTING_command_new (void *cls, 524GNUNET_TESTING_command_new (void *cls,
525 const char *label, 525 const char *label,
@@ -543,6 +543,7 @@ GNUNET_TESTING_command_new (void *cls,
543 543
544} 544}
545 545
546
546/** 547/**
547 * Closure for #loop_run(). 548 * Closure for #loop_run().
548 */ 549 */
@@ -603,6 +604,7 @@ loop_run (void *cls)
603 mp); 604 mp);
604} 605}
605 606
607
606/** 608/**
607 * Continuation function from GNUNET_HELPER_send() 609 * Continuation function from GNUNET_HELPER_send()
608 * 610 *
@@ -617,6 +619,7 @@ clear_msg (void *cls, int result)
617 GNUNET_assert (GNUNET_YES == result); 619 GNUNET_assert (GNUNET_YES == result);
618} 620}
619 621
622
620/** 623/**
621 * Adding a helper handle to the interpreter. 624 * Adding a helper handle to the interpreter.
622 * 625 *
@@ -632,7 +635,7 @@ GNUNET_TESTING_add_netjail_helper (struct GNUNET_TESTING_Interpreter *is,
632 635
633 636
634/** 637/**
635 * Send Message to netjail nodes. 638 * Send Message to netjail nodes.
636 * 639 *
637 * @param is The interpreter. 640 * @param is The interpreter.
638 * @param global_node_number The netjail node to inform. 641 * @param global_node_number The netjail node to inform.
@@ -640,8 +643,8 @@ GNUNET_TESTING_add_netjail_helper (struct GNUNET_TESTING_Interpreter *is,
640 */ 643 */
641void 644void
642send_message_to_netjail (struct GNUNET_TESTING_Interpreter *is, 645send_message_to_netjail (struct GNUNET_TESTING_Interpreter *is,
643 unsigned int global_node_number, 646 unsigned int global_node_number,
644 struct GNUNET_MessageHeader *header) 647 struct GNUNET_MessageHeader *header)
645{ 648{
646 const struct GNUNET_HELPER_Handle *helper; 649 const struct GNUNET_HELPER_Handle *helper;
647 650
@@ -657,10 +660,11 @@ send_message_to_netjail (struct GNUNET_TESTING_Interpreter *is,
657 NULL); 660 NULL);
658} 661}
659 662
663
660void 664void
661TST_interpreter_send_barrier_crossable (struct GNUNET_TESTING_Interpreter *is, 665TST_interpreter_send_barrier_crossable (struct GNUNET_TESTING_Interpreter *is,
662 const char *barrier_name, 666 const char *barrier_name,
663 unsigned int global_node_number) 667 unsigned int global_node_number)
664{ 668{
665 struct CommandBarrierCrossable *adm; 669 struct CommandBarrierCrossable *adm;
666 size_t msg_length; 670 size_t msg_length;
@@ -677,13 +681,12 @@ TST_interpreter_send_barrier_crossable (struct GNUNET_TESTING_Interpreter *is,
677 adm->header.size = htons ((uint16_t) msg_length); 681 adm->header.size = htons ((uint16_t) msg_length);
678 memcpy (&adm[1], barrier_name, name_len); 682 memcpy (&adm[1], barrier_name, name_len);
679 send_message_to_netjail (is, 683 send_message_to_netjail (is,
680 global_node_number, 684 global_node_number,
681 &adm->header); 685 &adm->header);
682 GNUNET_free (adm); 686 GNUNET_free (adm);
683} 687}
684 688
685 689
686
687int 690int
688free_barrier_node_cb (void *cls, 691free_barrier_node_cb (void *cls,
689 const struct GNUNET_ShortHashCode *key, 692 const struct GNUNET_ShortHashCode *key,
@@ -699,12 +702,13 @@ free_barrier_node_cb (void *cls,
699 if (GNUNET_NO == is->finishing) 702 if (GNUNET_NO == is->finishing)
700 { 703 {
701 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 704 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
702 "TST_interpreter_send_barrier_crossable\n"); 705 "TST_interpreter_send_barrier_crossable\n");
703 TST_interpreter_send_barrier_crossable (is, 706 TST_interpreter_send_barrier_crossable (is,
704 barrier->name, 707 barrier->name,
705 node->node_number); 708 node->node_number);
706 } 709 }
707 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multishortmap_remove (barrier->nodes, key, node)); 710 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multishortmap_remove (
711 barrier->nodes, key, node));
708 return GNUNET_YES; 712 return GNUNET_YES;
709} 713}
710 714
@@ -718,7 +722,7 @@ free_barrier_node_cb (void *cls,
718 */ 722 */
719struct GNUNET_TESTING_Barrier * 723struct GNUNET_TESTING_Barrier *
720TST_interpreter_get_barrier (struct GNUNET_TESTING_Interpreter *is, 724TST_interpreter_get_barrier (struct GNUNET_TESTING_Interpreter *is,
721 const char *barrier_name) 725 const char *barrier_name)
722{ 726{
723 struct GNUNET_HashCode hc; 727 struct GNUNET_HashCode hc;
724 struct GNUNET_ShortHashCode create_key; 728 struct GNUNET_ShortHashCode create_key;
@@ -745,7 +749,7 @@ TST_interpreter_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is,
745 struct CommandListEntry *pos; 749 struct CommandListEntry *pos;
746 struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls; 750 struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls;
747 struct GNUNET_TESTING_Barrier *barrier = TST_interpreter_get_barrier (is, 751 struct GNUNET_TESTING_Barrier *barrier = TST_interpreter_get_barrier (is,
748 barrier_name); 752 barrier_name);
749 753
750 while (NULL != barrier && NULL != (pos = barrier->cmds_head)) 754 while (NULL != barrier && NULL != (pos = barrier->cmds_head))
751 { 755 {
@@ -756,8 +760,8 @@ TST_interpreter_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is,
756 GNUNET_NO == pos->command->asynchronous_finish) 760 GNUNET_NO == pos->command->asynchronous_finish)
757 { 761 {
758 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 762 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
759 "command label %s finish\n", 763 "command label %s finish\n",
760 pos->command->label); 764 pos->command->label);
761 GNUNET_TESTING_async_finish (pos->command->ac); 765 GNUNET_TESTING_async_finish (pos->command->ac);
762 } 766 }
763 else if (GNUNET_NO == pos->command->ac->finished) 767 else if (GNUNET_NO == pos->command->ac->finished)
@@ -781,7 +785,8 @@ TST_interpreter_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is,
781 free_barrier_node_cb_cls->is = is; 785 free_barrier_node_cb_cls->is = is;
782 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 786 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
783 "freeing nodes\n"); 787 "freeing nodes\n");
784 GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes, free_barrier_node_cb, 788 GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes,
789 free_barrier_node_cb,
785 free_barrier_node_cb_cls); 790 free_barrier_node_cb_cls);
786 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 791 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
787 "nodes freed\n"); 792 "nodes freed\n");
@@ -807,7 +812,8 @@ free_barriers_cb (void *cls,
807 free_barrier_node_cb_cls = GNUNET_new (struct FreeBarrierNodeCbCls); 812 free_barrier_node_cb_cls = GNUNET_new (struct FreeBarrierNodeCbCls);
808 free_barrier_node_cb_cls->barrier = barrier; 813 free_barrier_node_cb_cls->barrier = barrier;
809 free_barrier_node_cb_cls->is = is; 814 free_barrier_node_cb_cls->is = is;
810 GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes, free_barrier_node_cb, 815 GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes,
816 free_barrier_node_cb,
811 free_barrier_node_cb_cls); 817 free_barrier_node_cb_cls);
812 GNUNET_CONTAINER_multishortmap_destroy (barrier->nodes); 818 GNUNET_CONTAINER_multishortmap_destroy (barrier->nodes);
813 barrier->nodes = NULL; 819 barrier->nodes = NULL;
@@ -824,6 +830,7 @@ free_barriers_cb (void *cls,
824 return GNUNET_YES; 830 return GNUNET_YES;
825} 831}
826 832
833
827/** 834/**
828 * Deleting all barriers create in the context of this interpreter. 835 * Deleting all barriers create in the context of this interpreter.
829 * 836 *
@@ -847,7 +854,7 @@ TST_interpreter_delete_barriers (struct GNUNET_TESTING_Interpreter *is)
847 */ 854 */
848void 855void
849TST_interpreter_add_barrier (struct GNUNET_TESTING_Interpreter *is, 856TST_interpreter_add_barrier (struct GNUNET_TESTING_Interpreter *is,
850 struct GNUNET_TESTING_Barrier *barrier) 857 struct GNUNET_TESTING_Barrier *barrier)
851{ 858{
852 struct GNUNET_HashCode hc; 859 struct GNUNET_HashCode hc;
853 struct GNUNET_ShortHashCode create_key; 860 struct GNUNET_ShortHashCode create_key;