diff mbox series

[05/13] selftests: pidfd: use ksft_test_result_skip() when skipping test

Message ID 20201008122633.687877-6-tommi.t.rantala@nokia.com (mailing list archive)
State Accepted
Headers show
Series selftests fixes | expand

Commit Message

Rantala, Tommi T. (Nokia - FI/Espoo) Oct. 8, 2020, 12:26 p.m. UTC
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>
---
 tools/testing/selftests/pidfd/pidfd_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian Brauner Oct. 9, 2020, 12:03 p.m. UTC | #1
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>
diff mbox series

Patch

diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c
index c585aaa2acd8..529eb700ac26 100644
--- a/tools/testing/selftests/pidfd/pidfd_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_test.c
@@ -330,7 +330,7 @@  static int test_pidfd_send_signal_recycled_pid_fail(void)
 		ksft_exit_fail_msg("%s test: Failed to recycle pid %d\n",
 				   test_name, PID_RECYCLE);
 	case PIDFD_SKIP:
-		ksft_print_msg("%s test: Skipping test\n", test_name);
+		ksft_test_result_skip("%s test: Skipping test\n", test_name);
 		ret = 0;
 		break;
 	case PIDFD_XFAIL: