* [PATCH net-next] selftests: net: socket: fix inverted failure diagnostic
@ 2026-11-20 0:51 Omokefe Emmanuel Onanaroghene
2026-11-28 15:17 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Omokefe Emmanuel Onanaroghene @ 2026-11-20 0:51 UTC (permalink / raw)
To: netdev, linux-kselftest
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, linux-kernel, skhan,
Omokefe Emmanuel Onanaroghene
When socket() succeeds but the test case expected failure, the error
branch prints "expected success got err" with strerror(errno), both
backwards (reality is "expected err, got success") and stale (errno is
meaningless after a successful call). Mirror the sibling fd<0 branch:
name the expected errno via strerror(-s->expect).
Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
---
tools/testing/selftests/net/socket.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/socket.c b/tools/testing/selftests/net/socket.c
index 9e270548dad80..7f075acc0b19c 100644
--- a/tools/testing/selftests/net/socket.c
+++ b/tools/testing/selftests/net/socket.c
@@ -71,10 +71,11 @@ static int run_tests(void)
close(fd);
if (s->expect < 0) {
- msg1 = strerror_r(errno, err_string1, ERR_STRING_SZ);
+ msg1 = strerror_r(-s->expect, err_string1,
+ ERR_STRING_SZ);
fprintf(stderr, "socket(%d, %d, %d) expected "
- "success got err (%s)\n",
+ "err (%s) got success\n",
s->domain, s->type, s->protocol,
msg1);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net-next] selftests: net: socket: fix inverted failure diagnostic
2026-11-20 0:51 [PATCH net-next] selftests: net: socket: fix inverted failure diagnostic Omokefe Emmanuel Onanaroghene
@ 2026-11-28 15:17 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2026-11-28 15:17 UTC (permalink / raw)
To: Omokefe Emmanuel Onanaroghene
Cc: netdev, linux-kselftest, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Shuah Khan, linux-kernel, skhan
On Fri, Nov 20, 2026 at 01:51:02AM +0100, Omokefe Emmanuel Onanaroghene wrote:
> When socket() succeeds but the test case expected failure, the error
> branch prints "expected success got err" with strerror(errno), both
> backwards (reality is "expected err, got success") and stale (errno is
> meaningless after a successful call). Mirror the sibling fd<0 branch:
> name the expected errno via strerror(-s->expect).
>
> Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-28 15:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 0:51 [PATCH net-next] selftests: net: socket: fix inverted failure diagnostic Omokefe Emmanuel Onanaroghene
2026-11-28 15:17 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox