summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/powerpc/utils.h
blob: 0de064406dabf5d7589f9cc094f133e12b1798a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright 2013, Michael Ellerman, IBM Corp.
 * Licensed under GPLv2.
 */

#ifndef _SELFTESTS_POWERPC_UTILS_H
#define _SELFTESTS_POWERPC_UTILS_H

#include <stdint.h>
#include <stdbool.h>

/* Avoid headaches with PRI?64 - just use %ll? always */
typedef unsigned long long u64;
typedef   signed long long s64;

/* Just for familiarity */
typedef uint32_t u32;
typedef uint8_t u8;


int test_harness(int (test_function)(void), char *name);


/* Yes, this is evil */
#define FAIL_IF(x)						\
do {								\
	if ((x)) {						\
		fprintf(stderr,					\
		"[FAIL] Test FAILED on line %d\n", __LINE__);	\
		return 1;					\
	}							\
} while (0)

#define _str(s) #s
#define str(s) _str(s)

#endif /* _SELFTESTS_POWERPC_UTILS_H */
OpenPOWER on IntegriCloud