public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/7] syscalls/clone01: Convert to new API
Date: Thu, 2 Sep 2021 08:02:17 +0200	[thread overview]
Message-ID: <YTBo6ZS2GKWb8edF@pevik> (raw)
In-Reply-To: <20210902010814.32448-1-zhanglianjie@uniontech.com>

Hi zhanglianjie,

...
> +static void verify_clone(void)
>  {
> -	void *child_stack;
>  	int status, child_pid;

> -	tst_parse_opts(ac, av, NULL, NULL);
> -
> -	setup();
> +	TST_EXP_POSITIVE(ltp_clone(SIGCHLD, do_child, NULL,
Shouldn't be TST_EXP_PID_SILENT()
Because TST_EXP_POSITIVE() prints extra TPASS which is useless:

clone01.c:31: TPASS: clone() returned 11556
clone01.c:37: TPASS: clone returned 11556
clone01.c:43: TPASS: Child exited with 0

but with TST_EXP_PID_SILENT():
clone01.c:37: TPASS: clone returned 11986
clone01.c:43: TPASS: Child exited with 0

and on deliberate error (using -1 as flag):
clone01.c:31: TFAIL: clone() failed: EINVAL (22)
clone01.c:34: TBROK: wait(0x7ffed515f3ec) failed: ECHILD (10)

> +		CHILD_STACK_SIZE, child_stack), "clone()");

> -	child_stack = malloc(CHILD_STACK_SIZE);
> -	if (child_stack == NULL)
> -		tst_brkm(TBROK, cleanup, "Cannot allocate stack for child");
> +	child_pid = SAFE_WAIT(&status);

> -	tst_count = 0;
> -
> -	TEST(ltp_clone(SIGCHLD, do_child, NULL, CHILD_STACK_SIZE, child_stack));
> -	if (TEST_RETURN == -1)
> -		tst_resm(TFAIL | TTERRNO, "clone failed");
> -
> -	child_pid = SAFE_WAIT(cleanup, &status);
> -
> -	if (TEST_RETURN == child_pid)
> -		tst_resm(TPASS, "clone returned %ld", TEST_RETURN);
> +	if (TST_RET == child_pid)
	if (child_pid ==  TST_RET)

=> run `make check-clone01' to see this error (and run make check-* for other
tests).


Kind regards,
Petr

  reply	other threads:[~2021-09-02  6:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02  1:08 [LTP] [PATCH v2 1/7] syscalls/clone01: Convert to new API zhanglianjie
2021-09-02  6:02 ` Petr Vorel [this message]
2021-09-07 11:09   ` zhanglianjie
2021-09-07 11:09     ` zhanglianjie
2021-09-23  8:56   ` zhanglianjie
2021-09-23  9:05     ` Petr Vorel
2021-09-23  9:14       ` zhanglianjie
2021-09-23  9:25         ` Petr Vorel

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=YTBo6ZS2GKWb8edF@pevik \
    --to=pvorel@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