All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] docs/kselftest: add more guidelines for adding new tests
@ 2022-05-21  7:36 Muhammad Usama Anjum
  2022-06-07 12:59 ` Muhammad Usama Anjum
  0 siblings, 1 reply; 7+ messages in thread
From: Muhammad Usama Anjum @ 2022-05-21  7:36 UTC (permalink / raw)
  To: Shuah Khan, Jonathan Corbet
  Cc: Muhammad Usama Anjum, kernel, bagasdotme, linux-kselftest,
	linux-doc, linux-kernel

Improve and add instructions to add new tests. Add build commands to
test before sending the new test patch.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
Changes in v2:
- Updated commit message
- Removed dependence of this patch from other patch
- Updated instructions
---
 Documentation/dev-tools/kselftest.rst | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
index a833ecf12fbc1..ee6467ca8293f 100644
--- a/Documentation/dev-tools/kselftest.rst
+++ b/Documentation/dev-tools/kselftest.rst
@@ -208,6 +208,14 @@ In general, the rules for selftests are
 Contributing new tests (details)
 ================================
 
+ * In your Makefile, use facilities from lib.mk by including it instead of
+   reinventing the wheel. Specify flags and binaries generation flags on
+   need basis before including lib.mk. ::
+
+    CFLAGS = $(KHDR_INCLUDES)
+    TEST_GEN_PROGS := close_range_test
+    include ../lib.mk
+
  * Use TEST_GEN_XXX if such binaries or files are generated during
    compiling.
 
@@ -230,13 +238,30 @@ Contributing new tests (details)
  * First use the headers inside the kernel source and/or git repo, and then the
    system headers.  Headers for the kernel release as opposed to headers
    installed by the distro on the system should be the primary focus to be able
-   to find regressions.
+   to find regressions. Use KHDR_INCLUDES in Makefile to include headers from
+   the kernel source.
 
  * If a test needs specific kernel config options enabled, add a config file in
    the test directory to enable them.
 
    e.g: tools/testing/selftests/android/config
 
+ * Create a .gitignore file inside test directory and add all generated objects
+   in it.
+
+ * Add new test name in TARGETS in selftests/Makefile::
+
+    TARGETS += android
+
+ * All changes should pass::
+
+    kselftest-{all,install,clean,gen_tar}
+    kselftest-{all,install,clean,gen_tar} O=abo_path
+    kselftest-{all,install,clean,gen_tar} O=rel_path
+    make -C tools/testing/selftests {all,install,clean,gen_tar}
+    make -C tools/testing/selftests {all,install,clean,gen_tar} O=abs_path
+    make -C tools/testing/selftests {all,install,clean,gen_tar} O=rel_path
+
 Test Module
 ===========
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] docs/kselftest: add more guidelines for adding new tests
  2022-05-21  7:36 [PATCH v2] docs/kselftest: add more guidelines for adding new tests Muhammad Usama Anjum
@ 2022-06-07 12:59 ` Muhammad Usama Anjum
  2022-06-07 21:41   ` Shuah Khan
  0 siblings, 1 reply; 7+ messages in thread
From: Muhammad Usama Anjum @ 2022-06-07 12:59 UTC (permalink / raw)
  To: Shuah Khan, Jonathan Corbet
  Cc: usama.anjum, kernel, bagasdotme, linux-kselftest, linux-doc,
	linux-kernel

Reminder!

On 5/21/22 12:36 PM, Muhammad Usama Anjum wrote:
> Improve and add instructions to add new tests. Add build commands to
> test before sending the new test patch.
> 
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> Changes in v2:
> - Updated commit message
> - Removed dependence of this patch from other patch
> - Updated instructions
> ---
>  Documentation/dev-tools/kselftest.rst | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
> index a833ecf12fbc1..ee6467ca8293f 100644
> --- a/Documentation/dev-tools/kselftest.rst
> +++ b/Documentation/dev-tools/kselftest.rst
> @@ -208,6 +208,14 @@ In general, the rules for selftests are
>  Contributing new tests (details)
>  ================================
>  
> + * In your Makefile, use facilities from lib.mk by including it instead of
> +   reinventing the wheel. Specify flags and binaries generation flags on
> +   need basis before including lib.mk. ::
> +
> +    CFLAGS = $(KHDR_INCLUDES)
> +    TEST_GEN_PROGS := close_range_test
> +    include ../lib.mk
> +
>   * Use TEST_GEN_XXX if such binaries or files are generated during
>     compiling.
>  
> @@ -230,13 +238,30 @@ Contributing new tests (details)
>   * First use the headers inside the kernel source and/or git repo, and then the
>     system headers.  Headers for the kernel release as opposed to headers
>     installed by the distro on the system should be the primary focus to be able
> -   to find regressions.
> +   to find regressions. Use KHDR_INCLUDES in Makefile to include headers from
> +   the kernel source.
>  
>   * If a test needs specific kernel config options enabled, add a config file in
>     the test directory to enable them.
>  
>     e.g: tools/testing/selftests/android/config
>  
> + * Create a .gitignore file inside test directory and add all generated objects
> +   in it.
> +
> + * Add new test name in TARGETS in selftests/Makefile::
> +
> +    TARGETS += android
> +
> + * All changes should pass::
> +
> +    kselftest-{all,install,clean,gen_tar}
> +    kselftest-{all,install,clean,gen_tar} O=abo_path
> +    kselftest-{all,install,clean,gen_tar} O=rel_path
> +    make -C tools/testing/selftests {all,install,clean,gen_tar}
> +    make -C tools/testing/selftests {all,install,clean,gen_tar} O=abs_path
> +    make -C tools/testing/selftests {all,install,clean,gen_tar} O=rel_path
> +
>  Test Module
>  ===========
>  

-- 
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] docs/kselftest: add more guidelines for adding new tests
  2022-06-07 12:59 ` Muhammad Usama Anjum
@ 2022-06-07 21:41   ` Shuah Khan
  2022-06-21 14:33     ` Muhammad Usama Anjum
  0 siblings, 1 reply; 7+ messages in thread
From: Shuah Khan @ 2022-06-07 21:41 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Shuah Khan, Jonathan Corbet
  Cc: kernel, bagasdotme, linux-kselftest, linux-doc, linux-kernel, Shuah Khan

On 6/7/22 6:59 AM, Muhammad Usama Anjum wrote:
> Reminder!
> 

Remember to avoid top posting.

> On 5/21/22 12:36 PM, Muhammad Usama Anjum wrote:
>> Improve and add instructions to add new tests. Add build commands to
>> test before sending the new test patch.
>>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>> Changes in v2:
>> - Updated commit message
>> - Removed dependence of this patch from other patch
>> - Updated instructions
>> ---
>>   Documentation/dev-tools/kselftest.rst | 27 ++++++++++++++++++++++++++-
>>   1 file changed, 26 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
>> index a833ecf12fbc1..ee6467ca8293f 100644
>> --- a/Documentation/dev-tools/kselftest.rst
>> +++ b/Documentation/dev-tools/kselftest.rst
>> @@ -208,6 +208,14 @@ In general, the rules for selftests are
>>   Contributing new tests (details)
>>   ================================
>>   
>> + * In your Makefile, use facilities from lib.mk by including it instead of
>> +   reinventing the wheel. Specify flags and binaries generation flags on
>> +   need basis before including lib.mk. ::
>> +
>> +    CFLAGS = $(KHDR_INCLUDES)
>> +    TEST_GEN_PROGS := close_range_test
>> +    include ../lib.mk
>> +
>>    * Use TEST_GEN_XXX if such binaries or files are generated during
>>      compiling.
>>   
>> @@ -230,13 +238,30 @@ Contributing new tests (details)
>>    * First use the headers inside the kernel source and/or git repo, and then the
>>      system headers.  Headers for the kernel release as opposed to headers
>>      installed by the distro on the system should be the primary focus to be able
>> -   to find regressions.
>> +   to find regressions. Use KHDR_INCLUDES in Makefile to include headers from
>> +   the kernel source.
>>   
>>    * If a test needs specific kernel config options enabled, add a config file in
>>      the test directory to enable them.
>>   
>>      e.g: tools/testing/selftests/android/config
>>   
>> + * Create a .gitignore file inside test directory and add all generated objects
>> +   in it.
>> +
>> + * Add new test name in TARGETS in selftests/Makefile::
>> +
>> +    TARGETS += android
>> +
>> + * All changes should pass::
>> +
>> +    kselftest-{all,install,clean,gen_tar}
>> +    kselftest-{all,install,clean,gen_tar} O=abo_path
>> +    kselftest-{all,install,clean,gen_tar} O=rel_path
>> +    make -C tools/testing/selftests {all,install,clean,gen_tar}
>> +    make -C tools/testing/selftests {all,install,clean,gen_tar} O=abs_path
>> +    make -C tools/testing/selftests {all,install,clean,gen_tar} O=rel_path
>> +
>>   Test Module
>>   ===========
>>   
> 

The change looks good to me. I am catching up on patch backlog after the
merge window and vacation. I can take this through kselftest or if it
goes through doc tree - here is my

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] docs/kselftest: add more guidelines for adding new tests
  2022-06-07 21:41   ` Shuah Khan
@ 2022-06-21 14:33     ` Muhammad Usama Anjum
  2022-06-24 19:49       ` Jonathan Corbet
  0 siblings, 1 reply; 7+ messages in thread
From: Muhammad Usama Anjum @ 2022-06-21 14:33 UTC (permalink / raw)
  To: Shuah Khan, Shuah Khan, Jonathan Corbet
  Cc: usama.anjum, kernel, bagasdotme, linux-kselftest, linux-doc,
	linux-kernel

On 6/8/22 2:41 AM, Shuah Khan wrote:
> 
> The change looks good to me. I am catching up on patch backlog after the
> merge window and vacation. I can take this through kselftest or if it
> goes through doc tree - here is my
> 
> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
> 
This patch hasn't been accepted yet.

> thanks,
> -- Shuah

-- 
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] docs/kselftest: add more guidelines for adding new tests
  2022-06-21 14:33     ` Muhammad Usama Anjum
@ 2022-06-24 19:49       ` Jonathan Corbet
  2022-06-24 22:39         ` Shuah Khan
  2022-06-25  4:32         ` Muhammad Usama Anjum
  0 siblings, 2 replies; 7+ messages in thread
From: Jonathan Corbet @ 2022-06-24 19:49 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Shuah Khan, Shuah Khan
  Cc: usama.anjum, kernel, bagasdotme, linux-kselftest, linux-doc,
	linux-kernel

Muhammad Usama Anjum <usama.anjum@collabora.com> writes:

> On 6/8/22 2:41 AM, Shuah Khan wrote:
>> 
>> The change looks good to me. I am catching up on patch backlog after the
>> merge window and vacation. I can take this through kselftest or if it
>> goes through doc tree - here is my
>> 
>> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
>> 
> This patch hasn't been accepted yet.

I've applied it now, thanks.

jon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] docs/kselftest: add more guidelines for adding new tests
  2022-06-24 19:49       ` Jonathan Corbet
@ 2022-06-24 22:39         ` Shuah Khan
  2022-06-25  4:32         ` Muhammad Usama Anjum
  1 sibling, 0 replies; 7+ messages in thread
From: Shuah Khan @ 2022-06-24 22:39 UTC (permalink / raw)
  To: Jonathan Corbet, Muhammad Usama Anjum, Shuah Khan
  Cc: kernel, bagasdotme, linux-kselftest, linux-doc, linux-kernel, Shuah Khan

On 6/24/22 1:49 PM, Jonathan Corbet wrote:
> Muhammad Usama Anjum <usama.anjum@collabora.com> writes:
> 
>> On 6/8/22 2:41 AM, Shuah Khan wrote:
>>>
>>> The change looks good to me. I am catching up on patch backlog after the
>>> merge window and vacation. I can take this through kselftest or if it
>>> goes through doc tree - here is my
>>>
>>> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
>>>
>> This patch hasn't been accepted yet.
> 
> I've applied it now, thanks.
> 

Thank you Jon. Kind of slipped through my backlog.

thanks,
-- Shuah


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] docs/kselftest: add more guidelines for adding new tests
  2022-06-24 19:49       ` Jonathan Corbet
  2022-06-24 22:39         ` Shuah Khan
@ 2022-06-25  4:32         ` Muhammad Usama Anjum
  1 sibling, 0 replies; 7+ messages in thread
From: Muhammad Usama Anjum @ 2022-06-25  4:32 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: usama.anjum, kernel, bagasdotme, linux-kselftest, Shuah Khan,
	linux-doc, linux-kernel, Shuah Khan



On 6/25/22 12:49 AM, Jonathan Corbet wrote:
> Muhammad Usama Anjum <usama.anjum@collabora.com> writes:
> 
>> On 6/8/22 2:41 AM, Shuah Khan wrote:
>>>
>>> The change looks good to me. I am catching up on patch backlog after the
>>> merge window and vacation. I can take this through kselftest or if it
>>> goes through doc tree - here is my
>>>
>>> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
>>>
>> This patch hasn't been accepted yet.
> 
> I've applied it now, thanks.
Thanks,

> 
> jon

-- 
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-25  4:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-21  7:36 [PATCH v2] docs/kselftest: add more guidelines for adding new tests Muhammad Usama Anjum
2022-06-07 12:59 ` Muhammad Usama Anjum
2022-06-07 21:41   ` Shuah Khan
2022-06-21 14:33     ` Muhammad Usama Anjum
2022-06-24 19:49       ` Jonathan Corbet
2022-06-24 22:39         ` Shuah Khan
2022-06-25  4:32         ` Muhammad Usama Anjum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.