All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
To: Breno Leitao <leitao@debian.org>, linuxppc-dev@lists.ozlabs.org
Cc: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Subject: Re: [PATCH 2/2] selftests/powerpc: Skip test instead of failing
Date: Tue, 23 Oct 2018 13:41:11 -0700	[thread overview]
Message-ID: <56cdd832-6229-bf95-58ee-1783f931e7bd@linux.vnet.ibm.com> (raw)
In-Reply-To: <1540326197-15537-2-git-send-email-leitao@debian.org>

On 10/23/2018 01:23 PM, Breno Leitao wrote:
> Current core-pkey selftest fails if the test runs without privileges to
> write into the core pattern file (/proc/sys/kernel/core_pattern). This
> causes the test to fail and give the impression that the subsystem being
> tested is broken, when, in fact, the test is being executed without the
> proper privileges. This is the current error:
> 
> 	test: core_pkey
> 	tags: git_version:v4.19-3-g9e3363be9bce-dirty
> 	Error writing to core_pattern file: Permission denied
> 	failure: core_pkey
> 
> This patch simply skips this test if it runs without the proper privileges,
> avoiding this undesired failure.
> 
> CC: Thiago Jung Bauermann <bauerman@linux.ibm.com>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
>  tools/testing/selftests/powerpc/ptrace/core-pkey.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/testing/selftests/powerpc/ptrace/core-pkey.c b/tools/testing/selftests/powerpc/ptrace/core-pkey.c
> index e23e2e199eb4..e07949120fc8 100644
> --- a/tools/testing/selftests/powerpc/ptrace/core-pkey.c
> +++ b/tools/testing/selftests/powerpc/ptrace/core-pkey.c
> @@ -352,17 +352,11 @@ static int write_core_pattern(const char *core_pattern)
>  	FILE *f;
> 
>  	f = fopen(core_pattern_file, "w");
> -	if (!f) {
> -		perror("Error writing to core_pattern file");
> -		return TEST_FAIL;
> -	}
> +	SKIP_IF(!f);
> 
>  	ret = fwrite(core_pattern, 1, len, f);
>  	fclose(f);
> -	if (ret != len) {
> -		perror("Error writing to core_pattern file");
> -		return TEST_FAIL;
> -	}
> +	SKIP_IF(ret != len);

If we don't have proper privileges we should fail on the open, right? So wouldn't we still want to fail on the write if something goes wrong?

-Tyrel

> 
>  	return TEST_PASS;
>  }
> 


  reply	other threads:[~2018-10-23 20:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23 20:23 [PATCH 1/2] selftests/powerpc: Allocate base registers Breno Leitao
2018-10-23 20:23 ` [PATCH 2/2] selftests/powerpc: Skip test instead of failing Breno Leitao
2018-10-23 20:41   ` Tyrel Datwyler [this message]
2018-10-24 14:11     ` Breno Leitao
2018-10-29 22:08       ` Thiago Jung Bauermann
2018-10-30 15:16         ` Michael Ellerman
2018-10-31  0:09           ` Tyrel Datwyler
2018-10-31  9:42             ` Michael Ellerman
2018-10-31  9:41     ` Michael Ellerman
2018-10-23 21:39 ` [PATCH 1/2] selftests/powerpc: Allocate base registers Segher Boessenkool

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=56cdd832-6229-bf95-58ee-1783f931e7bd@linux.vnet.ibm.com \
    --to=tyreld@linux.vnet.ibm.com \
    --cc=bauerman@linux.ibm.com \
    --cc=leitao@debian.org \
    --cc=linuxppc-dev@lists.ozlabs.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.