mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
tests/wayland: Don't test file sealing on the fallback case
When memfd_create isn't used, the file isn't sealed. Therefore, we should skip test_readonly_seals on the fallback case. This fixes compilation error on FreeBSD 12, which does not support memfd_create.
This commit is contained in:
parent
819eeeb591
commit
5d897a9b86
@ -27,7 +27,9 @@
|
|||||||
|
|
||||||
#include "wayland-test-client-utils.h"
|
#include "wayland-test-client-utils.h"
|
||||||
|
|
||||||
|
#if defined(HAVE_MEMFD_CREATE)
|
||||||
#define READONLY_SEALS (F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_WRITE)
|
#define READONLY_SEALS (F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_WRITE)
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *teststring = "test string 1234567890";
|
static const char *teststring = "test string 1234567890";
|
||||||
|
|
||||||
@ -67,6 +69,7 @@ test_write_fd (int fd,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HAVE_MEMFD_CREATE)
|
||||||
static int
|
static int
|
||||||
test_readonly_seals (int fd)
|
test_readonly_seals (int fd)
|
||||||
{
|
{
|
||||||
@ -81,6 +84,7 @@ test_readonly_seals (int fd)
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
test_write_read (int fd)
|
test_write_read (int fd)
|
||||||
@ -224,9 +228,6 @@ main (int argc,
|
|||||||
other_fd = meta_anonymous_file_open_fd (file, META_ANONYMOUS_FILE_MAPMODE_PRIVATE);
|
other_fd = meta_anonymous_file_open_fd (file, META_ANONYMOUS_FILE_MAPMODE_PRIVATE);
|
||||||
g_assert (other_fd != -1);
|
g_assert (other_fd != -1);
|
||||||
|
|
||||||
if (test_readonly_seals (fd))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
/* Writing and reading the written data should succeed */
|
/* Writing and reading the written data should succeed */
|
||||||
if (!test_write_read (fd))
|
if (!test_write_read (fd))
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -244,9 +245,6 @@ main (int argc,
|
|||||||
other_fd = meta_anonymous_file_open_fd (file, META_ANONYMOUS_FILE_MAPMODE_SHARED);
|
other_fd = meta_anonymous_file_open_fd (file, META_ANONYMOUS_FILE_MAPMODE_SHARED);
|
||||||
g_assert (other_fd != -1);
|
g_assert (other_fd != -1);
|
||||||
|
|
||||||
if (test_readonly_seals (fd))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
if (!test_read_fd_mmap (fd, teststring))
|
if (!test_read_fd_mmap (fd, teststring))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user