mirror of
https://salsa.debian.org/xorg-team/lib/pixman
synced 2026-02-03 12:13:09 +00:00
test: Fix fence-image-self-test on Mac
On MacOS X, according to the manpage of mprotect(), "When a program violates the protections of a page, it gets a SIGBUS or SIGSEGV signal.", but fence-image-self-test was only accepting a SIGSEGV as notification of invalid access. Fixes fence-image-self-test Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
7de61d8d14
commit
9728241bd0
@ -73,7 +73,7 @@ prinfo (const char *fmt, ...)
|
||||
}
|
||||
|
||||
static void
|
||||
do_expect_segv (void (*fn)(void *), void *data)
|
||||
do_expect_signal (void (*fn)(void *), void *data)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
@ -82,6 +82,8 @@ do_expect_segv (void (*fn)(void *), void *data)
|
||||
sa.sa_sigaction = segv_handler;
|
||||
if (sigaction (SIGSEGV, &sa, NULL) == -1)
|
||||
die ("sigaction failed", errno);
|
||||
if (sigaction (SIGBUS, &sa, NULL) == -1)
|
||||
die ("sigaction failed", errno);
|
||||
|
||||
(*fn)(data);
|
||||
|
||||
@ -96,7 +98,7 @@ do_expect_segv (void (*fn)(void *), void *data)
|
||||
* to exit with success, and return failure otherwise.
|
||||
*/
|
||||
static pixman_bool_t
|
||||
expect_segv (void (*fn)(void *), void *data)
|
||||
expect_signal (void (*fn)(void *), void *data)
|
||||
{
|
||||
pid_t pid, wp;
|
||||
int status;
|
||||
@ -106,7 +108,7 @@ expect_segv (void (*fn)(void *), void *data)
|
||||
die ("fork failed", errno);
|
||||
|
||||
if (pid == 0)
|
||||
do_expect_segv (fn, data); /* never returns */
|
||||
do_expect_signal (fn, data); /* never returns */
|
||||
|
||||
wp = waitpid (pid, &status, 0);
|
||||
if (wp != pid)
|
||||
@ -131,9 +133,9 @@ test_read_fault (uint8_t *p, int offset)
|
||||
{
|
||||
prinfo ("*(uint8_t *)(%p + %d)", p, offset);
|
||||
|
||||
if (expect_segv (read_u8, p + offset))
|
||||
if (expect_signal (read_u8, p + offset))
|
||||
{
|
||||
prinfo ("\tSEGV OK\n");
|
||||
prinfo ("\tsignal OK\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -471,9 +471,9 @@ fence_image_destroy (pixman_image_t *image, void *data)
|
||||
* min_width is only a minimum width for the image. The width is aligned up
|
||||
* for the row size to be divisible by both page size and pixel size.
|
||||
*
|
||||
* If stride_fence is true, the additional page on each row will be armed
|
||||
* to cause SIGSEVG on all accesses. This should catch all accesses outside
|
||||
* the valid row pixels.
|
||||
* If stride_fence is true, the additional page on each row will be
|
||||
* armed to cause SIGSEGV or SIGBUS on all accesses. This should catch
|
||||
* all accesses outside the valid row pixels.
|
||||
*/
|
||||
pixman_image_t *
|
||||
fence_image_create_bits (pixman_format_code_t format,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user