From 2aa7bcf37f00b7884ae166d62db81493ea37934a Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 18 Aug 2010 09:35:37 +0000 Subject: libxext libx11 libxcb libXinerama libXau pixman xserver git update 18/10/2010 --- pixman/test/utils.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'pixman/test/utils.c') diff --git a/pixman/test/utils.c b/pixman/test/utils.c index 4b68debff..f5199268b 100644 --- a/pixman/test/utils.c +++ b/pixman/test/utils.c @@ -1,4 +1,9 @@ #include "utils.h" +#include + +#ifdef HAVE_UNISTD_H +#include +#endif /* Random number seed */ @@ -319,3 +324,31 @@ fuzzer_test_main (const char *test_name, return 0; } + +static const char *global_msg; + +static void +on_alarm (int signo) +{ + printf ("%s\n", global_msg); + exit (1); +} + +void +fail_after (int seconds, const char *msg) +{ +#ifdef HAVE_SIGACTION +#ifdef HAVE_ALARM + struct sigaction action; + + global_msg = msg; + + memset (&action, 0, sizeof (action)); + action.sa_handler = on_alarm; + + alarm (seconds); + + sigaction (SIGALRM, &action, NULL); +#endif +#endif +} -- cgit v1.2.3