[LTP] [PATCH] lib/tst_test.c: add *cleanup() before exit

Zhao Gongyi zhaogongyi@huawei.com
Mon Nov 8 08:38:28 CET 2021


If the main process exit without *cleanup() and when the lib process
has exit, the test environment would not be reset when the testcase
needs resource of device or tmpfs.

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 lib/tst_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 02ae28335..4c7e3a97b 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1226,6 +1226,8 @@ static void heartbeat(void)
 		 * We need kill the task group immediately since the
 		 * main process has exit.
 		 */
+		do_test_cleanup();
+		do_cleanup();
 		kill(0, SIGKILL);
 		exit(TBROK);
 	}
--
2.17.1



More information about the ltp mailing list