X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=test%2Fblackbox%2Frun_blackbox_tests%2Fexecute_tests.c;h=7232911ed36c705172cf268c59ddb740bdc8fb12;hb=f9235480fa69f92b50156ac8b6a70f3558bb0bbf;hp=b9fd1fa91a75637e2d4b8ad1349cd7e52caea94d;hpb=de40dd736a1b048e5e0f856184f832fa4db184d3;p=meshlink diff --git a/test/blackbox/run_blackbox_tests/execute_tests.c b/test/blackbox/run_blackbox_tests/execute_tests.c index b9fd1fa9..7232911e 100644 --- a/test/blackbox/run_blackbox_tests/execute_tests.c +++ b/test/blackbox/run_blackbox_tests/execute_tests.c @@ -35,7 +35,6 @@ int setup_test(void **state) { for(i = 0; i < state_ptr->num_nodes; i++) { meta_conn_status[i] = false; - node_reachable_status[i] = false; } setup_containers(state); @@ -80,3 +79,48 @@ int teardown_test(void **state) { return EXIT_SUCCESS; } + +bool change_state(node_status_t *status, mesh_event_t currentEv) { + + if(status->current_index == status->max_events) { + return false; + } + + if(currentEv == status->expected_events[status->current_index]) { + status->current_index = status->current_index + 1; + + return true; + } else { + return false; + } +} + +void signal_node_start(node_status_t *node_status, int start, int end, char *node_ids[]) { + int i, index; + + for(i = start; i <= end; i++) { + index = node_status[i].current_index; + + if(index < 1 || NODE_JOINED != node_status[i].expected_events[index - 1]) { + return; + } + } + + + for(i = start; i <= end; i++) { + fprintf(stderr, "\tSending signals to '%s'\n", node_ids[i]); + node_step_in_container(node_ids[i], "SIGIO"); + } + + return; +} + +bool check_nodes_finished(node_status_t *node_status, int length) { + for(int i = 0; i < length; i++) { + if(node_status[i].current_index != node_status[i].max_events) { + return false; + } + } + + return true; +}