Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Sarthak Sharma <sarthak.sharma@arm.com>, shuah@kernel.org
Cc: pbonzini@redhat.com, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests: kselftest: fix wrong test number in ksft_exit_skip
Date: Mon, 4 May 2026 11:58:31 -0600	[thread overview]
Message-ID: <234e4db0-c1be-4b91-969c-0008f058e4cb@linuxfoundation.org> (raw)
In-Reply-To: <604e0c71-0517-4f5f-b127-4b58755527b9@arm.com>

On 4/27/26 23:10, Sarthak Sharma wrote:
> Hi Shuah!
> 
> On 4/27/26 11:14 PM, Shuah Khan wrote:
>> On 4/27/26 05:24, Sarthak Sharma wrote:
>>> ksft_exit_skip() increments ksft_xskip before printing the KTAP
>>> result. As a result, ksft_test_num() already includes the skipped
>>> test.
>>>
>>> Adding 1 to ksft_test_num() increments the printed test number
>>> again, producing an incorrect test number and wrong KTAP output.
>>>
>>> Drop the extra increment and print ksft_test_num() directly.
>>
>> I applied this patch to linux-kselftest fixes branch.
>>
>> I ran a few tests and couldn't really see the problem this patch
>> fixes with and without the patch.
>>
>> Can you send me before and after for mm or timers test runs?
> 
> Sure, this will affect the output whenever a ksft_exit_skip() is called
> after a ksft plan has been printed.
> 
> Let us look at acct_syscall test. When I run the test without root, I
> get the following output before applying the patch:
> 
> TAP version 13
> 1..1
> ok 2 # SKIP This test needs root to run!
> # 1 skipped test(s) detected. Consider enabling relevant config options
> to improve coverage.
> # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:1 error:0
> 
> where we should have observed ok 1 instead of ok 2.
> 
> When I run the test without root, after applying the patch, I get the
> corrected output:
> 
> TAP version 13
> 1..1
> ok 1 # SKIP This test needs root to run!
> # 1 skipped test(s) detected. Consider enabling relevant config options
> to improve coverage.
> # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:1 error:0
> 
> Since a lot of selftests are being formatted to give KTAP output right
> now, this patch is expected to fix a larger number of tests once that
> gets merged.
> 

Sounds good.

Thanks.
-- Shuah

      reply	other threads:[~2026-05-04 17:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 11:24 [PATCH] selftests: kselftest: fix wrong test number in ksft_exit_skip Sarthak Sharma
2026-04-27 17:44 ` Shuah Khan
2026-04-28  5:10   ` Sarthak Sharma
2026-05-04 17:58     ` 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=234e4db0-c1be-4b91-969c-0008f058e4cb@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sarthak.sharma@arm.com \
    --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