2009-11-27 08:03:53 +00:00
|
|
|
#include "lwip_check.h"
|
|
|
|
|
|
|
|
#include "udp/test_udp.h"
|
|
|
|
#include "tcp/test_tcp.h"
|
|
|
|
#include "tcp/test_tcp_oos.h"
|
2010-01-18 17:45:41 +00:00
|
|
|
#include "core/test_mem.h"
|
2012-05-03 18:11:23 +00:00
|
|
|
#include "core/test_pbuf.h"
|
2010-03-20 11:45:25 +00:00
|
|
|
#include "etharp/test_etharp.h"
|
2012-03-22 09:52:05 +00:00
|
|
|
#include "dhcp/test_dhcp.h"
|
2016-08-14 13:02:15 +00:00
|
|
|
#include "mdns/test_mdns.h"
|
2017-03-16 20:52:30 +00:00
|
|
|
#include "api/test_sockets.h"
|
2009-11-27 08:03:53 +00:00
|
|
|
|
|
|
|
#include "lwip/init.h"
|
|
|
|
|
2015-08-05 19:15:41 +00:00
|
|
|
Suite* create_suite(const char* name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown)
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
Suite *s = suite_create(name);
|
|
|
|
|
|
|
|
for(i = 0; i < num_tests; i++) {
|
|
|
|
TCase *tc_core = tcase_create(name);
|
|
|
|
if ((setup != NULL) || (teardown != NULL)) {
|
|
|
|
tcase_add_checked_fixture(tc_core, setup, teardown);
|
|
|
|
}
|
|
|
|
tcase_add_named_test(tc_core, tests[i]);
|
|
|
|
suite_add_tcase(s, tc_core);
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
2009-11-27 08:03:53 +00:00
|
|
|
|
2015-08-05 19:15:41 +00:00
|
|
|
#ifdef LWIP_UNITTESTS_LIB
|
|
|
|
int lwip_unittests_run(void)
|
|
|
|
#else
|
|
|
|
int main(void)
|
|
|
|
#endif
|
2009-11-27 08:03:53 +00:00
|
|
|
{
|
|
|
|
int number_failed;
|
|
|
|
SRunner *sr;
|
|
|
|
size_t i;
|
|
|
|
suite_getter_fn* suites[] = {
|
|
|
|
udp_suite,
|
|
|
|
tcp_suite,
|
|
|
|
tcp_oos_suite,
|
2010-01-18 17:45:41 +00:00
|
|
|
mem_suite,
|
2012-05-03 18:11:23 +00:00
|
|
|
pbuf_suite,
|
2012-03-22 09:52:05 +00:00
|
|
|
etharp_suite,
|
2016-08-14 13:02:15 +00:00
|
|
|
dhcp_suite,
|
2017-03-16 20:52:30 +00:00
|
|
|
mdns_suite,
|
|
|
|
sockets_suite
|
2009-11-27 08:03:53 +00:00
|
|
|
};
|
|
|
|
size_t num = sizeof(suites)/sizeof(void*);
|
|
|
|
LWIP_ASSERT("No suites defined", num > 0);
|
|
|
|
|
|
|
|
lwip_init();
|
|
|
|
|
|
|
|
sr = srunner_create((suites[0])());
|
|
|
|
for(i = 1; i < num; i++) {
|
|
|
|
srunner_add_suite(sr, ((suite_getter_fn*)suites[i])());
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef LWIP_UNITTESTS_NOFORK
|
|
|
|
srunner_set_fork_status(sr, CK_NOFORK);
|
|
|
|
#endif
|
|
|
|
#ifdef LWIP_UNITTESTS_FORK
|
|
|
|
srunner_set_fork_status(sr, CK_FORK);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
srunner_run_all(sr, CK_NORMAL);
|
|
|
|
number_failed = srunner_ntests_failed(sr);
|
|
|
|
srunner_free(sr);
|
|
|
|
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
|
|
}
|