All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] lib/default_cleanup: add default_cleanup() for old testcases
@ 2021-11-22  3:54 Zhao Gongyi via ltp
  0 siblings, 0 replies; only message in thread
From: Zhao Gongyi via ltp @ 2021-11-22  3:54 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>
---
 include/old/test.h    |  2 ++
 lib/default_cleanup.c | 11 +++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 lib/default_cleanup.c

diff --git a/include/old/test.h b/include/old/test.h
index 2ae7dba71..752c9628d 100644
--- a/include/old/test.h
+++ b/include/old/test.h
@@ -218,4 +218,6 @@ const char *tst_strerrno(int err);
 #endif
 #define TCID_DEFINE(ID) char *TCID = (#ID TCID_BIT_SUFFIX)

+void __attribute__((destructor)) default_cleanup(void);
+
 #endif	/* __TEST_H__ */
diff --git a/lib/default_cleanup.c b/lib/default_cleanup.c
new file mode 100644
index 000000000..fca394a04
--- /dev/null
+++ b/lib/default_cleanup.c
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2021 Zhao gongyi <zhaogongyi@huawei.com>
+ */
+
+#include "test.h"
+
+void __attribute__((destructor)) default_cleanup(void)
+{
+	tst_rmdir();
+}
--
2.17.1


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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-22  3:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22  3:54 [LTP] [PATCH] lib/default_cleanup: add default_cleanup() for old testcases Zhao Gongyi via ltp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.