mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Andrey Vagin <avagin@openvz.org>
Cc: linux-kernel@vger.kernel.org,
	Shuah Khan <shuahkh@osg.samsung.com>,
	Cyrill Gorcunov <gorcunov@openvz.org>
Subject: Re: [PATCH] selftests/kcmp: exit with non-zero code in a fail case
Date: Fri, 13 Mar 2015 21:37:20 +1100	[thread overview]
Message-ID: <1426243040.25086.3.camel@ellerman.id.au> (raw)
In-Reply-To: <1426238828-30042-1-git-send-email-avagin@openvz.org>

On Fri, 2015-03-13 at 12:27 +0300, Andrey Vagin wrote:
> diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
> index 572c888..a0ec8b8 100644
> --- a/tools/testing/selftests/kselftest.h
> +++ b/tools/testing/selftests/kselftest.h
> @@ -58,5 +58,17 @@ static inline int ksft_exit_skip(void)
>  {
>  	exit(4);
>  }
> +static inline int ksft_exit(void)
> +{
> +	if (ksft_cnt.ksft_fail)
> +		return ksft_exit_fail();
> +	if (ksft_cnt.ksft_xpass)
> +		return ksft_exit_xpass();
> +	if (ksft_cnt.ksft_xskip)
> +		return ksft_exit_skip();
> +	if (ksft_cnt.ksft_xfail)
> +		return ksft_exit_xfail();
> +	ksft_exit_pass();
> +}

This function claims to return 'int', but doesn't. So do all the others.

It could be as simple as:

static inline void ksft_exit(void)
{
	if (ksft_cnt.ksft_fail)
		exit(1);

	if (ksft_cnt.ksft_xpass)
		exit(3);

	if (ksft_cnt.ksft_xskip)
		exit(4);

	if (ksft_cnt.ksft_xfail)
		exit(2);

	exit(0);
}

cheers




  reply	other threads:[~2015-03-13 10:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13  9:27 Andrey Vagin
2015-03-13 10:37 ` Michael Ellerman [this message]
2015-03-13 11:06   ` Andrey Wagin

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=1426243040.25086.3.camel@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=avagin@openvz.org \
    --cc=gorcunov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shuahkh@osg.samsung.com \
    /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

all inboxes | Powered by JetHome®