From: Cyril Hrubis <chrubis@suse.cz>
To: Zhao Gongyi <zhaogongyi@huawei.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] lib/tst_tmpdir: Add tst_default_rmdir() for old testcases
Date: Wed, 2 Feb 2022 17:07:57 +0100 [thread overview]
Message-ID: <YfqsXZFKZjlf3BWh@yuki> (raw)
In-Reply-To: <20211122080138.55815-1-zhaogongyi@huawei.com>
Hi!
> 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.
Actually you can pass cleanup to ltp_syscall(), all you need to do is
ti define CLEANUP before including LTP headers as:
#define CLEANUP cleanup
#include "test.h"
...
...
See the include/old/cleanup.c for details.
> 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;
This is useless statement, it does literaly nothing.
> }
>
> 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();
> +}
I do not think that we should run the tst_rmdir() for all tests like
this.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2022-02-02 16:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YfqsXZFKZjlf3BWh@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=zhaogongyi@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox