2 test_cases_stop_close.c -- Execution of specific meshlink black box test cases
3 Copyright (C) 2018 Guus Sliepen <guus@meshlink.io>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "execute_tests.h"
21 #include "test_cases_stop_close.h"
22 #include "../common/containers.h"
23 #include "../common/test_step.h"
24 #include "../common/common_handlers.h"
33 #define CLOSE_FILE_PATH "/home/sairoop/meshlink/test/blackbox/test_case_close/mesh_close"
34 #define VALGRIND_LOG "valgrind.log"
36 static void test_case_mesh_close_01(void **state);
37 static bool test_steps_mesh_close_01(void);
38 static void test_case_mesh_stop_01(void **state);
39 static bool test_steps_mesh_stop_01(void);
41 /* State structure for meshlink_close Test Case #1 */
42 static black_box_state_t test_mesh_close_01_state = {
43 .test_case_name = "test_case_mesh_close_01",
46 /* State structure for meshlink_close Test Case #1 */
47 static black_box_state_t test_mesh_stop_01_state = {
48 .test_case_name = "test_case_mesh_stop_01",
51 /* Execute meshlink_close Test Case # 1*/
52 static void test_case_mesh_close_01(void **state) {
53 execute_test(test_steps_mesh_close_01, state);
56 /* Test Steps for meshlink_close Test Case # 1*/
58 static bool test_steps_mesh_close_01(void) {
60 assert_int_equal(meshlink_errno, MESHLINK_EINVAL);
65 /* Execute meshlink_stop Test Case # 1*/
66 static void test_case_mesh_stop_01(void **state) {
67 execute_test(test_steps_mesh_stop_01, state);
70 /* Test Steps for meshlink_stop Test Case # 1*/
71 static bool test_steps_mesh_stop_01(void) {
73 assert_int_equal(meshlink_errno, MESHLINK_EINVAL);
78 int test_meshlink_stop_close(void) {
79 const struct CMUnitTest blackbox_stop_close_tests[] = {
80 cmocka_unit_test_prestate_setup_teardown(test_case_mesh_stop_01, NULL, NULL,
81 (void *)&test_mesh_stop_01_state),
82 cmocka_unit_test_prestate_setup_teardown(test_case_mesh_close_01, NULL, NULL,
83 (void *)&test_mesh_close_01_state)
86 total_tests += sizeof(blackbox_stop_close_tests) / sizeof(blackbox_stop_close_tests[0]);
88 return cmocka_run_group_tests(blackbox_stop_close_tests, NULL, NULL);