summaryrefslogtreecommitdiff
path: root/stdlib/tst-ucontext-off.c
blob: 2e97f21aba69d591a19b06a6c7905acbb235a5f3 (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
#include <stddef.h>
#include <stdio.h>
#include <sys/ucontext.h>

#include <ucontext_i.h>

static int
do_test  (void)
{
  int nerrors = 0;
  int ntests = 0;

#define TEST(member, val) \
  do {									\
    if (offsetof (struct ucontext, member) != val)			\
      {									\
	printf ("offsetof(%s) = %zu, %s = %zu\n",			\
		#member, offsetof (struct ucontext, member),		\
		#val, (size_t) val);					\
	++nerrors;							\
      }									\
    ++ntests;								\
  } while (0)

#ifdef TESTS
  TESTS
#endif

  printf ("%d errors in %d tests\n", nerrors, ntests);

  return nerrors != 0;
}

#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"