All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Wieczor-Retman, Maciej" <maciej.wieczor-retman@intel.com>
Cc: Christian Brauner <brauner@kernel.org>,
	Shuah Khan <shuah@kernel.org>,
	Reinette Chatre <reinette.chatre@intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 4/6] selftests/pidfd: Fix ksft print formats
Date: Mon, 28 Aug 2023 14:01:18 +0300 (EEST)	[thread overview]
Message-ID: <c920ad68-45a7-23dd-9d4c-fac99e1a53c0@linux.intel.com> (raw)
In-Reply-To: <ac9c6c136a9e249453f866f56eab175c27f48061.1693216959.git.maciej.wieczor-retman@intel.com>

On Mon, 28 Aug 2023, Wieczor-Retman, Maciej wrote:

> Many calls to ksft print functions have format strings that don't match
> with other passed arguments. One call expects a string but doesn't
> provide any argument after the format string.
> 
> Fix format specifiers so they match the passed variables.
> 
> Add a missing variable to ksft_test_result_pass() inside
> pidfd_fdinfo_test() so it matches other cases in the switch statement.
> 
> Signed-off-by: Wieczor-Retman, Maciej <maciej.wieczor-retman@intel.com>
> ---
>  tools/testing/selftests/pidfd/pidfd_fdinfo_test.c |  2 +-
>  tools/testing/selftests/pidfd/pidfd_test.c        | 12 ++++++------
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c
> index 4e86f927880c..01cc37bf611c 100644
> --- a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c
> +++ b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c
> @@ -62,7 +62,7 @@ static void error_report(struct error *err, const char *test_name)
>  		break;
>  
>  	case PIDFD_PASS:
> -		ksft_test_result_pass("%s test: Passed\n");
> +		ksft_test_result_pass("%s test: Passed\n", test_name);

Missing test_name leads to crash so this looks a Fixes: class thing for
me but you didn't provide one.

>  		break;
>  
>  	default:
> diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c
> index 00a07e7c571c..c081ae91313a 100644
> --- a/tools/testing/selftests/pidfd/pidfd_test.c
> +++ b/tools/testing/selftests/pidfd/pidfd_test.c
> @@ -381,13 +381,13 @@ static int test_pidfd_send_signal_syscall_support(void)
>  
>  static void *test_pidfd_poll_exec_thread(void *priv)
>  {
> -	ksft_print_msg("Child Thread: starting. pid %d tid %d ; and sleeping\n",
> +	ksft_print_msg("Child Thread: starting. pid %d tid %ld ; and sleeping\n",
>  			getpid(), syscall(SYS_gettid));
>  	ksft_print_msg("Child Thread: doing exec of sleep\n");
>  
>  	execl("/bin/sleep", "sleep", str(CHILD_THREAD_MIN_WAIT), (char *)NULL);
>  
> -	ksft_print_msg("Child Thread: DONE. pid %d tid %d\n",
> +	ksft_print_msg("Child Thread: DONE. pid %d tid %ld\n",
>  			getpid(), syscall(SYS_gettid));
>  	return NULL;
>  }
> @@ -427,7 +427,7 @@ static int child_poll_exec_test(void *args)
>  {
>  	pthread_t t1;
>  
> -	ksft_print_msg("Child (pidfd): starting. pid %d tid %d\n", getpid(),
> +	ksft_print_msg("Child (pidfd): starting. pid %d tid %ld\n", getpid(),
>  			syscall(SYS_gettid));
>  	pthread_create(&t1, NULL, test_pidfd_poll_exec_thread, NULL);
>  	/*
> @@ -480,10 +480,10 @@ static void test_pidfd_poll_exec(int use_waitpid)
>  
>  static void *test_pidfd_poll_leader_exit_thread(void *priv)
>  {
> -	ksft_print_msg("Child Thread: starting. pid %d tid %d ; and sleeping\n",
> +	ksft_print_msg("Child Thread: starting. pid %d tid %ld ; and sleeping\n",
>  			getpid(), syscall(SYS_gettid));
>  	sleep(CHILD_THREAD_MIN_WAIT);
> -	ksft_print_msg("Child Thread: DONE. pid %d tid %d\n", getpid(), syscall(SYS_gettid));
> +	ksft_print_msg("Child Thread: DONE. pid %d tid %ld\n", getpid(), syscall(SYS_gettid));
>  	return NULL;
>  }
>  
> @@ -492,7 +492,7 @@ static int child_poll_leader_exit_test(void *args)
>  {
>  	pthread_t t1, t2;
>  
> -	ksft_print_msg("Child: starting. pid %d tid %d\n", getpid(), syscall(SYS_gettid));
> +	ksft_print_msg("Child: starting. pid %d tid %ld\n", getpid(), syscall(SYS_gettid));
>  	pthread_create(&t1, NULL, test_pidfd_poll_leader_exit_thread, NULL);
>  	pthread_create(&t2, NULL, test_pidfd_poll_leader_exit_thread, NULL);
>  
> 

-- 
 i.


  reply	other threads:[~2023-08-28 11:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 10:48 [PATCH 0/6] Add printf attribute to kselftest functions Wieczor-Retman, Maciej
2023-08-28 10:49 ` [PATCH 1/6] selftests: Add printf attribute to ksefltest prints Wieczor-Retman, Maciej
2023-08-28 10:49 ` [PATCH 2/6] selftests/cachestat: Fix print_cachestat format Wieczor-Retman, Maciej
2023-08-28 10:49   ` Wieczor-Retman, Maciej
2023-08-28 14:00   ` Nhat Pham
2023-08-28 14:04     ` Nhat Pham
2023-08-28 10:49 ` [PATCH 3/6] selftests/openat2: Fix wrong format specifier Wieczor-Retman, Maciej
2023-08-30 12:25   ` Ilpo Järvinen
2023-08-28 10:49 ` [PATCH 4/6] selftests/pidfd: Fix ksft print formats Wieczor-Retman, Maciej
2023-08-28 11:01   ` Ilpo Järvinen [this message]
2023-08-28 13:07     ` Maciej Wieczór-Retman
2023-08-28 10:49 ` [PATCH 5/6] selftests/sigaltstack: Fix wrong format specifier Wieczor-Retman, Maciej
2023-08-30 12:02   ` Ilpo Järvinen
2023-08-28 10:49 ` [PATCH 6/6] selftests/kvm: Replace attribute with macro Wieczor-Retman, Maciej
2023-08-30 12:22   ` Ilpo Järvinen
2023-08-30 13:40     ` Maciej Wieczór-Retman
2023-08-31 14:33       ` Andrew Jones

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=c920ad68-45a7-23dd-9d4c-fac99e1a53c0@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    /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 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.