6 #define TEST(c, ...) ((c) ? 1 : (t_error(#c" failed: " __VA_ARGS__),0))
10 volatile int x
= 0, r
;
13 volatile sigset_t oldset
;
20 TEST(x
==1, "setjmp/longjmp seems to have been bypassed\n");
28 TEST(r
==1, "longjmp(jb, 0) caused setjmp to return %d\n", r
);
31 sigaddset(&set
, SIGUSR1
);
32 sigprocmask(SIG_UNBLOCK
, &set
, &set2
);
35 /* Improve the chances of catching failure of sigsetjmp to
36 * properly save the signal mask in the sigjmb_buf. */
37 memset(&sjb
, -1, sizeof sjb
);
39 if (!sigsetjmp(sjb
, 1)) {
41 sigaddset(&set
, SIGUSR1
);
42 sigprocmask(SIG_BLOCK
, &set
, 0);
46 sigprocmask(SIG_SETMASK
, &set
, &set2
);
47 TEST(sigismember(&set2
, SIGUSR1
)==0, "siglongjmp failed to restore mask\n");
50 sigaddset(&set
, SIGUSR1
);
51 sigprocmask(SIG_UNBLOCK
, &set
, &set2
);
54 if (!sigsetjmp(sjb
, 0)) {
56 sigaddset(&set
, SIGUSR1
);
57 sigprocmask(SIG_BLOCK
, &set
, 0);
61 sigprocmask(SIG_SETMASK
, &set
, &set2
);
62 TEST(sigismember(&set2
, SIGUSR1
)==1, "siglongjmp incorrectly restored mask\n");