test_runner.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef TEST_RUNNER_H
  2. #define TEST_RUNNER_H
  3. #include "lfs.h"
  4. // generated test configurations
  5. enum test_type {
  6. TEST_NORMAL = 0x1,
  7. TEST_REENTRANT = 0x2,
  8. TEST_VALGRIND = 0x4,
  9. };
  10. struct test_case {
  11. const char *id;
  12. const char *name;
  13. const char *path;
  14. uint8_t types;
  15. size_t permutations;
  16. const uintmax_t *const *defines;
  17. const bool *define_mask;
  18. bool (*filter)(struct lfs_config *cfg, uint32_t perm);
  19. void (*run)(struct lfs_config *cfg, uint32_t perm);
  20. };
  21. struct test_suite {
  22. const char *id;
  23. const char *name;
  24. const char *path;
  25. const char *const *define_names;
  26. size_t define_count;
  27. const struct test_case *const *cases;
  28. size_t case_count;
  29. };
  30. // TODO remove this indirection
  31. extern const struct test_suite *test_suites[];
  32. extern const size_t test_suite_count;
  33. // access generated test defines
  34. uintmax_t test_define(size_t define);
  35. // a few preconfigured defines that control how tests run
  36. #define READ_SIZE test_define(0)
  37. #define PROG_SIZE test_define(1)
  38. #define BLOCK_SIZE test_define(2)
  39. #define BLOCK_COUNT test_define(3)
  40. #define BLOCK_CYCLES test_define(4)
  41. #define CACHE_SIZE test_define(5)
  42. #define LOOKAHEAD_SIZE test_define(6)
  43. #define ERASE_VALUE test_define(7)
  44. #define ERASE_CYCLES test_define(8)
  45. #define BADBLOCK_BEHAVIOR test_define(9)
  46. #endif