Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] lib: tst_test: tst_reinit() abort when already initialized
@ 2026-04-30  9:19 Cyril Hrubis
  2026-04-30 10:19 ` Andrea Cervesato via ltp
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Cyril Hrubis @ 2026-04-30  9:19 UTC (permalink / raw)
  To: ltp

Calling tst_reinit() when library is already initialized or calling it
for a second time is always mistake. With that we silenty drop the old
IPC region, that may have contained test results and there are likely
other problems possibly caused by initializing the test library twice.

To fix that this patch adds tst_brk() that abort the test if we call
tst_reinit() with already initialized test library.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 lib/tst_test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 26f6510a0..fa61e1be4 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -196,6 +196,9 @@ void tst_reinit(void)
 	size_t size = getpagesize();
 	int fd;
 
+	if (ipc)
+		tst_brk(TBROK, "Test library already initialized!");
+
 	if (!path)
 		tst_brk(TBROK, IPC_ENV_VAR" is not defined");
 
-- 
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-05-07  9:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30  9:19 [LTP] [PATCH] lib: tst_test: tst_reinit() abort when already initialized Cyril Hrubis
2026-04-30 10:19 ` Andrea Cervesato via ltp
2026-04-30 10:34 ` Li Wang
2026-04-30 12:53   ` Cyril Hrubis
2026-05-07  1:00     ` Li Wang
2026-05-07  6:58       ` Cyril Hrubis
2026-05-07  8:41         ` Li Wang
2026-05-07  9:02           ` Li Wang
2026-05-07  9:08             ` Cyril Hrubis
2026-05-07  9:13               ` Li Wang
2026-04-30 11:38 ` [LTP] " linuxtestproject.agent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox