All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Sidhartha Kumar <sidhartha.kumar@oracle.com>,
	shuah@kernel.org, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftest/vm: clarify error statement in gup_test
Date: Thu, 31 Mar 2022 13:28:34 -0600	[thread overview]
Message-ID: <9a752af3-8e3f-bfc5-eb24-eadcaf800bd5@linuxfoundation.org> (raw)
In-Reply-To: <20220330215257.112029-1-sidhartha.kumar@oracle.com>

On 3/30/22 3:52 PM, Sidhartha Kumar wrote:
> Print two possible reasons /sys/kernel/debug/gup_test
> cannot be opened to help users of this test diagnose
> failures.
> 

Thank you for the patch to improve rather cryptic error messages.

> Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> Cc: stable@vger.kernel.org # 5.15+
> ---
>   tools/testing/selftests/vm/gup_test.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/vm/gup_test.c b/tools/testing/selftests/vm/gup_test.c
> index fe043f67798b0..c496bcefa7a0e 100644
> --- a/tools/testing/selftests/vm/gup_test.c
> +++ b/tools/testing/selftests/vm/gup_test.c
> @@ -205,7 +205,9 @@ int main(int argc, char **argv)
>   
>   	gup_fd = open("/sys/kernel/debug/gup_test", O_RDWR);
>   	if (gup_fd == -1) {
> -		perror("open");
> +		perror("failed to open /sys/kernel/debug/gup_test");
> +		printf("check if CONFIG_GUP_TEST is enabled in kernel config\n");
> +		printf("check if debugfs is mounted at /sys/kernel/debug\n");

Instead of adding 3 messages in a row, please check the errno to figure
out why it failed and print an appropriate message.

If open fails because CONFIG_GUP_TEST is not enabled, the test should skip
the test instead of fail. Failing will indicate a test failure which is not
the case. The test couldn't be run due to unmet dependencies.

This test requires root access. A check for root privilege and skip the
test for the same reason stated above.

>   		exit(1);
>   	}
>   
> 

Please send v2 with these changes.

thanks,
-- Shuah

      parent reply	other threads:[~2022-03-31 19:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 21:52 [PATCH] selftest/vm: clarify error statement in gup_test Sidhartha Kumar
2022-03-31  1:54 ` Andrew Morton
2022-03-31 19:28 ` Shuah Khan [this message]

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=9a752af3-8e3f-bfc5-eb24-eadcaf800bd5@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.org \
    --cc=sidhartha.kumar@oracle.com \
    --cc=stable@vger.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.