uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lwip_unittests.c
Go to the documentation of this file.
1 #include "lwip_check.h"
2 
3 #include "udp/test_udp.h"
4 #include "tcp/test_tcp.h"
5 #include "tcp/test_tcp_oos.h"
6 #include "core/test_mem.h"
7 #include "etharp/test_etharp.h"
8 
9 #include "lwip/init.h"
10 
11 
12 int main()
13 {
14  int number_failed;
15  SRunner *sr;
16  size_t i;
17  suite_getter_fn* suites[] = {
18  udp_suite,
19  tcp_suite,
21  mem_suite,
23  };
24  size_t num = sizeof(suites)/sizeof(void*);
25  LWIP_ASSERT("No suites defined", num > 0);
26 
27  lwip_init();
28 
29  sr = srunner_create((suites[0])());
30  for(i = 1; i < num; i++) {
31  srunner_add_suite(sr, ((suite_getter_fn*)suites[i])());
32  }
33 
34 #ifdef LWIP_UNITTESTS_NOFORK
35  srunner_set_fork_status(sr, CK_NOFORK);
36 #endif
37 #ifdef LWIP_UNITTESTS_FORK
38  srunner_set_fork_status(sr, CK_FORK);
39 #endif
40 
41  srunner_run_all(sr, CK_NORMAL);
42  number_failed = srunner_ntests_failed(sr);
43  srunner_free(sr);
44  return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
45 }
46