perf test: In forked mode add check that fds aren't leaked
authorIan Rogers <irogers@google.com>
Tue, 24 Jun 2025 19:03:25 +0000 (12:03 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 3 Jul 2025 02:11:13 +0000 (19:11 -0700)
commite9846f5ead26d2ed2eea0987e3991a667fc38d22
tree705aa9dd2b83a6638ca5e6cd7be41a60e44ad3db
parente793e2c0f188fb7a7998224f14241c0d87df5249
perf test: In forked mode add check that fds aren't leaked

When a test is forked no file descriptors should be open, however,
parent ones may have been inherited - in particular those of the pipes
of other forked child test processes. Add a loop to clean-up/close
those file descriptors prior to running the test. At the end of the
test assert that no additional file descriptors are present as this
would indicate a file descriptor leak.

Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250624190326.2038704-6-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/tests/builtin-test.c