Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os by
lwip_unittests.c
00001 #include "lwip_check.h" 00002 00003 #include "udp/test_udp.h" 00004 #include "tcp/test_tcp.h" 00005 #include "tcp/test_tcp_oos.h" 00006 #include "core/test_mem.h" 00007 #include "core/test_pbuf.h" 00008 #include "etharp/test_etharp.h" 00009 #include "dhcp/test_dhcp.h" 00010 00011 #include "lwip/init.h" 00012 00013 Suite* create_suite(const char* name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown) 00014 { 00015 size_t i; 00016 Suite *s = suite_create(name); 00017 00018 for(i = 0; i < num_tests; i++) { 00019 TCase *tc_core = tcase_create(name); 00020 if ((setup != NULL) || (teardown != NULL)) { 00021 tcase_add_checked_fixture(tc_core, setup, teardown); 00022 } 00023 tcase_add_named_test(tc_core, tests[i]); 00024 suite_add_tcase(s, tc_core); 00025 } 00026 return s; 00027 } 00028 00029 #ifdef LWIP_UNITTESTS_LIB 00030 int lwip_unittests_run(void) 00031 #else 00032 int main(void) 00033 #endif 00034 { 00035 int number_failed; 00036 SRunner *sr; 00037 size_t i; 00038 suite_getter_fn* suites[] = { 00039 udp_suite, 00040 tcp_suite, 00041 tcp_oos_suite, 00042 mem_suite, 00043 pbuf_suite, 00044 etharp_suite, 00045 dhcp_suite 00046 }; 00047 size_t num = sizeof(suites)/sizeof(void*); 00048 LWIP_ASSERT("No suites defined", num > 0); 00049 00050 lwip_init(); 00051 00052 sr = srunner_create((suites[0])()); 00053 for(i = 1; i < num; i++) { 00054 srunner_add_suite(sr, ((suite_getter_fn*)suites[i])()); 00055 } 00056 00057 #ifdef LWIP_UNITTESTS_NOFORK 00058 srunner_set_fork_status(sr, CK_NOFORK); 00059 #endif 00060 #ifdef LWIP_UNITTESTS_FORK 00061 srunner_set_fork_status(sr, CK_FORK); 00062 #endif 00063 00064 srunner_run_all(sr, CK_NORMAL); 00065 number_failed = srunner_ntests_failed(sr); 00066 srunner_free(sr); 00067 return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; 00068 }
Generated on Tue Jul 12 2022 13:15:55 by
