public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: xieziyao <xieziyao@huawei.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 3/3 v2] getrusage: Cleanup and bugfix for getrusage03
Date: Fri, 18 Jun 2021 13:16:54 +0000	[thread overview]
Message-ID: <021a65c83ac448e882077e7dabe1667b@huawei.com> (raw)
In-Reply-To: <YMyPhiiKwuwEdj7N@yuki>

Yes, please do.

Feel fine with your modification and thanks for your review.

Kind Regards,
Ziyao

________________________________

Xie Ziyao
Email: xieziyao@huawei.com<mailto:xieziyao@huawei.com>


From: Cyril Hrubis<chrubis@suse.cz<mailto:chrubis@suse.cz>>
To: xieziyao<xieziyao@huawei.com<mailto:xieziyao@huawei.com>>
Cc: ltp<ltp@lists.linux.it<mailto:ltp@lists.linux.it>>;mdoucha<mdoucha@suse.cz<mailto:mdoucha@suse.cz>>
Subject: Re: [LTP][PATCH 3/3 v2] getrusage: Cleanup and bugfix for getrusage03
Time: 2021-06-18 20:46:14

Hi!
>  static void sig_ign(void)
>  {
> -     tst_resm(TINFO, "Testcase #06: SIG_IGN");
> -
> -     SAFE_GETRUSAGE(cleanup, RUSAGE_CHILDREN, &ru);
> -     tst_resm(TINFO, "initial.children = %ld", ru.ru_maxrss);
> -     signal(SIGCHLD, SIG_IGN);
> +     SAFE_SIGNAL(SIGCHLD, SIG_IGN);
> +     SAFE_GETRUSAGE(RUSAGE_CHILDREN, &ru);
>        maxrss_init = ru.ru_maxrss;
>
> -     switch (pid = fork()) {
> -     case -1:
> -             tst_brkm(TBROK, cleanup, "fork #6");
> -     case 0:
> -             retval = system("getrusage03_child -n 500");
> -             if ((WIFEXITED(retval) && WEXITSTATUS(retval) != 0))
> -                     tst_brkm(TBROK | TERRNO, cleanup, "system");
> -             exit(0);
> -     default:
> -             break;
> -     }
> +     pid_t pid = SAFE_FORK();
> +
> +     if (!pid)
> +             SAFE_EXECLP("getrusage03_child", "getrusage03_child",
> +                         "consume", "500", NULL);
>
> -     sleep(1);               /* children become zombie */
> -     SAFE_GETRUSAGE(cleanup, RUSAGE_CHILDREN, &ru);
> -     tst_resm(TINFO, "after_zombie.children = %ld", ru.ru_maxrss);
> +     TST_PROCESS_EXIT_WAIT(pid, 0);
> +     SAFE_GETRUSAGE(RUSAGE_CHILDREN, &ru);
>        if (is_in_delta(ru.ru_maxrss - maxrss_init))
> -             tst_resm(TPASS, "initial.children ~= after_zombie.children");
> +             tst_res(TPASS, "initial.children ~= after_zombie.children");
>        else
> -             tst_resm(TFAIL, "initial.children !~= after_zombie.children");
> -     signal(SIGCHLD, SIG_DFL);
> -}
> +             tst_res(TFAIL, "after_zombie.children = %li, expected %li",
> +                     ru.ru_maxrss, maxrss_init);

I guess that these messages could be better, techincally it's not a
zombie but rather ignored child, so I would change this to:

"initial.children ~= ignored_child.children"

Other than this the rest is good.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>


Also if you agree I can fix the two minor issues in the patchset before
merge, no need to send v3.

--
Cyril Hrubis
chrubis@suse.cz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210618/2fbe3251/attachment.htm>

  reply	other threads:[~2021-06-18 13:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 10:55 [LTP] [PATCH 0/3 v2] Cleanup and bugfix for getrusage03 Xie Ziyao
2021-06-17 10:55 ` [LTP] [PATCH 1/3 v2] lib: tst_process_state: Use SPDX and format alignment Xie Ziyao
2021-06-18 11:46   ` Cyril Hrubis
2021-06-17 10:55 ` [LTP] [PATCH 2/3 v2] lib: tst_process_state: Add tst_process_exit_wait() Xie Ziyao
2021-06-18 11:53   ` Cyril Hrubis
2021-06-17 10:55 ` [LTP] [PATCH 3/3 v2] getrusage: Cleanup and bugfix for getrusage03 Xie Ziyao
2021-06-18 12:20   ` Cyril Hrubis
2021-06-18 13:16     ` xieziyao [this message]
2021-06-18 18:04       ` Cyril Hrubis

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=021a65c83ac448e882077e7dabe1667b@huawei.com \
    --to=xieziyao@huawei.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox