From: Richard Palethorpe <rpalethorpe@suse.de>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] containers/utsname04: don't use TST_EXP_EQ_LI for tst_clone
Date: Tue, 07 Mar 2023 08:35:29 +0000 [thread overview]
Message-ID: <877cvt7xtq.fsf@suse.de> (raw)
In-Reply-To: <1678169395-4584-1-git-send-email-xuyang2018.jy@fujitsu.com>
Hello,
Yang Xu <xuyang2018.jy@fujitsu.com> writes:
> For old kernel(below 5.3) that doesn't support clone3, tst_clone returns
> -2 instead of -1. So we can't use TST_EXP_EQ_LI api.
>
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
Thanks, I suppose this could be avoided in the future by hinting that
the return type is more complex than the usual for clone
typedef tst_clone_return_t pid_t;
enum tst_clone_error {
TST_CLONE_ERROR = -2,
TST_CLONE3_ERROR = -1
};
Possibly we could force a cast somehow? Otherwise it's just a hint.
> ---
> testcases/kernel/containers/utsname/utsname04.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/containers/utsname/utsname04.c b/testcases/kernel/containers/utsname/utsname04.c
> index e8d636d0d..61cc066d8 100644
> --- a/testcases/kernel/containers/utsname/utsname04.c
> +++ b/testcases/kernel/containers/utsname/utsname04.c
> @@ -29,7 +29,13 @@ static void run(void)
> SAFE_SETRESUID(pw->pw_uid, pw->pw_uid, pw->pw_uid);
>
> if (!str_op || !strcmp(str_op, "clone")) {
> - TST_EXP_EQ_LI(tst_clone(&cargs), -1);
> + TEST(tst_clone(&cargs));
> + if (TST_RET == -1)
> + tst_res(TPASS, "clone3() fails as expected");
> + else if (TST_RET == -2)
> + tst_res(TPASS, "clone() fails as expected");
> + else
> + tst_res(TFAIL, "tst_clone returns %ld", TST_RET);
> TST_EXP_PASS(errno == EPERM);
> } else {
> if (!SAFE_FORK()) {
> --
> 2.39.1
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-03-07 8:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-28 8:44 [LTP] [PATCH] containers/utsname04: don't use TST_EXP_EQ_LI for tst_clone Yang Xu
2023-02-28 9:06 ` Andrea Cervesato via ltp
2023-02-28 9:18 ` xuyang2018.jy
2023-02-28 9:39 ` Cyril Hrubis
2023-03-03 6:11 ` xuyang2018.jy
2023-03-06 14:10 ` Richard Palethorpe
2023-03-07 6:09 ` [LTP] [PATCH v2] " Yang Xu
2023-03-07 8:35 ` Richard Palethorpe [this message]
2023-03-07 10:16 ` Richard Palethorpe
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=877cvt7xtq.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=ltp@lists.linux.it \
--cc=xuyang2018.jy@fujitsu.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