From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V2 4/8] waitpid09: use the new API
Date: Tue, 19 Jul 2016 14:41:25 +0200 [thread overview]
Message-ID: <20160719124125.GD6409@rei.lan> (raw)
In-Reply-To: <1468924444-924-1-git-send-email-stanislav.kholmanskikh@oracle.com>
Hi!
> This patch addresses all your comments, except the one about do_exit(),
> because do_exit() is required for case 0.
What I meant was to move the two lines that are in do_exit() to the if
in the case0(). Previously the function was called from two places (one
was the uclinux maybe_run_child and another one was after the fork) but
now it does not make any sense to keep it as a separate function if it's
called only from one place in the code.
Or is there another reason to keep it in a fucntion I don't see?
> +static void case2(void)
> {
> + pid_t ret;
> + int status;
> +
> + ret = waitpid(-1, &status, 0);
> +
> + if (ret != -1) {
> + tst_res(TFAIL, "Expected -1 got %d", ret);
> + return;
> + }
> + if (errno != ECHILD) {
> + tst_res(TFAIL, "Expected ECHILD got %d",
> + errno);
^
You should print the human-readable string
returned by tst_strerrno() here as well or
use TERRNO to have it printed by the library.
> + return;
> + }
> +
> + tst_res(TPASS, "Case 2 PASSED");
> }
>
> -static void inthandlr(void)
> +static void case3(void)
> {
> - intintr++;
> + pid_t ret;
> + int status;
> +
> + ret = waitpid(-1, &status, WNOHANG);
> + if (ret != -1) {
> + tst_res(TFAIL, "WNOHANG: Expected -1 got %d",
> + ret);
> + return;
> + }
> + if (errno != ECHILD) {
> + tst_res(TFAIL, "WNOHANG: Expected ECHILD got "
> + "%d", errno);
Here as well.
> + return;
> + }
> +
> + tst_res(TPASS, "Case 3 PASSED");
> }
>
> -static void wait_for_parent(void)
Otherwise it looks good. Acked with the minor changes fixed.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2016-07-19 12:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-15 14:39 [LTP] waitpid: new API Stanislav Kholmanskikh
2016-07-15 14:39 ` [LTP] [PATCH 1/8] tst_safe_macros: SAFE_GETPGID Stanislav Kholmanskikh
2016-07-15 14:39 ` [LTP] [PATCH 2/8] waitpid06: use the new API Stanislav Kholmanskikh
2016-07-18 13:05 ` Cyril Hrubis
2016-07-19 14:55 ` [LTP] [PATCH V2 1/4] " Stanislav Kholmanskikh
2016-07-19 14:55 ` [LTP] [PATCH V2 2/4] waitpid07: " Stanislav Kholmanskikh
2016-07-19 14:55 ` [LTP] [PATCH V2 3/4] waitpid08: " Stanislav Kholmanskikh
2016-07-19 14:55 ` [LTP] [PATCH V2 4/4] waitpid11: " Stanislav Kholmanskikh
2016-08-03 16:12 ` [LTP] [PATCH V2 2/4] waitpid07: " Cyril Hrubis
2016-08-03 16:01 ` [LTP] [PATCH V2 1/4] waitpid06: " Cyril Hrubis
2016-08-03 10:19 ` [LTP] [PATCH 2/8] " Stanislav Kholmanskikh
2016-08-03 12:01 ` Cyril Hrubis
2016-07-15 14:39 ` [LTP] [PATCH 3/8] waitpid07: " Stanislav Kholmanskikh
2016-07-15 14:39 ` [LTP] [PATCH 4/8] waitpid09: " Stanislav Kholmanskikh
2016-07-18 14:18 ` Cyril Hrubis
2016-07-19 10:34 ` [LTP] [PATCH V2 " Stanislav Kholmanskikh
2016-07-19 12:41 ` Cyril Hrubis [this message]
2016-07-19 14:57 ` Stanislav Kholmanskikh
2016-07-15 14:39 ` [LTP] [PATCH 5/8] waitpid11: " Stanislav Kholmanskikh
2016-07-18 15:01 ` Cyril Hrubis
2016-07-15 14:39 ` [LTP] [PATCH 6/8] waitpid12: " Stanislav Kholmanskikh
2016-07-18 15:07 ` Cyril Hrubis
2016-07-15 14:39 ` [LTP] [PATCH 7/8] waitpid13: " Stanislav Kholmanskikh
2016-07-15 14:39 ` [LTP] [PATCH 8/8] waitpid08: " Stanislav Kholmanskikh
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=20160719124125.GD6409@rei.lan \
--to=chrubis@suse.cz \
--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