ReactOS  0.4.14-dev-49-gfb4591c
signal.c File Reference
#include "wine/test.h"
#include <winbase.h>
#include <signal.h>
Include dependency graph for signal.c:

Go to the source code of this file.

Functions

static void __cdecl sighandler (int signum)
 
static void test_signal (void)
 
static void test___pxcptinfoptrs (void)
 
 START_TEST (signal)
 

Variables

static int test_value = 0
 

Function Documentation

◆ sighandler()

static void __cdecl sighandler ( int  signum)
static

Definition at line 27 of file signal.c.

28 {
29  void **ret = __pxcptinfoptrs();
30 
31  ok(ret != NULL, "ret = NULL\n");
32  if(signum == SIGABRT)
33  ok(*ret == (void*)0xdeadbeef, "*ret = %p\n", *ret);
34  else if(signum == SIGSEGV)
35  ok(*ret == NULL, "*ret = %p\n", *ret);
36  ++test_value;
37 }
static int test_value
Definition: signal.c:25
#define SIGABRT
Definition: signal.h:28
smooth NULL
Definition: ftsmooth.c:416
int ret
#define SIGSEGV
Definition: signal.h:33
void **__cdecl __pxcptinfoptrs(void)
Definition: xcptinfo.c:6
#define ok(value,...)
Definition: atltest.h:57

Referenced by test___pxcptinfoptrs(), and test_signal().

◆ START_TEST()

START_TEST ( signal  )

Definition at line 76 of file signal.c.

77 {
78  test_signal();
80 }
static void test___pxcptinfoptrs(void)
Definition: signal.c:52
static void test_signal(void)
Definition: signal.c:39

◆ test___pxcptinfoptrs()

static void test___pxcptinfoptrs ( void  )
static

Definition at line 52 of file signal.c.

53 {
54  void **ret = __pxcptinfoptrs();
55  int res;
56 
57  ok(ret != NULL, "ret == NULL\n");
58  ok(*ret == NULL, "*ret != NULL\n");
59 
60  test_value = 0;
61 
62  *ret = (void*)0xdeadbeef;
64  res = raise(SIGSEGV);
65  ok(res == 0, "failed to raise SIGSEGV\n");
66  ok(*ret == (void*)0xdeadbeef, "*ret = %p\n", *ret);
67 
69  res = raise(SIGABRT);
70  ok(res == 0, "failed to raise SIGBREAK\n");
71  ok(*ret == (void*)0xdeadbeef, "*ret = %p\n", *ret);
72 
73  ok(test_value == 2, "test_value = %d\n", test_value);
74 }
static int test_value
Definition: signal.c:25
#define SIGABRT
Definition: signal.h:28
static void __cdecl sighandler(int signum)
Definition: signal.c:27
smooth NULL
Definition: ftsmooth.c:416
int ret
#define SIGSEGV
Definition: signal.h:33
void **__cdecl __pxcptinfoptrs(void)
Definition: xcptinfo.c:6
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
__p_sig_fn_t signal(int sig, __p_sig_fn_t func)
Definition: signal.c:23

Referenced by START_TEST().

◆ test_signal()

static void test_signal ( void  )
static

Definition at line 39 of file signal.c.

40 {
41  void (__cdecl *old)(int);
42  int res;
43 
44  old = signal(SIGBREAK, sighandler);
45  ok(old != SIG_ERR, "Failed to install signal handler for SIGBREAK\n");
46  test_value = 0;
47  res = raise(SIGBREAK);
48  ok(res == 0, "Failed to raise SIGBREAK\n");
49  ok(test_value == 1, "SIGBREAK handler not invoked\n");
50 }
static int test_value
Definition: signal.c:25
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define __cdecl
Definition: accygwin.h:79
#define SIGBREAK
Definition: signal.h:40
static void __cdecl sighandler(int signum)
Definition: signal.c:27
#define SIG_ERR
Definition: signal.h:52
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
__p_sig_fn_t signal(int sig, __p_sig_fn_t func)
Definition: signal.c:23
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by START_TEST().

Variable Documentation

◆ test_value

int test_value = 0
static

Definition at line 25 of file signal.c.

Referenced by main(), sighandler(), test___pxcptinfoptrs(), and test_signal().