diff options
Diffstat (limited to 'tools/testing/selftests/powerpc/utils.h')
-rw-r--r-- | tools/testing/selftests/powerpc/utils.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/utils.h b/tools/testing/selftests/powerpc/utils.h new file mode 100644 index 000000000000..5851c4b0f553 --- /dev/null +++ b/tools/testing/selftests/powerpc/utils.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright 2013, Michael Ellerman, IBM Corp. | ||
3 | * Licensed under GPLv2. | ||
4 | */ | ||
5 | |||
6 | #ifndef _SELFTESTS_POWERPC_UTILS_H | ||
7 | #define _SELFTESTS_POWERPC_UTILS_H | ||
8 | |||
9 | #include <stdint.h> | ||
10 | #include <stdbool.h> | ||
11 | |||
12 | /* Avoid headaches with PRI?64 - just use %ll? always */ | ||
13 | typedef unsigned long long u64; | ||
14 | typedef signed long long s64; | ||
15 | |||
16 | /* Just for familiarity */ | ||
17 | typedef uint32_t u32; | ||
18 | typedef uint8_t u8; | ||
19 | |||
20 | |||
21 | int test_harness(int (test_function)(void), char *name); | ||
22 | |||
23 | |||
24 | /* Yes, this is evil */ | ||
25 | #define FAIL_IF(x) \ | ||
26 | do { \ | ||
27 | if ((x)) { \ | ||
28 | fprintf(stderr, \ | ||
29 | "[FAIL] Test FAILED on line %d\n", __LINE__); \ | ||
30 | return 1; \ | ||
31 | } \ | ||
32 | } while (0) | ||
33 | |||
34 | #endif /* _SELFTESTS_POWERPC_UTILS_H */ | ||