From: Richard Palethorpe <rpalethorpe@suse.de>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1 2/2] Refactor getegid02 using new LTP API
Date: Fri, 08 Sep 2023 10:37:23 +0100 [thread overview]
Message-ID: <87zg1xgg2y.fsf@suse.de> (raw)
In-Reply-To: <20230831104242.27156-3-andrea.cervesato@suse.de>
Hello,
Looks good, I guess you will make changes to the first one and resend?
Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
Andrea Cervesato <andrea.cervesato@suse.de> writes:
> From: Andrea Cervesato <andrea.cervesato@suse.com>
>
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> testcases/kernel/syscalls/getegid/getegid02.c | 93 +++++--------------
> 1 file changed, 21 insertions(+), 72 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/getegid/getegid02.c b/testcases/kernel/syscalls/getegid/getegid02.c
> index 60f09501e..2f64bd869 100644
> --- a/testcases/kernel/syscalls/getegid/getegid02.c
> +++ b/testcases/kernel/syscalls/getegid/getegid02.c
> @@ -1,90 +1,39 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> /*
> - * Copyright (c) International Business Machines Corp., 2001
> - * Ported by Wayne Boyer
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> - * the GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
> + * William Roske, Dave Fenner
> + * Copyright (C) 2023 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
> */
>
> -/*
> - * Testcase to check the basic functionality of getegid().
> +/*\
> + * [Description]
> *
> - * For functionality test the return value from getegid() is compared to passwd
> - * entry.
> + * This test checks if getegid() returns the same effective group given by
> + * passwd entry via getpwuid().
> */
>
> #include <pwd.h>
> -#include <errno.h>
> -
> -#include "test.h"
> -#include "compat_16.h"
>
> -static void cleanup(void);
> -static void setup(void);
> +#include "tst_test.h"
> +#include "compat_tst_16.h"
>
> -TCID_DEFINE(getegid02);
> -int TST_TOTAL = 1;
> -
> -int main(int ac, char **av)
> +static void run(void)
> {
> - int lc;
> uid_t euid;
> + gid_t egid;
> struct passwd *pwent;
>
> - tst_parse_opts(ac, av, NULL, NULL);
> -
> - setup();
> -
> - for (lc = 0; TEST_LOOPING(lc); lc++) {
> - tst_count = 0;
> -
> - TEST(GETEGID(cleanup));
> + UID16_CHECK((euid = geteuid()), "geteuid");
>
> - if (TEST_RETURN < 0) {
> - tst_brkm(TBROK, cleanup, "This should never happen");
> - }
> + pwent = getpwuid(euid);
> + if (!pwent)
> + tst_brk(TBROK | TERRNO, "getpwuid() error");
>
> - euid = geteuid();
> - pwent = getpwuid(euid);
> + GID16_CHECK((egid = getegid()), "getegid");
>
> - if (pwent == NULL)
> - tst_brkm(TBROK, cleanup, "geteuid() returned "
> - "unexpected value %d", euid);
> -
> - GID16_CHECK(pwent->pw_gid, getegid, cleanup);
> -
> - if (pwent->pw_gid != TEST_RETURN) {
> - tst_resm(TFAIL, "getegid() return value"
> - " %ld unexpected - expected %d",
> - TEST_RETURN, pwent->pw_gid);
> - } else {
> - tst_resm(TPASS,
> - "effective group id %ld "
> - "is correct", TEST_RETURN);
> - }
> - }
> -
> - cleanup();
> - tst_exit();
> -}
> -
> -static void setup(void)
> -{
> - tst_sig(NOFORK, DEF_HANDLER, cleanup);
> - TEST_PAUSE;
> + TST_EXP_EQ_LI(pwent->pw_gid, egid);
> }
>
> -static void cleanup(void)
> -{
> -}
> +static struct tst_test test = {
> + .test_all = run,
> +};
> --
> 2.35.3
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-09-08 9:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 10:42 [LTP] [PATCH v1 0/2] Refactor getegid testing suite Andrea Cervesato
2023-08-31 10:42 ` [LTP] [PATCH v1 1/2] Refactor getegid01 using new LTP API Andrea Cervesato
2023-08-31 13:32 ` Cyril Hrubis
2023-09-01 11:46 ` Andrea Cervesato via ltp
2023-09-01 12:21 ` Cyril Hrubis
2023-09-01 11:57 ` Andrea Cervesato via ltp
2023-09-01 12:22 ` Cyril Hrubis
2023-09-01 12:47 ` Andrea Cervesato via ltp
2023-08-31 10:42 ` [LTP] [PATCH v1 2/2] Refactor getegid02 " Andrea Cervesato
2023-09-08 9:37 ` Richard Palethorpe [this message]
2023-09-08 10:25 ` Andrea Cervesato via ltp
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=87zg1xgg2y.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=andrea.cervesato@suse.de \
--cc=ltp@lists.linux.it \
/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 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.