From: Stanislav Fomichev <stfomichev@gmail.com>
To: Mina Almasry <almasrymina@google.com>
Cc: Stanislav Fomichev <sdf@fomichev.me>,
netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net-next 05/13] selftests: ncdevmem: Unify error handling
Date: Thu, 12 Sep 2024 14:49:29 -0700 [thread overview]
Message-ID: <ZuNh6alWd1U1ZQLY@mini-arch> (raw)
In-Reply-To: <CAHS8izP7MENG+q3y00LbAhzkP9yuLkC6NV3Bs77aQ5nw6YK4AA@mail.gmail.com>
On 09/12, Mina Almasry wrote:
> On Thu, Sep 12, 2024 at 10:13 AM Stanislav Fomichev <sdf@fomichev.me> wrote:
> >
> > There is a bunch of places where error() calls look out of place.
> > Use the same error(1, errno, ...) pattern everywhere.
> >
> > Cc: Mina Almasry <almasrymina@google.com>
> > Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
> > ---
> > tools/testing/selftests/net/ncdevmem.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/tools/testing/selftests/net/ncdevmem.c b/tools/testing/selftests/net/ncdevmem.c
> > index a20f40adfde8..c0da2b2e077f 100644
> > --- a/tools/testing/selftests/net/ncdevmem.c
> > +++ b/tools/testing/selftests/net/ncdevmem.c
> > @@ -332,32 +332,32 @@ int do_server(struct memory_buffer *mem)
> >
> > ret = inet_pton(server_sin.sin_family, server_ip, &server_sin.sin_addr);
> > if (socket < 0)
> > - error(79, 0, "%s: [FAIL, create socket]\n", TEST_PREFIX);
> > + error(1, 0, "%s: [FAIL, create socket]\n", TEST_PREFIX);
> >
> > socket_fd = socket(server_sin.sin_family, SOCK_STREAM, 0);
> > if (socket < 0)
> > - error(errno, errno, "%s: [FAIL, create socket]\n", TEST_PREFIX);
> > + error(1, errno, "%s: [FAIL, create socket]\n", TEST_PREFIX);
> >
>
> To be honest this was a bit intentional. For example here, I want to
> see what errno socket() failed with; it's a clue to why it failed.
>
> I guess you're not actually removing that, right? You're making the
> return code of ncdevmem 1, but it will still print the errno of the
> subfailure? That sounds fine.
>
> Isn't it a bit more standard for the sub errno to be the return of the
> parent process. But not opposed. If you think this is better we can go
> for it.
Yes, this will still print the correct errno.
next prev parent reply other threads:[~2024-09-12 21:49 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 17:12 [PATCH net-next 00/13] selftests: ncdevmem: Add ncdevmem to ksft Stanislav Fomichev
2024-09-12 17:12 ` [PATCH net-next 01/13] selftests: ncdevmem: Add a flag for the selftest Stanislav Fomichev
2024-09-12 20:36 ` Mina Almasry
2024-09-12 21:59 ` Stanislav Fomichev
2024-09-12 17:12 ` [PATCH net-next 02/13] selftests: ncdevmem: Remove validation Stanislav Fomichev
2024-09-12 20:36 ` Mina Almasry
2024-09-12 21:57 ` Stanislav Fomichev
2024-09-13 15:30 ` Mina Almasry
2024-09-13 17:15 ` Stanislav Fomichev
2024-09-13 23:42 ` Mina Almasry
2024-09-12 17:12 ` [PATCH net-next 03/13] selftests: ncdevmem: Redirect all non-payload output to stderr Stanislav Fomichev
2024-09-12 17:12 ` [PATCH net-next 04/13] selftests: ncdevmem: Separate out dmabuf provider Stanislav Fomichev
2024-09-12 20:36 ` Mina Almasry
2024-09-12 17:12 ` [PATCH net-next 05/13] selftests: ncdevmem: Unify error handling Stanislav Fomichev
2024-09-12 20:35 ` Mina Almasry
2024-09-12 21:49 ` Stanislav Fomichev [this message]
2024-09-12 17:12 ` [PATCH net-next 06/13] selftests: ncdevmem: Remove client_ip Stanislav Fomichev
2024-09-12 20:35 ` Mina Almasry
2024-09-12 21:48 ` Stanislav Fomichev
2024-09-12 17:12 ` [PATCH net-next 07/13] selftests: ncdevmem: Remove default arguments Stanislav Fomichev
2024-09-12 17:12 ` [PATCH net-next 08/13] selftests: ncdevmem: Switch to AF_INET6 Stanislav Fomichev
2024-09-12 17:12 ` [PATCH net-next 09/13] selftests: ncdevmem: Properly reset flow steering Stanislav Fomichev
2024-09-12 17:12 ` [PATCH net-next 10/13] selftests: ncdevmem: Use YNL to enable TCP header split Stanislav Fomichev
2024-09-14 13:14 ` kernel test robot
2024-09-12 17:12 ` [PATCH net-next 11/13] selftests: ncdevmem: Remove hard-coded queue numbers Stanislav Fomichev
2024-09-12 20:34 ` Mina Almasry
2024-09-12 21:47 ` Stanislav Fomichev
2024-09-26 16:26 ` Mina Almasry
2024-09-27 1:20 ` Stanislav Fomichev
2024-09-12 17:12 ` [PATCH net-next 12/13] selftests: ncdevmem: Move ncdevmem under drivers/net Stanislav Fomichev
2024-09-13 15:38 ` Mina Almasry
2024-09-13 17:19 ` Stanislav Fomichev
2024-09-12 17:12 ` [PATCH net-next 13/13] selftests: ncdevmem: Add automated test Stanislav Fomichev
2024-09-12 20:34 ` Mina Almasry
2024-09-12 19:48 ` [PATCH net-next 00/13] selftests: ncdevmem: Add ncdevmem to ksft Stanislav Fomichev
2024-09-12 21:07 ` Mina Almasry
2024-09-12 21:43 ` Stanislav Fomichev
2024-12-13 1:18 ` Stanislav Fomichev
2024-12-13 17:47 ` Mina Almasry
2024-12-13 18:53 ` Stanislav Fomichev
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=ZuNh6alWd1U1ZQLY@mini-arch \
--to=stfomichev@gmail.com \
--cc=almasrymina@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).