22d651dcef
Turn Anton's memcpy / copy_tofrom_user test into something that can live in tools/testing/selftests. It requires one turd in arch/powerpc/lib/memcpy_64.S, but it's pretty harmless IMHO. We are sailing very close to the wind with the feature macros. We define them to nothing, which currently means we get a few extra nops and include the unaligned calls. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
38 lines
727 B
C
38 lines
727 B
C
/*
|
|
* 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 */
|