Commit Graph

5 Commits

Author SHA1 Message Date
Guillem Jover
dd0bdb58e0 test: Close all descriptors before initializing them for closefrom()
On macOS, closefrom() only sets the close-on-exec flag, so we cannot
check whether all file descriptors were closed, which means that if
on entry our file descriptor table was filled after the 4th file
descriptor, then we might fail the assertions for the flags for odd
file descriptors which we expect to be closed.

This can easily happen when running the test suite in parallel mode
with «make -j8 check» for example.

Closes: #23
2024-01-08 01:58:54 +01:00
Guillem Jover
ed2eb31da9 test: Fix closefrom() test on macOS
On macOS we do not close the file descriptors, and instead mark them all
as close-on-exec. So checking whether they are not valid does not work.
2023-04-17 04:12:42 +02:00
Guillem Jover
0f8bcdfd92 test: Fix closefrom() test to handle open file descriptor limits
If the system has configured a lower limit (either soft or hard) on the
number of open file descriptors, the test will fail. Make sure to check
whether we have exceeded that limit and adapt the max number of file
descriptors appropriately.
2023-04-17 04:12:42 +02:00
Guillem Jover
3c305f2873 test: Add proper prototypes for main() function
Warned-by: gcc
2021-02-28 05:30:31 +01:00
Guillem Jover
3a3d87d730 test: Add closefrom() unit test 2015-09-23 07:59:34 +02:00