You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef _IPXE_TEST_H
  2. #define _IPXE_TEST_H
  3. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  4. /** @file
  5. *
  6. * Self-test infrastructure
  7. *
  8. */
  9. #include <ipxe/tables.h>
  10. /** A self-test set */
  11. struct self_test {
  12. /** Test set name */
  13. const char *name;
  14. /** Run self-tests */
  15. void ( * exec ) ( void );
  16. /** Number of tests run */
  17. unsigned int total;
  18. /** Number of test failures */
  19. unsigned int failures;
  20. /** Number of assertion failures */
  21. unsigned int assertion_failures;
  22. };
  23. /** Self-test table */
  24. #define SELF_TESTS __table ( struct self_test, "self_tests" )
  25. /** Declare a self-test */
  26. #define __self_test __table_entry ( SELF_TESTS, 01 )
  27. extern void test_ok ( int success, const char *file, unsigned int line,
  28. const char *test );
  29. /**
  30. * Report test result
  31. *
  32. * @v success Test succeeded
  33. * @v file File name
  34. * @v line Line number
  35. */
  36. #define okx( success, file, line ) \
  37. test_ok ( success, file, line, #success )
  38. #define ok( success ) \
  39. okx ( success, __FILE__, __LINE__ )
  40. #endif /* _IPXE_TEST_H */