utils.h 684 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright 2013, Michael Ellerman, IBM Corp.
  3. * Licensed under GPLv2.
  4. */
  5. #ifndef _SELFTESTS_POWERPC_UTILS_H
  6. #define _SELFTESTS_POWERPC_UTILS_H
  7. #include <stdint.h>
  8. #include <stdbool.h>
  9. /* Avoid headaches with PRI?64 - just use %ll? always */
  10. typedef unsigned long long u64;
  11. typedef signed long long s64;
  12. /* Just for familiarity */
  13. typedef uint32_t u32;
  14. typedef uint8_t u8;
  15. int test_harness(int (test_function)(void), char *name);
  16. /* Yes, this is evil */
  17. #define FAIL_IF(x) \
  18. do { \
  19. if ((x)) { \
  20. fprintf(stderr, \
  21. "[FAIL] Test FAILED on line %d\n", __LINE__); \
  22. return 1; \
  23. } \
  24. } while (0)
  25. #endif /* _SELFTESTS_POWERPC_UTILS_H */