]> git.meshlink.io Git - meshlink/blob - test/blackbox/run_blackbox_tests/execute_tests.h
Add blackbox test cases for submesh
[meshlink] / test / blackbox / run_blackbox_tests / execute_tests.h
1 #ifndef EXECUTE_TESTS_H
2 #define EXECUTE_TESTS_H
3
4 /*
5     execute_tests.h -- header file for execute_tests.c
6     Copyright (C) 2018  Guus Sliepen <guus@meshlink.io>
7
8     This program is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation; either version 2 of the License, or
11     (at your option) any later version.
12
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17
18     You should have received a copy of the GNU General Public License along
19     with this program; if not, write to the Free Software Foundation, Inc.,
20     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23 #include <stdbool.h>
24 #include "../common/mesh_event_handler.h"
25
26 typedef struct {
27         const mesh_event_t              *expected_events;
28         int                             current_index;
29         int                             max_events;
30 } node_status_t;
31
32 typedef bool (*test_step_func_t)(void);
33
34 int setup_test(void **state);
35 void execute_test(test_step_func_t step_func, void **state);
36 int teardown_test(void **state);
37
38 /// Changes the state of the node state machine.
39 /** This function changes the current state of the node
40  *
41  *  @param status           Pointer to status handle of that node.
42  *  @param currentEv        Current event triggered by the node.
43  *
44  *  @return                 This function returns true if state change is successful else returns false
45  */
46 extern bool change_state(node_status_t *status, mesh_event_t currentEv);
47
48 /// Sends SIGIO signal to all the nodes in the container.
49 /** This function Triggers SIGIO signal to all the target applications running inside the container
50  *
51  *  @param status           Pointer to array of status handles of target nodes.
52  *  @param start            Starting index from which to start in the array.
53  *  @param end              Ending index of the array
54  *  @param node_ids         Pointer to array of node id strings
55  *
56  *  @return                 Void
57  */
58 extern void signal_node_start(node_status_t *node_status, int start, int end, char *node_ids[]);
59
60 /// Checks for the completion of nodes state machines.
61 /** This function checks wheather the nodes state machines have reached their maximum state indexes
62  *
63  *  @param status           Pointer to array of status handles of target nodes.
64  *  @param length               Number of nodes to check.
65  *
66  *  @return                 This function returns true if all the nodes reached their max states
67  */
68 extern bool check_nodes_finished(node_status_t *node_status, int length);
69
70 #endif // TEST_STEP_H