]> git.meshlink.io Git - meshlink/blob - test/blackbox/run_blackbox_tests/run_blackbox_tests.c
29c662bb3a3f0f934e1a573b2477513d3878967b
[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) 2018  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 #include <stdlib.h>
21 #include <stdarg.h>
22 #include <setjmp.h>
23 #include <cmocka.h>
24 #include <assert.h>
25 #include "execute_tests.h"
26 #include "test_cases.h"
27 #include "test_cases_open.h"
28 #include "test_cases_start.h"
29 #include "test_cases_stop_close.h"
30 #include "test_cases_send.h"
31 #include "test_cases_pmtu.h"
32 #include "test_cases_get_self.h"
33 #include "test_cases_get_node.h"
34 #include "test_cases_add_addr.h"
35 #include "test_cases_get_ex_addr.h"
36 #include "test_cases_add_ex_addr.h"
37 #include "test_cases_get_port.h"
38 #include "test_cases_blacklist.h"
39 #include "test_cases_default_blacklist.h"
40 #include "test_cases_whitelist.h"
41 #include "test_cases_channel_open.h"
42 #include "test_cases_channel_close.h"
43 #include "test_cases_channel_send.h"
44 #include "test_cases_channel_shutdown.h"
45
46 #include "test_cases_destroy.h"
47 #include "test_cases_get_all_nodes.h"
48 #include "test_cases_get_fingerprint.h"
49 #include "test_cases_rec_cb.h"
50 #include "test_cases_sign.h"
51 #include "test_cases_set_port.h"
52 #include "test_cases_verify.h"
53 #include "test_cases_invite.h"
54 #include "test_cases_export.h"
55 #include "test_cases_channel_ex.h"
56 #include "test_cases_channel_get_flags.h"
57 #include "test_cases_status_cb.h"
58 #include "test_cases_set_log_cb.h"
59 #include "test_cases_join.h"
60 #include "test_cases_import.h"
61 #include "test_cases_channel_set_accept_cb.h"
62 #include "test_cases_channel_set_poll_cb.h"
63 #include "test_cases_channel_set_receive_cb.h"
64 #include "test_cases_hint_address.h"
65 #include "test_optimal_pmtu.h"
66
67 #include "test_cases_channel_conn.h"
68 #include "test_cases_get_all_nodes_by_dev_class.h"
69 #include "test_cases_submesh01.h"
70 #include "test_cases_submesh02.h"
71 #include "test_cases_submesh03.h"
72 #include "test_cases_submesh04.h"
73
74 #include "test_cases_autoconnect.h"
75
76 #include "../common/containers.h"
77 #include "../common/common_handlers.h"
78
79 char *meshlink_root_path = NULL;
80 char *choose_arch = NULL;
81 int total_tests;
82
83 int main(int argc, char *argv[]) {
84         /* Set configuration */
85         assert(argc > 5);
86         meshlink_root_path = argv[1];
87         lxc_path = argv[2];
88         lxc_bridge = argv[3];
89         eth_if_name = argv[4];
90         choose_arch = argv[5];
91
92         int failed_tests = 0;
93
94         /*
95         failed_tests += test_meta_conn();
96         failed_tests += test_meshlink_set_status_cb();
97         failed_tests += test_meshlink_join();
98         failed_tests += test_meshlink_set_channel_poll_cb();
99         failed_tests += test_meshlink_channel_open_ex();
100         failed_tests += test_meshlink_channel_get_flags();
101         failed_tests += test_meshlink_set_channel_accept_cb();
102         failed_tests += test_meshlink_destroy();
103         failed_tests += test_meshlink_export();
104         failed_tests += test_meshlink_get_fingerprint();
105         failed_tests += test_meshlink_get_all_nodes();
106         failed_tests += test_meshlink_get_all_node_by_device_class();
107         failed_tests += test_meshlink_set_port();
108         failed_tests += test_meshlink_sign();
109         failed_tests += test_meshlink_verify();
110         failed_tests += test_meshlink_import();
111         failed_tests += test_meshlink_invite();
112         failed_tests += test_meshlink_set_receive_cb();
113         failed_tests += test_meshlink_set_log_cb();
114         failed_tests += test_meshlink_set_channel_receive_cb();
115         failed_tests += test_meshlink_hint_address();
116
117         failed_tests += test_meshlink_open();
118         failed_tests += test_meshlink_start();
119         failed_tests += test_meshlink_stop_close();
120         failed_tests += test_meshlink_send();
121         failed_tests += test_meshlink_channel_send();
122         failed_tests += test_meshlink_channel_shutdown();
123         failed_tests += test_meshlink_pmtu();
124         failed_tests += test_meshlink_get_self();
125         failed_tests += test_meshlink_get_node();
126         failed_tests += test_meshlink_add_address();
127         failed_tests += test_meshlink_get_external_address();
128         failed_tests += test_meshlink_add_external_address();
129         failed_tests += test_meshlink_get_port();
130         failed_tests += test_meshlink_blacklist();
131         failed_tests += test_meshlink_whitelist();
132         failed_tests += test_meshlink_default_blacklist();
133         failed_tests += test_meshlink_channel_open();
134         failed_tests += test_meshlink_channel_close();
135
136         failed_tests += test_meshlink_channel_conn();
137         */
138         failed_tests += test_optimal_pmtu();
139
140         failed_tests += test_cases_submesh01();
141         failed_tests += test_cases_submesh02();
142         failed_tests += test_cases_submesh03();
143         failed_tests += test_cases_submesh04();
144
145         failed_tests += test_meshlink_autoconnect();
146
147         failed_tests += test_optimal_pmtu();
148
149         printf("[ PASSED ] %d test(s).\n", total_tests - failed_tests);
150         printf("[ FAILED ] %d test(s).\n", failed_tests);
151
152         return failed_tests;
153 }