aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorBreno Leitao <leitao@debian.org>2018-10-31 11:38:22 -0300
committerMichael Ellerman <mpe@ellerman.id.au>2018-11-25 17:11:22 +1100
commiteafcd8e3fbad4f426a40ed2b6a8c697c3a4ef36a (patch)
tree19b94344fea99d8ad150cb0d0d11d357d97ce74e /tools/testing/selftests
parentselftests/powerpc: Create a new SKIP_IF macro (diff)
downloadlinux-dev-eafcd8e3fbad4f426a40ed2b6a8c697c3a4ef36a.tar.xz
linux-dev-eafcd8e3fbad4f426a40ed2b6a8c697c3a4ef36a.zip
selftests/powerpc: Skip test instead of failing
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: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> CC: Thiago Jung Bauermann <bauerman@linux.ibm.com> Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'tools/testing/selftests')
-rw-r--r--tools/testing/selftests/powerpc/ptrace/core-pkey.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/tools/testing/selftests/powerpc/ptrace/core-pkey.c b/tools/testing/selftests/powerpc/ptrace/core-pkey.c
index e23e2e199eb4..d5c64fee032d 100644
--- a/tools/testing/selftests/powerpc/ptrace/core-pkey.c
+++ b/tools/testing/selftests/powerpc/ptrace/core-pkey.c
@@ -352,10 +352,7 @@ 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_MSG(!f, "Try with root privileges");
ret = fwrite(core_pattern, 1, len, f);
fclose(f);