public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] mem/oom: call WEXITSTATUS() only if WIFEXITED()	returned true
Date: Wed, 24 Feb 2016 06:03:26 -0500 (EST)	[thread overview]
Message-ID: <1952284603.26737557.1456311806125.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20160224101914.GA4402@localhost.localdomain>





----- Original Message -----
> From: "Han Pingtian" <hanpt@linux.vnet.ibm.com>
> To: ltp@lists.linux.it
> Sent: Wednesday, 24 February, 2016 11:19:14 AM
> Subject: [LTP] [PATCH] mem/oom: call WEXITSTATUS() only if WIFEXITED()	returned true
> 
> Only when WIFEXITED() returned true that WEXITSTATUS() can return a
> meanful result. So we should check WIFEXITED() first.
> 
> Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>

Looks good to me.

> ---
>  testcases/kernel/mem/lib/mem.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
> index cedcf32..8327998 100644
> --- a/testcases/kernel/mem/lib/mem.c
> +++ b/testcases/kernel/mem/lib/mem.c
> @@ -150,12 +150,16 @@ void oom(int testcase, int lite, int retcode, int
> allow_sigkill)
>  				WTERMSIG(status),
>  				tst_strsig(WTERMSIG(status)));
>  		}
> -	} else	if (WIFEXITED(status) && WEXITSTATUS(status) == retcode) {
> -		tst_resm(TPASS, "victim retcode: (%d) %s",
> +	} else if (WIFEXITED(status)) {
> +		if (WEXITSTATUS(status) == retcode) {
> +			tst_resm(TPASS, "victim retcode: (%d) %s",
>  				retcode, strerror(retcode));
> -	} else {
> -		tst_resm(TFAIL, "victim unexpectedly ended with retcode: %d, "
> +		} else {
> +			tst_resm(TFAIL, "victim unexpectedly ended with retcode: %d, "
>  				"expected: %d", WEXITSTATUS(status), retcode);
> +		}
> +	} else {
> +		tst_resm(TFAIL, "victim unexpectedly ended");

Is this only theoretical or did you actually run into this?
If so, what are the circumstances for this to happen?

Regards,
Jan

>  	}
>  }
>  
> --
> 1.9.3
> 
> 
> --
> Mailing list info: http://lists.linux.it/listinfo/ltp
> 

  reply	other threads:[~2016-02-24 11:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 10:19 [LTP] [PATCH] mem/oom: call WEXITSTATUS() only if WIFEXITED() returned true Han Pingtian
2016-02-24 11:03 ` Jan Stancek [this message]
2016-02-25  1:18   ` Han Pingtian
2016-02-25  7:46     ` Jan Stancek
2016-02-26  2:25       ` Han Pingtian

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=1952284603.26737557.1456311806125.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.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