Skip to content

Raise the file descriptor limit for descriptor-heavy tests - #3060

Merged
madeye merged 1 commit into
masterfrom
madeye/cmake-build-test-error-on-macos
Sep 12, 2026
Merged

Raise the file descriptor limit for descriptor-heavy tests#3060
madeye merged 1 commit into
masterfrom
madeye/cmake-build-test-error-on-macos

Conversation

@madeye

@madeye madeye commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • test_event opens 256 UDP receivers plus a sender, and macOS starts processes with a soft RLIMIT_NOFILE of 256, so socket() eventually failed and the unchecked descriptor tripped the bind() assertion (cmake build test error on macOS #3058).
  • Wrap every registered CTest unit test (and memcheck variant) in a sh -c 'ulimit -n 1024 2>/dev/null; exec ...' launcher on non-Windows so the harness raises the soft limit before running each test. A failed ulimit is ignored so tests still run on hosts with a lower hard limit.
  • Add test_raise_fd_limit() to test_helpers.h and call it from test_event so the binary also passes when run directly outside CTest.
  • Assert on socket() failures so a descriptor-limit problem is reported as such rather than as a bind() error.

Test plan

  • ulimit -n 256; ctest --test-dir build -L 'unit|vendor' on macOS arm64: 33/33 pass (previously test_event aborted).
  • With the in-process helper temporarily disabled, ./build/bin/test_event still aborts under 256 fds while ctest -R test_event passes, confirming the launcher works on its own.
  • Full unit|vendor suite passes with the default fd limit.

Fixes #3058

https://claude.ai/code/session_01PSG4XV3jiqitDgdgFSGATx

test_event opens 256 UDP receivers plus a sender on top of the loop's own
descriptors. macOS starts processes with a soft RLIMIT_NOFILE of 256, so
socket() eventually returned -1 and the unchecked descriptor tripped the
bind() assertion when running ctest from a stock terminal (#3058).

Wrap every registered unit test in a small sh launcher that raises the soft
limit to 1024 before exec'ing the binary, and have test_event raise its own
limit as well so it also passes when run directly. Assert on socket()
failures so a limit problem is reported as such instead of as a bind error.

Fixes #3058

Claude-Session: https://claude.ai/code/session_01PSG4XV3jiqitDgdgFSGATx
@madeye
madeye merged commit 7bcb3d7 into master Sep 12, 2026
27 checks passed
@madeye
madeye deleted the madeye/cmake-build-test-error-on-macos branch September 12, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmake build test error on macOS

1 participant