Some system C libraries do not offer SOCK_CLOEXEC flag.
Add a new header for OS compatibility wrappers. Wrap socket() calls into
wl_os_socket_cloexec() which makes sure the O_CLOEXEC flag gets set on
the file descriptor.
On systems having SOCK_CLOEXEC this uses the old socket() call, and
falls back if it fails due to the flag (kernel not supporting it).
wayland-os.h is private and not exported.
Add close-on-exec tests for both normal and forced fallback paths.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
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>
Add a new macro FAIL_TEST that can be used to define tests that are
supposed to fail. To distinguish the supposed outcome of a test, add a
field to 'struct test'.
However, simply adding a field to 'struct test' will make all tests past
the first one in an executable to be garbage. Apparently, the variables
of type 'struct test' have different alignment when put into a special
section than otherwise, and the compiler will get the skip from one
'struct test' to the next wrong.
Explicitly specify the alingment of 'struct test' to be 16 bytes, which
is what it seems to be in the special section on x86_64.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Fix a typo, add a comment, change the print format, and add a variable
that will ease implementing tests that are expected to fail.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Wrap all tests with a memory balance check to detect potential
memory leaks.
Fixed a few tests that had memory leaks contained in the tests
themselves.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
This prevents distcheck from completing.
Moving the -lffi at the end of the command fixes the problem.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>