mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
tests: support testing fd inheritance over exec
Add facility for testing how (many) file descriptors survive an exec. This allows implementing O_CLOEXEC tests. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
7c0aa1a4a3
commit
da6b1a8e47
5 changed files with 124 additions and 4 deletions
|
|
@ -93,3 +93,25 @@ FAIL_TEST(sanity_fd_leak)
|
|||
/* leak 2 file descriptors */
|
||||
pipe(fd);
|
||||
}
|
||||
|
||||
FAIL_TEST(sanity_fd_leak_exec)
|
||||
{
|
||||
int fd[2];
|
||||
int nr_fds = count_open_fds();
|
||||
|
||||
/* leak 2 file descriptors */
|
||||
pipe(fd);
|
||||
|
||||
exec_fd_leak_check(nr_fds);
|
||||
}
|
||||
|
||||
TEST(sanity_fd_exec)
|
||||
{
|
||||
int fd[2];
|
||||
int nr_fds = count_open_fds();
|
||||
|
||||
/* create 2 file descriptors, that should pass over exec */
|
||||
pipe(fd);
|
||||
|
||||
exec_fd_leak_check(nr_fds + 2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue