FreeBSD: add file descriptor tracking for _umtx_op
[valgrind.git] / none / tests / s390x / test.h
blob65136c3155115a5ce22f6fc580c4f8b14949fbf7
1 #ifndef TEST_H
2 #define TEST_H
4 #include <stdio.h>
5 #include <sys/time.h>
6 #include "svc.h"
8 /* Convenience macros and functions for testcases */
10 #define EXIT(ret) svc1(__NR_exit, ret)
12 /* X must be a string constant */
13 #define SAY(x) say(x"\n", sizeof x)
15 /* Test COND and if it happens to be true, say so */
16 #define TEST(cond) do { if (cond) SAY(#cond); } while (0)
18 #define BRASLCLOBBER "0","1","2","3","4","5","14", \
19 "f0","f1","f2","f3","f4","f5","f6","f7"
21 int say(const char *text, unsigned long num_chars)
23 return svc3(4, 1, (unsigned long) text, num_chars);
26 #define get_cc() \
27 ({ \
28 char __cc; \
29 /* dont use IPM to better test spechelpers */ \
30 asm volatile( " brc 8,1f\n\t" \
31 " brc 4,2f\n\t" \
32 " brc 2,3f\n\t" \
33 " brc 1,4f\n\t" \
34 " mvi %0,4\n\t" \
35 " j 0f\n\t" \
36 "1: mvi %0,0\n\t" \
37 " j 0f\n\t" \
38 "2: mvi %0,1\n\t" \
39 " j 0f\n\t" \
40 "3: mvi %0,2\n\t" \
41 " j 0f\n\t" \
42 "4: mvi %0,3\n\t" \
43 " j 0f\n\t" \
44 "0: bcr 0,0 /*nop*/\n\t" \
45 :"=Q" (__cc)::"memory"); \
46 __cc; \
49 static inline void dump_field(void *field, int size)
51 int i;
52 for (i=0; i < size; i++)
53 printf("%2.2X ", ((char *) field)[i]);
56 static inline void mysleep(long sec, long usec)
58 struct timeval tv;
60 tv.tv_sec = sec;
61 tv.tv_usec = usec;
63 svc5(SYS_select, 0,0,0,0,(unsigned long) &tv);
66 #endif /* TEST_H */