<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>
<div style="font-family:Calibri,Helvetica!important; font-size:17.0px; color:#333333">
<span style="color:#333333; font-size:17.0px">Yes, please do.</span><br>
<br>
<span style="color:#333333; font-size:17.0px">Feel fine with your modification and thanks for your review.</span><br>
<br>
<span style="color:#333333; font-size:17.0px">Kind Regards,</span><br>
<span style="color:#333333; font-size:17.0px">Ziyao</span><br>
<br>
<span style="color:#333333; font-size:17.0px">
<hr id="x_client_signature_separator" style="border-top:dotted 1px">
</span><br>
<span style="color:#333333; font-size:17.0px">Xie Ziyao</span><br>
<span style="color:#333333; font-size:17.0px">Email: <a href="mailto:xieziyao@huawei.com" target="_BLANK">xieziyao@huawei.com</a></span><br>
<br>
<br>
</div>
<div name="x_AnyOffice-Background-Image" style="border-top:1px solid #B5C4DF; padding:8px">
<div><b>From: </b>Cyril Hrubis<<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</a>></div>
<div><b>To: </b>xieziyao<<a href="mailto:xieziyao@huawei.com">xieziyao@huawei.com</a>></div>
<div><b>Cc: </b>ltp<<a href="mailto:ltp@lists.linux.it">ltp@lists.linux.it</a>>;mdoucha<<a href="mailto:mdoucha@suse.cz">mdoucha@suse.cz</a>></div>
<div><b>Subject: </b>Re: [LTP][PATCH 3/3 v2] getrusage: Cleanup and bugfix for getrusage03</div>
<div><b>Time: </b>2021-06-18 20:46:14</div>
<br>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hi!<br>
>  static void sig_ign(void)<br>
>  {<br>
> -     tst_resm(TINFO, "Testcase #06: SIG_IGN");<br>
> -<br>
> -     SAFE_GETRUSAGE(cleanup, RUSAGE_CHILDREN, &ru);<br>
> -     tst_resm(TINFO, "initial.children = %ld", ru.ru_maxrss);<br>
> -     signal(SIGCHLD, SIG_IGN);<br>
> +     SAFE_SIGNAL(SIGCHLD, SIG_IGN);<br>
> +     SAFE_GETRUSAGE(RUSAGE_CHILDREN, &ru);<br>
>        maxrss_init = ru.ru_maxrss;<br>
> <br>
> -     switch (pid = fork()) {<br>
> -     case -1:<br>
> -             tst_brkm(TBROK, cleanup, "fork #6");<br>
> -     case 0:<br>
> -             retval = system("getrusage03_child -n 500");<br>
> -             if ((WIFEXITED(retval) && WEXITSTATUS(retval) != 0))<br>
> -                     tst_brkm(TBROK | TERRNO, cleanup, "system");<br>
> -             exit(0);<br>
> -     default:<br>
> -             break;<br>
> -     }<br>
> +     pid_t pid = SAFE_FORK();<br>
> +<br>
> +     if (!pid)<br>
> +             SAFE_EXECLP("getrusage03_child", "getrusage03_child",<br>
> +                         "consume", "500", NULL);<br>
> <br>
> -     sleep(1);               /* children become zombie */<br>
> -     SAFE_GETRUSAGE(cleanup, RUSAGE_CHILDREN, &ru);<br>
> -     tst_resm(TINFO, "after_zombie.children = %ld", ru.ru_maxrss);<br>
> +     TST_PROCESS_EXIT_WAIT(pid, 0);<br>
> +     SAFE_GETRUSAGE(RUSAGE_CHILDREN, &ru);<br>
>        if (is_in_delta(ru.ru_maxrss - maxrss_init))<br>
> -             tst_resm(TPASS, "initial.children ~= after_zombie.children");<br>
> +             tst_res(TPASS, "initial.children ~= after_zombie.children");<br>
>        else<br>
> -             tst_resm(TFAIL, "initial.children !~= after_zombie.children");<br>
> -     signal(SIGCHLD, SIG_DFL);<br>
> -}<br>
> +             tst_res(TFAIL, "after_zombie.children = %li, expected %li",<br>
> +                     ru.ru_maxrss, maxrss_init);<br>
<br>
I guess that these messages could be better, techincally it's not a<br>
zombie but rather ignored child, so I would change this to:<br>
<br>
"initial.children ~= ignored_child.children"<br>
<br>
Other than this the rest is good.<br>
<br>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz><br>
<br>
<br>
Also if you agree I can fix the two minor issues in the patchset before<br>
merge, no need to send v3.<br>
<br>
-- <br>
Cyril Hrubis<br>
chrubis@suse.cz<br>
</div>
</span></font>
</body>
</html>