mbox series

[00/13] selftests fixes

Message ID 20201008122633.687877-1-tommi.t.rantala@nokia.com
Headers show
Series selftests fixes | expand

Message

Rantala, Tommi T. (Nokia - FI/Espoo) Oct. 8, 2020, 12:26 p.m. UTC
Hi, small fixes to issues I hit with selftests.

Tommi Rantala (13):
  selftests: filter kselftest headers from command in lib.mk
  selftests: pidfd: fix compilation errors due to wait.h
  selftests: add vmaccess to .gitignore
  selftests/harness: prettify SKIP message whitespace again
  selftests: pidfd: use ksft_test_result_skip() when skipping test
  selftests: pidfd: skip test on kcmp() ENOSYS
  selftests: pidfd: add CONFIG_CHECKPOINT_RESTORE=y to config
  selftests: pidfd: drop needless linux/kcmp.h inclusion in
    pidfd_setns_test.c
  selftests: android: fix multiple definition of sock_name
  selftests: proc: fix warning: _GNU_SOURCE redefined
  selftests: core: use SKIP instead of XFAIL in close_range_test.c
  selftests: clone3: use SKIP instead of XFAIL
  selftests: binderfs: use SKIP instead of XFAIL

 tools/testing/selftests/android/ion/ipcsocket.c           | 1 +
 tools/testing/selftests/android/ion/ipcsocket.h           | 2 --
 .../selftests/clone3/clone3_cap_checkpoint_restore.c      | 2 +-
 tools/testing/selftests/core/close_range_test.c           | 8 ++++----
 .../selftests/filesystems/binderfs/binderfs_test.c        | 8 ++++----
 tools/testing/selftests/kselftest_harness.h               | 2 +-
 tools/testing/selftests/lib.mk                            | 2 +-
 tools/testing/selftests/pidfd/config                      | 1 +
 tools/testing/selftests/pidfd/pidfd_getfd_test.c          | 5 ++++-
 tools/testing/selftests/pidfd/pidfd_open_test.c           | 1 -
 tools/testing/selftests/pidfd/pidfd_poll_test.c           | 1 -
 tools/testing/selftests/pidfd/pidfd_setns_test.c          | 1 -
 tools/testing/selftests/pidfd/pidfd_test.c                | 2 +-
 tools/testing/selftests/proc/proc-loadavg-001.c           | 1 -
 tools/testing/selftests/proc/proc-self-syscall.c          | 1 -
 tools/testing/selftests/proc/proc-uptime-002.c            | 1 -
 tools/testing/selftests/ptrace/.gitignore                 | 1 +
 17 files changed, 19 insertions(+), 21 deletions(-)

Comments

Kees Cook Oct. 8, 2020, 8:05 p.m. UTC | #1
On Thu, Oct 08, 2020 at 03:26:21PM +0300, Tommi Rantala wrote:
> Commit 1056d3d2c97e ("selftests: enforce local header dependency in

> lib.mk") added header dependency to the rule, but as the rule uses $^,

> the headers are added to the compiler command line.

> 

> This can cause unexpected precompiled header files being generated when

> compilation fails:

> 

>   $ echo { >> openat2_test.c

> 

>   $ make

>   gcc -Wall -O2 -g -fsanitize=address -fsanitize=undefined  openat2_test.c

>     tools/testing/selftests/kselftest_harness.h tools/testing/selftests/kselftest.h helpers.c

>     -o tools/testing/selftests/openat2/openat2_test

>   openat2_test.c:313:1: error: expected identifier or ‘(’ before ‘{’ token

>     313 | {

>         | ^

>   make: *** [../lib.mk:140: tools/testing/selftests/openat2/openat2_test] Error 1

> 

>   $ file openat2_test*

>   openat2_test:   GCC precompiled header (version 014) for C

>   openat2_test.c: C source, ASCII text

> 

> Fix it by filtering out the headers, so that we'll only pass the actual

> *.c files in the compiler command line.

> 

> Fixes: 1056d3d2c97e ("selftests: enforce local header dependency in lib.mk")

> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>


Ah yes, thanks!

Acked-by: Kees Cook <keescook@chromium.org>



-- 
Kees Cook
Kees Cook Oct. 8, 2020, 8:05 p.m. UTC | #2
On Thu, Oct 08, 2020 at 03:26:23PM +0300, Tommi Rantala wrote:
> Commit 2de4e82318c7 ("selftests/ptrace: add test cases for dead-locks")
> added vmaccess testcase, add the binary to .gitignore
> 
> Fixes: 2de4e82318c7 ("selftests/ptrace: add test cases for dead-locks")
> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>

Reviewed-by: Kees Cook <keescook@chromium.org>
Kees Cook Oct. 8, 2020, 8:06 p.m. UTC | #3
On Thu, Oct 08, 2020 at 03:26:32PM +0300, Tommi Rantala wrote:
> XFAIL is gone since 9847d24af95c ("selftests/harness: Refactor XFAIL

> into SKIP"), use SKIP instead.

> 

> Fixes: 9847d24af95c ("selftests/harness: Refactor XFAIL into SKIP")

> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>


Reviewed-by: Kees Cook <keescook@chromium.org>


-- 
Kees Cook
Kees Cook Oct. 8, 2020, 8:06 p.m. UTC | #4
On Thu, Oct 08, 2020 at 03:26:33PM +0300, Tommi Rantala wrote:
> XFAIL is gone since 9847d24af95c ("selftests/harness: Refactor XFAIL
> into SKIP"), use SKIP instead.
> 
> Fixes: 9847d24af95c ("selftests/harness: Refactor XFAIL into SKIP")
> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>

Reviewed-by: Kees Cook <keescook@chromium.org>
Christian Brauner Oct. 9, 2020, 9:43 a.m. UTC | #5
On Thu, Oct 08, 2020 at 03:26:33PM +0300, Tommi Rantala wrote:
> XFAIL is gone since 9847d24af95c ("selftests/harness: Refactor XFAIL

> into SKIP"), use SKIP instead.

> 

> Fixes: 9847d24af95c ("selftests/harness: Refactor XFAIL into SKIP")

> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>

> ---


Thanks!
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Christian Brauner Oct. 9, 2020, 9:44 a.m. UTC | #6
On Thu, Oct 08, 2020 at 03:26:32PM +0300, Tommi Rantala wrote:
> XFAIL is gone since 9847d24af95c ("selftests/harness: Refactor XFAIL
> into SKIP"), use SKIP instead.
> 
> Fixes: 9847d24af95c ("selftests/harness: Refactor XFAIL into SKIP")
> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
> ---

Thanks!
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Christian Brauner Oct. 9, 2020, 12:02 p.m. UTC | #7
On Thu, Oct 08, 2020 at 03:26:23PM +0300, Tommi Rantala wrote:
> Commit 2de4e82318c7 ("selftests/ptrace: add test cases for dead-locks")

> added vmaccess testcase, add the binary to .gitignore

> 

> Fixes: 2de4e82318c7 ("selftests/ptrace: add test cases for dead-locks")

> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>

> ---


Thanks!
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Christian Brauner Oct. 9, 2020, 12:03 p.m. UTC | #8
On Thu, Oct 08, 2020 at 03:26:25PM +0300, Tommi Rantala wrote:
> There's planned tests != run tests in pidfd_test when some test is
> skipped:
> 
>   $ ./pidfd_test
>   TAP version 13
>   1..8
>   [...]
>   # pidfd_send_signal signal recycled pid test: Skipping test
>   # Planned tests != run tests (8 != 7)
>   # Totals: pass:7 fail:0 xfail:0 xpass:0 skip:0 error:0
> 
> Fix by using ksft_test_result_skip():
> 
>   $ ./pidfd_test
>   TAP version 13
>   1..8
>   [...]
>   ok 8 # SKIP pidfd_send_signal signal recycled pid test: Unsharing pid namespace not permitted
>   # Totals: pass:7 fail:0 xfail:0 xpass:0 skip:1 error:0
> 
> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
> ---

Thanks, I never got around to fixing this myself.
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Christian Brauner Oct. 9, 2020, 12:04 p.m. UTC | #9
On Thu, Oct 08, 2020 at 03:26:26PM +0300, Tommi Rantala wrote:
> Skip test if kcmp() is not available, for example if kernel is compiled

> without CONFIG_CHECKPOINT_RESTORE=y.

> 

> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>

> ---


Good catch, thanks!
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Christian Brauner Oct. 9, 2020, 12:05 p.m. UTC | #10
On Thu, Oct 08, 2020 at 03:26:29PM +0300, Tommi Rantala wrote:
> Fix multiple definition of sock_name compilation error:
> 
>   tools/testing/selftests/android/ion/ipcsocket.h:8: multiple definition of `sock_name'
> 
> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
> ---

Ion will be removed from the kernel soon but this seems like an ok
bugfix.
Thanks!
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Christian Brauner Oct. 9, 2020, 12:06 p.m. UTC | #11
On Thu, Oct 08, 2020 at 03:26:21PM +0300, Tommi Rantala wrote:
> Commit 1056d3d2c97e ("selftests: enforce local header dependency in

> lib.mk") added header dependency to the rule, but as the rule uses $^,

> the headers are added to the compiler command line.

> 

> This can cause unexpected precompiled header files being generated when

> compilation fails:

> 

>   $ echo { >> openat2_test.c

> 

>   $ make

>   gcc -Wall -O2 -g -fsanitize=address -fsanitize=undefined  openat2_test.c

>     tools/testing/selftests/kselftest_harness.h tools/testing/selftests/kselftest.h helpers.c

>     -o tools/testing/selftests/openat2/openat2_test

>   openat2_test.c:313:1: error: expected identifier or ‘(’ before ‘{’ token

>     313 | {

>         | ^

>   make: *** [../lib.mk:140: tools/testing/selftests/openat2/openat2_test] Error 1

> 

>   $ file openat2_test*

>   openat2_test:   GCC precompiled header (version 014) for C

>   openat2_test.c: C source, ASCII text

> 

> Fix it by filtering out the headers, so that we'll only pass the actual

> *.c files in the compiler command line.

> 

> Fixes: 1056d3d2c97e ("selftests: enforce local header dependency in lib.mk")

> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>

> ---


Thanks!
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Christian Brauner Oct. 9, 2020, 12:07 p.m. UTC | #12
On Thu, Oct 08, 2020 at 03:26:20PM +0300, Tommi Rantala wrote:
> Hi, small fixes to issues I hit with selftests.
> 
> Tommi Rantala (13):
>   selftests: filter kselftest headers from command in lib.mk
>   selftests: pidfd: fix compilation errors due to wait.h
>   selftests: add vmaccess to .gitignore
>   selftests/harness: prettify SKIP message whitespace again
>   selftests: pidfd: use ksft_test_result_skip() when skipping test
>   selftests: pidfd: skip test on kcmp() ENOSYS
>   selftests: pidfd: add CONFIG_CHECKPOINT_RESTORE=y to config
>   selftests: pidfd: drop needless linux/kcmp.h inclusion in
>     pidfd_setns_test.c
>   selftests: android: fix multiple definition of sock_name
>   selftests: proc: fix warning: _GNU_SOURCE redefined
>   selftests: core: use SKIP instead of XFAIL in close_range_test.c
>   selftests: clone3: use SKIP instead of XFAIL
>   selftests: binderfs: use SKIP instead of XFAIL

This mostly deals with stuff I maintain but it can go via the selftest
tree, thanks!

Christian
Shuah Khan Oct. 27, 2020, 11:12 p.m. UTC | #13
On 10/8/20 6:26 AM, Tommi Rantala wrote:
> Hi, small fixes to issues I hit with selftests.
> 
> Tommi Rantala (13):
>    selftests: filter kselftest headers from command in lib.mk
>    selftests: pidfd: fix compilation errors due to wait.h
>    selftests: add vmaccess to .gitignore
>    selftests/harness: prettify SKIP message whitespace again
>    selftests: pidfd: use ksft_test_result_skip() when skipping test
>    selftests: pidfd: skip test on kcmp() ENOSYS
>    selftests: pidfd: add CONFIG_CHECKPOINT_RESTORE=y to config
>    selftests: pidfd: drop needless linux/kcmp.h inclusion in
>      pidfd_setns_test.c
>    selftests: android: fix multiple definition of sock_name
>    selftests: proc: fix warning: _GNU_SOURCE redefined
>    selftests: core: use SKIP instead of XFAIL in close_range_test.c
>    selftests: clone3: use SKIP instead of XFAIL
>    selftests: binderfs: use SKIP instead of XFAIL
> 
>   tools/testing/selftests/android/ion/ipcsocket.c           | 1 +
>   tools/testing/selftests/android/ion/ipcsocket.h           | 2 --
>   .../selftests/clone3/clone3_cap_checkpoint_restore.c      | 2 +-
>   tools/testing/selftests/core/close_range_test.c           | 8 ++++----
>   .../selftests/filesystems/binderfs/binderfs_test.c        | 8 ++++----
>   tools/testing/selftests/kselftest_harness.h               | 2 +-
>   tools/testing/selftests/lib.mk                            | 2 +-
>   tools/testing/selftests/pidfd/config                      | 1 +
>   tools/testing/selftests/pidfd/pidfd_getfd_test.c          | 5 ++++-
>   tools/testing/selftests/pidfd/pidfd_open_test.c           | 1 -
>   tools/testing/selftests/pidfd/pidfd_poll_test.c           | 1 -
>   tools/testing/selftests/pidfd/pidfd_setns_test.c          | 1 -
>   tools/testing/selftests/pidfd/pidfd_test.c                | 2 +-
>   tools/testing/selftests/proc/proc-loadavg-001.c           | 1 -
>   tools/testing/selftests/proc/proc-self-syscall.c          | 1 -
>   tools/testing/selftests/proc/proc-uptime-002.c            | 1 -
>   tools/testing/selftests/ptrace/.gitignore                 | 1 +
>   17 files changed, 19 insertions(+), 21 deletions(-)
> 

Thanks for fixing these.

Applied all except 03/13 which is already fixed.

thanks,
-- Shuah
Michael Ellerman Oct. 28, 2020, 1:37 a.m. UTC | #14
Tommi Rantala <tommi.t.rantala@nokia.com> writes:
> Hi, small fixes to issues I hit with selftests.
>
> Tommi Rantala (13):
>   selftests: filter kselftest headers from command in lib.mk
>   selftests: pidfd: fix compilation errors due to wait.h
>   selftests: add vmaccess to .gitignore
>   selftests/harness: prettify SKIP message whitespace again
>   selftests: pidfd: use ksft_test_result_skip() when skipping test
>   selftests: pidfd: skip test on kcmp() ENOSYS
>   selftests: pidfd: add CONFIG_CHECKPOINT_RESTORE=y to config
>   selftests: pidfd: drop needless linux/kcmp.h inclusion in
>     pidfd_setns_test.c
>   selftests: android: fix multiple definition of sock_name
>   selftests: proc: fix warning: _GNU_SOURCE redefined
>   selftests: core: use SKIP instead of XFAIL in close_range_test.c
>   selftests: clone3: use SKIP instead of XFAIL
>   selftests: binderfs: use SKIP instead of XFAIL

This series doesn't seem to have been picked up?

cheers
Shuah Khan Oct. 28, 2020, 2:31 p.m. UTC | #15
On 10/27/20 7:37 PM, Michael Ellerman wrote:
> Tommi Rantala <tommi.t.rantala@nokia.com> writes:

>> Hi, small fixes to issues I hit with selftests.

>>

>> Tommi Rantala (13):

>>    selftests: filter kselftest headers from command in lib.mk

>>    selftests: pidfd: fix compilation errors due to wait.h

>>    selftests: add vmaccess to .gitignore

>>    selftests/harness: prettify SKIP message whitespace again

>>    selftests: pidfd: use ksft_test_result_skip() when skipping test

>>    selftests: pidfd: skip test on kcmp() ENOSYS

>>    selftests: pidfd: add CONFIG_CHECKPOINT_RESTORE=y to config

>>    selftests: pidfd: drop needless linux/kcmp.h inclusion in

>>      pidfd_setns_test.c

>>    selftests: android: fix multiple definition of sock_name

>>    selftests: proc: fix warning: _GNU_SOURCE redefined

>>    selftests: core: use SKIP instead of XFAIL in close_range_test.c

>>    selftests: clone3: use SKIP instead of XFAIL

>>    selftests: binderfs: use SKIP instead of XFAIL

> 

> This series doesn't seem to have been picked up?

> 

> cheers

> 


I applied them to linux-kselftest fixes yesterday.

thanks,
-- Shuah
Michael Ellerman Oct. 30, 2020, 6:15 a.m. UTC | #16
Shuah Khan <skhan@linuxfoundation.org> writes:
> On 10/27/20 7:37 PM, Michael Ellerman wrote:
>> Tommi Rantala <tommi.t.rantala@nokia.com> writes:
>>> Hi, small fixes to issues I hit with selftests.
>>>
>>> Tommi Rantala (13):
>>>    selftests: filter kselftest headers from command in lib.mk
>>>    selftests: pidfd: fix compilation errors due to wait.h
>>>    selftests: add vmaccess to .gitignore
>>>    selftests/harness: prettify SKIP message whitespace again
>>>    selftests: pidfd: use ksft_test_result_skip() when skipping test
>>>    selftests: pidfd: skip test on kcmp() ENOSYS
>>>    selftests: pidfd: add CONFIG_CHECKPOINT_RESTORE=y to config
>>>    selftests: pidfd: drop needless linux/kcmp.h inclusion in
>>>      pidfd_setns_test.c
>>>    selftests: android: fix multiple definition of sock_name
>>>    selftests: proc: fix warning: _GNU_SOURCE redefined
>>>    selftests: core: use SKIP instead of XFAIL in close_range_test.c
>>>    selftests: clone3: use SKIP instead of XFAIL
>>>    selftests: binderfs: use SKIP instead of XFAIL
>> 
>> This series doesn't seem to have been picked up?
>> 
>
> I applied them to linux-kselftest fixes yesterday.

Thanks.

cheers
Shuah Khan Nov. 5, 2020, 5:14 p.m. UTC | #17
On 10/9/20 6:05 AM, Christian Brauner wrote:
> On Thu, Oct 08, 2020 at 03:26:29PM +0300, Tommi Rantala wrote:
>> Fix multiple definition of sock_name compilation error:
>>
>>    tools/testing/selftests/android/ion/ipcsocket.h:8: multiple definition of `sock_name'
>>
>> Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
>> ---
> 
> Ion will be removed from the kernel soon but this seems like an ok
> bugfix.
> Thanks!
> Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
> 

ion is already gone. I am dropping this from linux-kselftest fixes
now. This is also causing conflict with ion removal commit

thanks,
-- Shuah