aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-helpers.c
Commit message (Collapse)AuthorAgeFilesLines
* build: fix build and provide compat for OpenBSDSébastien Marie2024-02-211-0/+27
| | | | | | | | | | - wayland-egl-abi-check: try to use llvm-nm first instead of BSD nm (incompatible options) - avoid forcing _POSIX_C_SOURCE=200809L (SOCK_CLOEXEC become available) - epoll(7) is provided by a userspace wrapper around kqueue(2) as FreeBSD - when using SO_PEERCRED, the struct to use is `struct sockpeercred` instead of `struct ucred` on OpenBSD - provide a compatibility layer for count_open_fds() using sysctl(2) as FreeBSD Signed-off-by: Sebastien Marie <semarie@online.fr>
* test-helpers: use sysctl() to count open fds on FreeBSDAlex Richardson2021-09-101-0/+22
| | | | | | | | This allows running the tests on FreeBSD without mounting fdescfs. Previously you had to run `mount -t fdescfs -o linrdlnk null /dev/fd` to get file descriptors >=3 listed in /dev/fd. Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
* Use /dev/fd instead of /proc/self/fdAlex Richardson2021-09-101-3/+7
| | | | | | | /dev/fd exists on all operating systems I can test (Linux, FreeBSD, macOS), whereas /proc/self/fd only appears to exist on Linux. Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
* Support running tests from different build directoriesEmmanuele Bassi2020-01-101-2/+11
| | | | | | | | | | | | | The tests that run exec-fd-leak-checker expect the binary to be located in the current directory. This is not always the case; for instance, the binaries could be built under `tests`, but be invoked under the top-level build directory. We can use an environment variable to control what's the location of the test binaries, and fall back to the current directory if the variable is unset. Reviewed-by: Daniel Stone <daniels@collabora.com>
* tests: disable coredumps on sanity-testPekka Paalanen2018-03-151-0/+30
| | | | | | | | | | | | SEGV and ABRT by default cause a core dump, which may create a file, launch crash handlers, and so on. sanity-test has 21 processes that are expected to crash like this. Disable core dumps on them all. I counted 21 entries in coredumpctl list, while only 16 functions needed patching. After this patch no entries appear in coredumpctl list. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Daniel Stone <daniels@collabora.com>
* tests: Update boilerplate from MIT X11 license to MIT Expat licenseBryce Harrington2015-06-121-16/+19
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* tests: add test_usleep and test_sleep functionsMarek Chalupa2014-11-171-0/+32
| | | | | | | | | The former one was already used in tests, but was private. These functions can be shared across the tests, so make them public. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* tests: support testing fd inheritance over execPekka Paalanen2012-04-201-0/+12
| | | | | | | 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>
* tests: detect fd leaksPekka Paalanen2012-04-201-0/+52
Detect file descriptor leaks in tests. Add a sanity test to verify that we catch the leaks. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>