From: Shuah <shuah@kernel.org>
To: Laura Nao <laura.nao@collabora.com>, shuah@kernel.org
Cc: gregkh@linuxfoundation.org, nfraprado@collabora.com,
usama.anjum@collabora.com, robh@kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@collabora.com
Subject: Re: [PATCH] selftests: Warn about skipped tests in result summary
Date: Fri, 22 Nov 2024 11:19:41 -0700 [thread overview]
Message-ID: <46dbd308-8af1-4a6d-91ec-82981e867ff4@kernel.org> (raw)
In-Reply-To: <20241122155548.55495-1-laura.nao@collabora.com>
On 11/22/24 08:55, Laura Nao wrote:
> Update the functions that print the test totals at the end of a selftest
> to include a warning message when skipped tests are detected. The
> message advises users that skipped tests may indicate missing
> configuration options and suggests enabling them to improve coverage.
>
> Signed-off-by: Laura Nao <laura.nao@collabora.com>
> ---
> This patch follows up on a previous discussion[1] and aims to highlight
> skipped tests for the user's attention.
>
> [1] https://lore.kernel.org/lkml/2bb2d338-cd00-4ac2-b8bd-5579eae82637@linuxfoundation.org/
> ---
> tools/testing/selftests/kselftest.h | 4 ++++
> tools/testing/selftests/kselftest/ksft.py | 3 +++
> tools/testing/selftests/kselftest/ktap_helpers.sh | 4 ++++
> 3 files changed, 11 insertions(+)
>
> diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
> index 29fedf609611..d3f64b333acd 100644
> --- a/tools/testing/selftests/kselftest.h
> +++ b/tools/testing/selftests/kselftest.h
> @@ -147,6 +147,10 @@ static inline void ksft_set_plan(unsigned int plan)
>
> static inline void ksft_print_cnts(void)
> {
> + if (ksft_cnt.ksft_xskip > 0)
> + printf(
> + "# Skipped tests detected. Consider enabling relevant config options to improve coverage.\n"
I like this. How about printing the number of skipped tests in this
message also to make it easy to parse.
Same comment on other print messages,
> + );
> if (ksft_plan != ksft_test_num())
> printf("# Planned tests != run tests (%u != %u)\n",
> ksft_plan, ksft_test_num());
> diff --git a/tools/testing/selftests/kselftest/ksft.py b/tools/testing/selftests/kselftest/ksft.py
> index bf215790a89d..7675a15a1264 100644
> --- a/tools/testing/selftests/kselftest/ksft.py
> +++ b/tools/testing/selftests/kselftest/ksft.py
> @@ -27,6 +27,9 @@ def set_plan(num_tests):
>
>
> def print_cnts():
> + if ksft_cnt['skip'] > 0:
> + print("# Skipped tests detected. Consider enabling relevant config options to improve coverage.")
> +
> print(
> f"# Totals: pass:{ksft_cnt['pass']} fail:{ksft_cnt['fail']} xfail:0 xpass:0 skip:{ksft_cnt['skip']} error:0"
> )
> diff --git a/tools/testing/selftests/kselftest/ktap_helpers.sh b/tools/testing/selftests/kselftest/ktap_helpers.sh
> index 79a125eb24c2..a4211221ccd6 100644
> --- a/tools/testing/selftests/kselftest/ktap_helpers.sh
> +++ b/tools/testing/selftests/kselftest/ktap_helpers.sh
> @@ -107,5 +107,9 @@ ktap_finished() {
> }
>
> ktap_print_totals() {
> + if [ "$KTAP_CNT_SKIP" -gt 0 ]; then
> + echo "# Skipped tests detected. " \
> + "Consider enabling relevant config options to improve coverage."
> + fi
> echo "# Totals: pass:$KTAP_CNT_PASS fail:$KTAP_CNT_FAIL xfail:0 xpass:0 skip:$KTAP_CNT_SKIP error:0"
> }
thanks,
-- Shuah
next prev parent reply other threads:[~2024-11-22 18:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 15:55 Laura Nao
2024-11-22 18:19 ` Shuah [this message]
2024-11-25 8:46 ` Muhammad Usama Anjum
2024-11-25 11:49 ` Laura Nao
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=46dbd308-8af1-4a6d-91ec-82981e867ff4@kernel.org \
--to=shuah@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel@collabora.com \
--cc=laura.nao@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=nfraprado@collabora.com \
--cc=robh@kernel.org \
--cc=usama.anjum@collabora.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®