Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Laura Nao <laura.nao@collabora.com>
To: skhan@linuxfoundation.org
Cc: gregkh@linuxfoundation.org, kernel@collabora.com,
	laura.nao@collabora.com, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, nfraprado@collabora.com,
	shuah@kernel.org
Subject: Re: [PATCH] selftests: ksft: Track skipped tests when finishing the test suite
Date: Mon, 29 Jul 2024 16:52:22 +0200	[thread overview]
Message-ID: <20240729145222.119830-1-laura.nao@collabora.com> (raw)
In-Reply-To: <9009f4df-ca7e-4961-97e4-446afc4e87d2@linuxfoundation.org>

Hi Shuah,

On 7/23/24 18:17, Shuah Khan wrote:
> On 7/22/24 09:43, Laura Nao wrote:
>> Consider skipped tests in addition to passed tests when evaluating the
>> overall result of the test suite in the finished() helper.
>>
>> Signed-off-by: Laura Nao <laura.nao@collabora.com>
>> ---
>>   tools/testing/selftests/kselftest/ksft.py | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/kselftest/ksft.py 
>> b/tools/testing/selftests/kselftest/ksft.py
>> index cd89fb2bc10e..bf215790a89d 100644
>> --- a/tools/testing/selftests/kselftest/ksft.py
>> +++ b/tools/testing/selftests/kselftest/ksft.py
>> @@ -70,7 +70,7 @@ def test_result(condition, description=""):
>>   def finished():
>> -    if ksft_cnt["pass"] == ksft_num_tests:
>> +    if ksft_cnt["pass"] + ksft_cnt["skip"] == ksft_num_tests:
>>           exit_code = KSFT_PASS
> 
> Laura and Nícolas,
> 
> I saw both your emails explaining how this fixes the problem in
> a previous patch.
> 
> However looks like you haven't see my response about the implications
> of the exit_code = KSFT_PASS when tests are skipped.
> 
> if ksft_cnt["pass"] + ksft_cnt["skip"] == ksft_num_tests:
>>           exit_code = KSFT_PASS
> 
> Let me reiterate in case you missed it:
> 
> There is a reason why you don't want to mark all tests passed
> when there are several skips.Skips are an indication that
> there are several tests and/or test cases that couldn't not
> be run because of unmet dependencies. This condition needs
> to be investigated to see if there are any config options
> that could be enabled to get a better coverage.
> 
> Including skips to determine pass gives a false sense security
> that all is well when it isn't.
> 
> So it is incorrect to set the exit code to KSFT_PASS when there
> are skipped tests.

Just to be clear, the logic in ksft_finished() in kselftest.h (the C
helper) is to exit with KSFT_PASS when there are only passed and skipped 
tests. You're suggesting we change it to exit with KSFT_FAIL in that 
case?

Under this new logic, the runner would effectively treat skips as 
failures, impacting existing kselftests.

> +    if ksft_cnt["pass"] + ksft_cnt["skip"] == ksft_num_tests:
> 
> 
>>       else:
>>           exit_code = KSFT_FAIL
> 
> The logic here seems to not take into account when you have a
> conditions where you have a mixed results of passed tests,
> skipped tests, and failed tests.
>
> Please revisit and figure out how to address this and report
> the status correctly.

The logic ensures that if there’s a mix of passed, skipped, and failed 
tests, the exit code returned is KSFT_FAIL. I believe that if there is at 
least one failed test, the overall test should be reported as failed, 
which is what happens in this case.

Thanks,

Laura

  reply	other threads:[~2024-07-29 14:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-22 15:43 [PATCH] selftests: ksft: Track skipped tests when finishing the test suite Laura Nao
2024-07-22 17:32 ` Shuah Khan
2024-07-22 18:42   ` Shuah Khan
2024-07-22 18:51   ` Nícolas F. R. A. Prado
2024-07-23 14:06     ` Laura Nao
2024-07-23 16:17 ` Shuah Khan
2024-07-29 14:52   ` Laura Nao [this message]
2024-07-29 20:06     ` Shuah Khan
2024-07-30 10:35       ` Laura Nao
2024-07-31 23:04         ` Shuah Khan

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=20240729145222.119830-1-laura.nao@collabora.com \
    --to=laura.nao@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=nfraprado@collabora.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.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