]> git.meshlink.io Git - meshlink/blob - test/blackbox/run_blackbox_tests/run_blackbox_tests.c
b2e0b61852c376d7b63b0db3a4582ee8ee08c17f
[meshlink] / test / blackbox / run_blackbox_tests / run_blackbox_tests.c
1 /*
2     run_blackbox_tests.c -- Implementation of Black Box Test Execution for meshlink
3
4     Copyright (C) 2019  Guus Sliepen <guus@meshlink.io>
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License along
17     with this program; if not, write to the Free Software Foundation, Inc.,
18     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #ifdef NDEBUG
22 #undef NDEBUG
23 #endif
24
25 #include <stdlib.h>
26 #include <stdarg.h>
27 #include <setjmp.h>
28 #include <cmocka.h>
29 #include <assert.h>
30 #include "execute_tests.h"
31 #include "test_cases.h"
32 #include "test_cases_open.h"
33 #include "test_cases_start.h"
34 #include "test_cases_stop_close.h"
35 #include "test_cases_send.h"
36 #include "test_cases_pmtu.h"
37 #include "test_cases_get_self.h"
38 #include "test_cases_get_node.h"
39 #include "test_cases_add_addr.h"
40 #include "test_cases_get_ex_addr.h"
41 #include "test_cases_add_ex_addr.h"
42 #include "test_cases_get_port.h"
43 #include "test_cases_blacklist.h"
44 #include "test_cases_default_blacklist.h"
45 #include "test_cases_whitelist.h"
46 #include "test_cases_channel_open.h"
47 #include "test_cases_channel_close.h"
48 #include "test_cases_channel_send.h"
49 #include "test_cases_channel_shutdown.h"
50
51 #include "test_cases_destroy.h"
52 #include "test_cases_get_all_nodes.h"
53 #include "test_cases_get_fingerprint.h"
54 #include "test_cases_rec_cb.h"
55 #include "test_cases_sign.h"
56 #include "test_cases_set_port.h"
57 #include "test_cases_verify.h"
58 #include "test_cases_invite.h"
59 #include "test_cases_export.h"
60 #include "test_cases_channel_ex.h"
61 #include "test_cases_channel_get_flags.h"
62 #include "test_cases_status_cb.h"
63 #include "test_cases_set_log_cb.h"
64 #include "test_cases_join.h"
65 #include "test_cases_import.h"
66 #include "test_cases_channel_set_accept_cb.h"
67 #include "test_cases_channel_set_poll_cb.h"
68 #include "test_cases_channel_set_receive_cb.h"
69 #include "test_cases_hint_address.h"
70 #include "test_optimal_pmtu.h"
71 #include "test_cases_key_rotation.h"
72
73 #include "test_cases_channel_conn.h"
74 #include "test_cases_get_all_nodes_by_dev_class.h"
75 #include "test_cases_submesh01.h"
76 #include "test_cases_submesh02.h"
77 #include "test_cases_submesh03.h"
78 #include "test_cases_submesh04.h"
79 #include "test_cases_autoconnect.h"
80 #include "test_cases_set_connection_try_cb.h"
81
82 #include "test_cases_random_port_bindings01.h"
83 #include "test_cases_random_port_bindings02.h"
84
85 #include "../common/containers.h"
86 #include "../common/common_handlers.h"
87
88 char *meshlink_root_path = NULL;
89 char *choose_arch = NULL;
90 int total_tests;
91
92 int main(int argc, char *argv[]) {
93         /* Set configuration */
94         assert(argc > 5);
95         meshlink_root_path = argv[1];
96         lxc_path = argv[2];
97         lxc_bridge = argv[3];
98         eth_if_name = argv[4];
99         choose_arch = argv[5];
100
101         int failed_tests = 0;
102
103         failed_tests += test_meta_conn();
104         failed_tests += test_meshlink_set_status_cb();
105         failed_tests += test_meshlink_join();
106         failed_tests += test_meshlink_set_channel_poll_cb();
107         failed_tests += test_meshlink_channel_open_ex();
108         failed_tests += test_meshlink_channel_get_flags();
109         failed_tests += test_meshlink_set_channel_accept_cb();
110         failed_tests += test_meshlink_destroy();
111         failed_tests += test_meshlink_export();
112         failed_tests += test_meshlink_get_fingerprint();
113         failed_tests += test_meshlink_get_all_nodes();
114         failed_tests += test_meshlink_get_all_node_by_device_class();
115         failed_tests += test_meshlink_set_port();
116         failed_tests += test_meshlink_sign();
117         failed_tests += test_meshlink_verify();
118         failed_tests += test_meshlink_import();
119         failed_tests += test_meshlink_invite();
120         failed_tests += test_meshlink_set_receive_cb();
121         failed_tests += test_meshlink_set_log_cb();
122         failed_tests += test_meshlink_set_channel_receive_cb();
123         failed_tests += test_meshlink_hint_address();
124
125         failed_tests += test_meshlink_open();
126         failed_tests += test_meshlink_start();
127         failed_tests += test_meshlink_stop_close();
128         failed_tests += test_meshlink_send();
129         failed_tests += test_meshlink_channel_send();
130         failed_tests += test_meshlink_channel_shutdown();
131         failed_tests += test_meshlink_pmtu();
132         failed_tests += test_meshlink_get_self();
133         failed_tests += test_meshlink_get_node();
134         failed_tests += test_meshlink_add_address();
135         failed_tests += test_meshlink_get_external_address();
136         failed_tests += test_meshlink_add_external_address();
137         failed_tests += test_meshlink_get_port();
138         failed_tests += test_meshlink_blacklist();
139         failed_tests += test_meshlink_whitelist();
140         failed_tests += test_meshlink_default_blacklist();
141         failed_tests += test_meshlink_channel_open();
142         failed_tests += test_meshlink_channel_close();
143
144         failed_tests += test_meshlink_channel_conn();
145         failed_tests += test_optimal_pmtu();
146
147         failed_tests += test_cases_submesh01();
148         failed_tests += test_cases_submesh02();
149         failed_tests += test_cases_submesh03();
150         failed_tests += test_cases_submesh04();
151
152         failed_tests += test_meshlink_autoconnect();
153         failed_tests += test_cases_connection_try();
154
155         failed_tests += test_optimal_pmtu();
156         failed_tests += test_meshlink_encrypted_key_rotation();
157
158         failed_tests += test_meshlink_random_port_bindings01();
159         failed_tests += test_meshlink_random_port_bindings02();
160
161         printf("[ PASSED ] %d test(s).\n", total_tests - failed_tests);
162         printf("[ FAILED ] %d test(s).\n", failed_tests);
163
164         return failed_tests;
165 }