public inbox for linux-kselftest@vger.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Jakub Kicinski <kuba@kernel.org>,
	keescook@chromium.org, shuah@kernel.org
Cc: mic@digikod.net, linux-kselftest@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH selftests] selftests: harness: avoid false negatives if test has no ASSERTs
Date: Fri, 3 Dec 2021 11:17:22 -0700	[thread overview]
Message-ID: <537e3cd2-3e5b-52c8-fd73-493ca71ccc2b@linuxfoundation.org> (raw)
In-Reply-To: <20211124223916.1986279-1-kuba@kernel.org>

On 11/24/21 3:39 PM, Jakub Kicinski wrote:
> Test can fail either immediately when ASSERT() failed or at the
> end if one or more EXPECT() was not met. The exact return code
> is decided based on the number of successful ASSERT()s.
> 
> If test has no ASSERT()s, however, the return code will be 0,
> as if the test did not fail. Start counting ASSERT()s from 1.
> 
> Fixes: 369130b63178 ("selftests: Enhance kselftest_harness.h to print which assert failed")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>   tools/testing/selftests/kselftest_harness.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
> index ae0f0f33b2a6..79a182cfa43a 100644
> --- a/tools/testing/selftests/kselftest_harness.h
> +++ b/tools/testing/selftests/kselftest_harness.h
> @@ -969,7 +969,7 @@ void __run_test(struct __fixture_metadata *f,
>   	t->passed = 1;
>   	t->skip = 0;
>   	t->trigger = 0;
> -	t->step = 0;
> +	t->step = 1;
>   	t->no_print = 0;
>   	memset(t->results->reason, 0, sizeof(t->results->reason));
>   
> 

Thank you for the fix. Will apply for the next pull request.

thanks,
-- Shuah

      reply	other threads:[~2021-12-03 18:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 22:39 [PATCH selftests] selftests: harness: avoid false negatives if test has no ASSERTs Jakub Kicinski
2021-12-03 18:17 ` Shuah Khan [this message]

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=537e3cd2-3e5b-52c8-fd73-493ca71ccc2b@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mic@digikod.net \
    --cc=shuah@kernel.org \
    /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