1 #include <assert.h>
2 #include <errno.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <sys/syscall.h>
6 
7 #define GO(syscall_num, param) \
8    fprintf(stderr, "---------------------------------------------------------\n"  \
9                    "%3d:%24s %s\n"                                                \
10                    "---------------------------------------------------------\n", \
11                    syscall_num, #syscall_num, param);
12 
13 #define SY res = syscall
14 
15 #define FAIL assert(res == -1);
16 #define SUCC assert(res != -1);
17 #define FAILx(E) \
18    do { \
19       int myerrno = errno; \
20       if (res == -1) { \
21          if (myerrno == E) { \
22             /* as expected */ \
23          } \
24          else { \
25             fprintf(stderr, "Expected error %s (%d), got %d\n", #E, E, myerrno); \
26             exit(1); \
27          } \
28       } \
29       else { \
30          fprintf(stderr, "Expected error %s (%d), got success\n", #E, E); \
31          exit(1); \
32       } \
33    } while (0);
34 
35 /* Module variables. */
36 static long x0;
37 static long res;
38 
39