netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: drivers: net: fix name not defined
@ 2024-10-08 22:01 Alessandro Zanni
  2024-10-10  2:32 ` Jakub Kicinski
  2024-10-10  7:40 ` Petr Machata
  0 siblings, 2 replies; 4+ messages in thread
From: Alessandro Zanni @ 2024-10-08 22:01 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, shuah, petrm, dw, martin.lau
  Cc: Alessandro Zanni, netdev, linux-kselftest, linux-kernel, skhan,
	anupnewsmail

This fix solves this error, when calling kselftest with targets "drivers/net":

File "tools/testing/selftests/net/lib/py/nsim.py", line 64, in __init__
  if e.errno == errno.ENOSPC:
NameError: name 'errno' is not defined

The module errno makes available standard error system symbols.

Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
---
 tools/testing/selftests/net/lib/py/nsim.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/net/lib/py/nsim.py b/tools/testing/selftests/net/lib/py/nsim.py
index f571a8b3139b..1a8cbe9acc48 100644
--- a/tools/testing/selftests/net/lib/py/nsim.py
+++ b/tools/testing/selftests/net/lib/py/nsim.py
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
+import errno
 import json
 import os
 import random
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests: drivers: net: fix name not defined
  2024-10-08 22:01 [PATCH] selftests: drivers: net: fix name not defined Alessandro Zanni
@ 2024-10-10  2:32 ` Jakub Kicinski
  2024-10-10 17:11   ` Alessandro Zanni
  2024-10-10  7:40 ` Petr Machata
  1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2024-10-10  2:32 UTC (permalink / raw)
  To: Alessandro Zanni
  Cc: davem, edumazet, pabeni, shuah, petrm, dw, martin.lau, netdev,
	linux-kselftest, linux-kernel, skhan, anupnewsmail

On Wed,  9 Oct 2024 00:01:33 +0200 Alessandro Zanni wrote:
> This fix solves this error, when calling kselftest with targets "drivers/net":
> 
> File "tools/testing/selftests/net/lib/py/nsim.py", line 64, in __init__
>   if e.errno == errno.ENOSPC:
> NameError: name 'errno' is not defined
> 
> The module errno makes available standard error system symbols.

Can you say more about how you hit this error?

If it's just based on static analysis please mention that in the commit
message, and also mention that the problem doesn't happen in practice.
This will avoid the patch being backported unnecessarily.

We run all the tests in our CI, and the problem is not hit. But I agree
with you that the import is theoretically missing.
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests: drivers: net: fix name not defined
  2024-10-08 22:01 [PATCH] selftests: drivers: net: fix name not defined Alessandro Zanni
  2024-10-10  2:32 ` Jakub Kicinski
@ 2024-10-10  7:40 ` Petr Machata
  1 sibling, 0 replies; 4+ messages in thread
From: Petr Machata @ 2024-10-10  7:40 UTC (permalink / raw)
  To: Alessandro Zanni
  Cc: davem, edumazet, kuba, pabeni, shuah, petrm, dw, martin.lau,
	netdev, linux-kselftest, linux-kernel, skhan, anupnewsmail


Alessandro Zanni <alessandro.zanni87@gmail.com> writes:

> This fix solves this error, when calling kselftest with targets "drivers/net":
>
> File "tools/testing/selftests/net/lib/py/nsim.py", line 64, in __init__
>   if e.errno == errno.ENOSPC:
> NameError: name 'errno' is not defined
>
> The module errno makes available standard error system symbols.
>
> Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>

Reviewed-by: Petr Machata <petrm@nvidia.com>

Insert a yo-dawg meme about testing the tests here.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests: drivers: net: fix name not defined
  2024-10-10  2:32 ` Jakub Kicinski
@ 2024-10-10 17:11   ` Alessandro Zanni
  0 siblings, 0 replies; 4+ messages in thread
From: Alessandro Zanni @ 2024-10-10 17:11 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, edumazet, pabeni, shuah, petrm, dw, martin.lau, netdev,
	linux-kselftest, linux-kernel, skhan, anupnewsmail

On 24/10/09 07:32, Jakub Kicinski wrote:
> On Wed,  9 Oct 2024 00:01:33 +0200 Alessandro Zanni wrote:
> > This fix solves this error, when calling kselftest with targets "drivers/net":
> > 
> > File "tools/testing/selftests/net/lib/py/nsim.py", line 64, in __init__
> >   if e.errno == errno.ENOSPC:
> > NameError: name 'errno' is not defined
> > 
> > The module errno makes available standard error system symbols.
> 
> Can you say more about how you hit this error?
> 
> If it's just based on static analysis please mention that in the commit
> message, and also mention that the problem doesn't happen in practice.
> This will avoid the patch being backported unnecessarily.

I didn't use static analysis tool. I've run the test manually.
I got the error from executing:
make --silent kselftest TARGETS="drivers/net"

Thanks for pointing out, I'll prepare a v2 patch with the command used.

> We run all the tests in our CI, and the problem is not hit. But I agree
> with you that the import is theoretically missing.

When I ran the test, the function ctrl_write() raised an OSError. So, 
in my case, it was also a practical error.

> -- 
> pw-bot: cr

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-10 17:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08 22:01 [PATCH] selftests: drivers: net: fix name not defined Alessandro Zanni
2024-10-10  2:32 ` Jakub Kicinski
2024-10-10 17:11   ` Alessandro Zanni
2024-10-10  7:40 ` Petr Machata

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).