[LTP] [PATCH] lib: tst_test: tst_reinit() abort when already initialized
Cyril Hrubis
chrubis@suse.cz
Thu Apr 30 11:19:56 CEST 2026
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
More information about the ltp
mailing list