[PATCH] kselftest/filelock: plan for the five ofdlocks tests

From: Danish Khateeb

Date: Fri Sep 25 2026 - 17:02:01 EST


ofdlocks reports five results but plans for four, so even when they
all pass it ends with

# Planned tests != run tests (4 != 5)

and exits with KSFT_FAIL, which run_kselftest.sh reports as a failure.

Fixes: 33d5b13098fb ("kselftest/filelock: report each test in oftlocks separately")
Assisted-by: LLM
Signed-off-by: Danish Khateeb <danishkhateeb03@xxxxxxxxx>
---

Notes:
Tested on x86_64 with the kselftest build of ofdlocks:

- Arch host (gcc 16.2, 7.2.6 kernel): before, all 5 pass but it exits 1
with "Planned tests != run tests (4 != 5)"; after, 5/5 and exit 0.
- Debian trixie guest (gcc 14.2, next-20260925): test 4 fails before and
after this patch, because it memcmp()s two struct flock whose padding
was never initialized (bytes 28-29 differ). Zhou Yuhang's "selftests:
filelock: Initialize the flock to zero" [1] fixes that, and with both
patches all 5 pass there too.

[1] https://lore.kernel.org/all/?q=s%3A%22filelock%3A+Initialize+the+flock+to+zero%22

tools/testing/selftests/filelock/ofdlocks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/filelock/ofdlocks.c b/tools/testing/selftests/filelock/ofdlocks.c
index 68bac28b234b..0ab484cb075b 100644
--- a/tools/testing/selftests/filelock/ofdlocks.c
+++ b/tools/testing/selftests/filelock/ofdlocks.c
@@ -40,7 +40,7 @@ int main(void)
int fd2 = open("/tmp/aa", O_RDONLY);

ksft_print_header();
- ksft_set_plan(4);
+ ksft_set_plan(5);

unlink("/tmp/aa");
assert(fd != -1);

base-commit: aa98230e410f0ed212b6788c46b1e4d49e0ff7ca
--
2.55.0