* [PATCH] selftests: Add information about TAP conformance in tests
@ 2024-06-10 8:32 Muhammad Usama Anjum
2024-06-11 20:27 ` Shuah Khan
0 siblings, 1 reply; 3+ messages in thread
From: Muhammad Usama Anjum @ 2024-06-10 8:32 UTC (permalink / raw)
To: Shuah Khan, Jonathan Corbet
Cc: Muhammad Usama Anjum, kernel, linux-kselftest, linux-doc, linux-kernel
Although "TAP" word is being used already in documentation, but it hasn't
been defined in informative way for developers that how to write TAP
conformant tests and what are the benefits. Write a short brief about it.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
Documentation/dev-tools/kselftest.rst | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
index dcf634e411bd9..b579f491f3e97 100644
--- a/Documentation/dev-tools/kselftest.rst
+++ b/Documentation/dev-tools/kselftest.rst
@@ -228,6 +228,14 @@ In general, the rules for selftests are
* Don't cause the top-level "make run_tests" to fail if your feature is
unconfigured.
+ * The output of tests must conform to the TAP standard to ensure high
+ testing quality and to capture failures/errors with specific details.
+ The kselftest.h and kselftest_harness.h headers provide wrappers for
+ outputting test results such as pass, fail, or skip etc. These wrappers
+ should be used instead of reinventing the wheel or using raw printf and
+ exit statements. CI systems can easily parse TAP output messages to
+ detect test failures.
+
Contributing new tests (details)
================================
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests: Add information about TAP conformance in tests
2024-06-10 8:32 [PATCH] selftests: Add information about TAP conformance in tests Muhammad Usama Anjum
@ 2024-06-11 20:27 ` Shuah Khan
2024-06-12 7:27 ` Muhammad Usama Anjum
0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2024-06-11 20:27 UTC (permalink / raw)
To: Muhammad Usama Anjum, Shuah Khan, Jonathan Corbet
Cc: kernel, linux-kselftest, linux-doc, linux-kernel, Shuah Khan
On 6/10/24 02:32, Muhammad Usama Anjum wrote:
> Although "TAP" word is being used already in documentation, but it hasn't
> been defined in informative way for developers that how to write TAP
> conformant tests and what are the benefits. Write a short brief about it.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> Documentation/dev-tools/kselftest.rst | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
> index dcf634e411bd9..b579f491f3e97 100644
> --- a/Documentation/dev-tools/kselftest.rst
> +++ b/Documentation/dev-tools/kselftest.rst
> @@ -228,6 +228,14 @@ In general, the rules for selftests are
> * Don't cause the top-level "make run_tests" to fail if your feature is
> unconfigured.
>
> + * The output of tests must conform to the TAP standard to ensure high
> + testing quality and to capture failures/errors with specific details.
> + The kselftest.h and kselftest_harness.h headers provide wrappers for
> + outputting test results such as pass, fail, or skip etc. These wrappers
> + should be used instead of reinventing the wheel or using raw printf and
When there are multiple tests supported by a test suite, it doesn't
make sense to convert every single print statement. That is the reason
why we have the run_tests wrapper that prints the summary in TAP format.
I would rephrase this to say "should be used for pass, fail, exit, and
skip messages".
This rule is applicable to only the tests that are in the selftests Makefile
and included in the default run.
There is no need to convert every single print statement in tests.
> + exit statements. CI systems can easily parse TAP output messages to
> + detect test failures.
I would rather see people spending energy writing new tests and fixing
warnings. TAP conversions need to be focused if they add value.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests: Add information about TAP conformance in tests
2024-06-11 20:27 ` Shuah Khan
@ 2024-06-12 7:27 ` Muhammad Usama Anjum
0 siblings, 0 replies; 3+ messages in thread
From: Muhammad Usama Anjum @ 2024-06-12 7:27 UTC (permalink / raw)
To: Shuah Khan, Shuah Khan, Jonathan Corbet
Cc: Muhammad Usama Anjum, kernel, linux-kselftest, linux-doc, linux-kernel
On 6/12/24 1:27 AM, Shuah Khan wrote:
> On 6/10/24 02:32, Muhammad Usama Anjum wrote:
>> Although "TAP" word is being used already in documentation, but it hasn't
>> been defined in informative way for developers that how to write TAP
>> conformant tests and what are the benefits. Write a short brief about it.
>>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>> Documentation/dev-tools/kselftest.rst | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/Documentation/dev-tools/kselftest.rst
>> b/Documentation/dev-tools/kselftest.rst
>> index dcf634e411bd9..b579f491f3e97 100644
>> --- a/Documentation/dev-tools/kselftest.rst
>> +++ b/Documentation/dev-tools/kselftest.rst
>> @@ -228,6 +228,14 @@ In general, the rules for selftests are
>> * Don't cause the top-level "make run_tests" to fail if your feature is
>> unconfigured.
>> + * The output of tests must conform to the TAP standard to ensure high
>> + testing quality and to capture failures/errors with specific details.
>> + The kselftest.h and kselftest_harness.h headers provide wrappers for
>> + outputting test results such as pass, fail, or skip etc. These wrappers
>> + should be used instead of reinventing the wheel or using raw printf and
>
> When there are multiple tests supported by a test suite, it doesn't
> make sense to convert every single print statement. That is the reason
> why we have the run_tests wrapper that prints the summary in TAP format.
>
> I would rephrase this to say "should be used for pass, fail, exit, and
> skip messages".
Makes sense. I'll update.
>
> This rule is applicable to only the tests that are in the selftests Makefile
> and included in the default run.
>
> There is no need to convert every single print statement in tests.
>
>> + exit statements. CI systems can easily parse TAP output messages to
>> + detect test failures.
>
> I would rather see people spending energy writing new tests and fixing
> warnings. TAP conversions need to be focused if they add value.
Some tests don't print pass/fail and just return status by exit value.
Adding pass/fail statements there really add value by exposing what went
wrong. So it can be reproduced in debug environment to fix it.
>
> thanks,
> -- Shuah
>
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-12 7:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-10 8:32 [PATCH] selftests: Add information about TAP conformance in tests Muhammad Usama Anjum
2024-06-11 20:27 ` Shuah Khan
2024-06-12 7:27 ` Muhammad Usama Anjum
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®