* [PATCH] selftests/x86/ioperm: Fail the test when the child fails
@ 2026-12-01 18:08 Sasha Levin
0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2026-12-01 18:08 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86
Cc: Sasha Levin, H. Peter Anvin, Andy Lutomirski, Shuah Khan,
linux-kselftest, linux-kernel, Nathan Chancellor, llvm
main() counts a child that died or exited with an error in nerrs, but
nothing reads nerrs, so a failed child does not fail the test. clang 23
points that out:
ioperm.c:25:12: warning: variable 'nerrs' set but not used [-Wunused-but-set-global]
Return 1 when nerrs is set, like the other x86 selftests do.
Fixes: 0eb1d0fa6a68 ("selftests/x86: Add a basic selftest for ioperm")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/testing/selftests/x86/ioperm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/x86/ioperm.c b/tools/testing/selftests/x86/ioperm.c
index 69d5fb7050c25..6c36e316de956 100644
--- a/tools/testing/selftests/x86/ioperm.c
+++ b/tools/testing/selftests/x86/ioperm.c
@@ -144,7 +144,7 @@ int main(void)
printf("\tDrop privileges\n");
if (setresuid(1, 1, 1) != 0) {
printf("[WARN]\tDropping privileges failed\n");
- return 0;
+ return nerrs ? 1 : 0;
}
printf("[RUN]\tdisable 0x80\n");
@@ -160,5 +160,5 @@ int main(void)
return 1;
}
printf("[OK]\tit failed\n");
- return 0;
+ return nerrs ? 1 : 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-01 18:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 18:08 [PATCH] selftests/x86/ioperm: Fail the test when the child fails Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox