[LTP] [PATCH] pty03: Calculate test case count from test case array length
Martin Doucha
mdoucha@suse.cz
Fri Apr 24 15:26:05 CEST 2026
Use ARRAY_SIZE() to calculate test case count so that the number
does not need to be adjusted manually if anyone adds or removes
another line discipline to the list.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
The actual test cases start at ldiscs[1]. ldiscs[0] is a special value
for initializing the file descriptor before setting the real line
discipline.
testcases/kernel/pty/pty03.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/kernel/pty/pty03.c b/testcases/kernel/pty/pty03.c
index 99c659264..d4da24265 100644
--- a/testcases/kernel/pty/pty03.c
+++ b/testcases/kernel/pty/pty03.c
@@ -146,7 +146,7 @@ static void cleanup(void)
static struct tst_test test = {
.test = do_test,
- .tcnt = 9,
+ .tcnt = ARRAY_SIZE(ldiscs) - 1,
.setup = setup,
.cleanup = cleanup,
.needs_root = 1,
--
2.53.0
More information about the ltp
mailing list