lwip_unittests.c 925 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "lwip_check.h"
  2. #include "udp/test_udp.h"
  3. #include "tcp/test_tcp.h"
  4. #include "tcp/test_tcp_oos.h"
  5. #include "core/test_mem.h"
  6. #include "etharp/test_etharp.h"
  7. #include "lwip/init.h"
  8. int main()
  9. {
  10. int number_failed;
  11. SRunner *sr;
  12. size_t i;
  13. suite_getter_fn* suites[] = {
  14. udp_suite,
  15. tcp_suite,
  16. tcp_oos_suite,
  17. mem_suite,
  18. etharp_suite
  19. };
  20. size_t num = sizeof(suites)/sizeof(void*);
  21. LWIP_ASSERT("No suites defined", num > 0);
  22. lwip_init();
  23. sr = srunner_create((suites[0])());
  24. for(i = 1; i < num; i++) {
  25. srunner_add_suite(sr, ((suite_getter_fn*)suites[i])());
  26. }
  27. #ifdef LWIP_UNITTESTS_NOFORK
  28. srunner_set_fork_status(sr, CK_NOFORK);
  29. #endif
  30. #ifdef LWIP_UNITTESTS_FORK
  31. srunner_set_fork_status(sr, CK_FORK);
  32. #endif
  33. srunner_run_all(sr, CK_NORMAL);
  34. number_failed = srunner_ntests_failed(sr);
  35. srunner_free(sr);
  36. return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
  37. }