public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] lib/tst_tmpdir: Add tst_default_rmdir() for old testcases
@ 2021-11-22  8:01 Zhao Gongyi via ltp
  2022-02-02 16:07 ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Zhao Gongyi via ltp @ 2021-11-22  8:01 UTC (permalink / raw)
  To: ltp

In some old testcases, cleanup() will not run since it exit
form tst_brk. For example, because of the calling of ltp_syscall
have no real cleanup when syscall not support, testcase ssetmask01
will leave tmp file.

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
v1->v2: add tst_default_rmdir() in tst_tmpdir.c

 lib/tst_tmpdir.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/tst_tmpdir.c b/lib/tst_tmpdir.c
index 6e38ae977..0045c7bb6 100644
--- a/lib/tst_tmpdir.c
+++ b/lib/tst_tmpdir.c
@@ -342,6 +342,8 @@ void tst_rmdir(void)
 		tst_resm(TWARN, "%s: rmobj(%s) failed: %s",
 			 __func__, TESTDIR, errmsg);
 	}
+
+	TESTDIR == NULL;
 }

 void tst_purge_dir(const char *path)
@@ -351,3 +353,8 @@ void tst_purge_dir(const char *path)
 	if (purge_dir(path, &err))
 		tst_brkm(TBROK, NULL, "%s: %s", __func__, err);
 }
+
+void __attribute__((destructor)) tst_default_rmdir(void)
+{
+	tst_rmdir();
+}
--
2.17.1


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

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

end of thread, other threads:[~2022-02-02 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-22  8:01 [LTP] [PATCH v2] lib/tst_tmpdir: Add tst_default_rmdir() for old testcases Zhao Gongyi via ltp
2022-02-02 16:07 ` Cyril Hrubis

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