* [PATCH] selftests: net: rds: fix module not found
@ 2024-10-08 8:22 Alessandro Zanni
2024-10-10 2:40 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Alessandro Zanni @ 2024-10-08 8:22 UTC (permalink / raw)
To: allison.henderson, davem, edumazet, kuba, pabeni, shuah
Cc: Alessandro Zanni, netdev, linux-rdma, linux-kselftest,
linux-kernel, skhan, anupnewsmail
This fix solves this error, when calling kselftest with targets "net/rds":
selftests: net/rds: test.py
Traceback (most recent call last):
File "tools/testing/selftests/net/rds/./test.py", line 17, in <module>
from lib.py import ip
ModuleNotFoundError: No module named 'lib'
Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
---
tools/testing/selftests/net/rds/test.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/rds/test.py b/tools/testing/selftests/net/rds/test.py
index e6bb109bcead..112a8059c030 100755
--- a/tools/testing/selftests/net/rds/test.py
+++ b/tools/testing/selftests/net/rds/test.py
@@ -14,8 +14,9 @@ import sys
import atexit
from pwd import getpwuid
from os import stat
-from lib.py import ip
+sys.path.append("..")
+from lib.py.utils import ip
libc = ctypes.cdll.LoadLibrary('libc.so.6')
setns = libc.setns
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] selftests: net: rds: fix module not found
2024-10-08 8:22 [PATCH] selftests: net: rds: fix module not found Alessandro Zanni
@ 2024-10-10 2:40 ` Jakub Kicinski
2024-10-10 19:11 ` Alessandro Zanni
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2024-10-10 2:40 UTC (permalink / raw)
To: Alessandro Zanni
Cc: allison.henderson, davem, edumazet, pabeni, shuah, netdev,
linux-rdma, linux-kselftest, linux-kernel, skhan, anupnewsmail
On Tue, 8 Oct 2024 10:22:53 +0200 Alessandro Zanni wrote:
> This fix solves this error, when calling kselftest with targets "net/rds":
>
> selftests: net/rds: test.py
> Traceback (most recent call last):
> File "tools/testing/selftests/net/rds/./test.py", line 17, in <module>
> from lib.py import ip
> ModuleNotFoundError: No module named 'lib'
>
> Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
> ---
> tools/testing/selftests/net/rds/test.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/rds/test.py b/tools/testing/selftests/net/rds/test.py
> index e6bb109bcead..112a8059c030 100755
> --- a/tools/testing/selftests/net/rds/test.py
> +++ b/tools/testing/selftests/net/rds/test.py
> @@ -14,8 +14,9 @@ import sys
> import atexit
> from pwd import getpwuid
> from os import stat
> -from lib.py import ip
>
> +sys.path.append("..")
> +from lib.py.utils import ip
>
> libc = ctypes.cdll.LoadLibrary('libc.so.6')
> setns = libc.setns
Does this work regardless of where we try to run the script from?
In other cross-imports we try to build the path based on __file__,
see: tools/testing/selftests/drivers/net/lib/py/__init__.py
Would be good to keep consistency.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] selftests: net: rds: fix module not found
2024-10-10 2:40 ` Jakub Kicinski
@ 2024-10-10 19:11 ` Alessandro Zanni
0 siblings, 0 replies; 3+ messages in thread
From: Alessandro Zanni @ 2024-10-10 19:11 UTC (permalink / raw)
To: Jakub Kicinski
Cc: allison.henderson, davem, edumazet, pabeni, shuah, netdev,
linux-rdma, linux-kselftest, linux-kernel, skhan, anupnewsmail
On 24/10/09 07:40, Jakub Kicinski wrote:
> On Tue, 8 Oct 2024 10:22:53 +0200 Alessandro Zanni wrote:
> > This fix solves this error, when calling kselftest with targets "net/rds":
> >
> > selftests: net/rds: test.py
> > Traceback (most recent call last):
> > File "tools/testing/selftests/net/rds/./test.py", line 17, in <module>
> > from lib.py import ip
> > ModuleNotFoundError: No module named 'lib'
> >
> > Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
> > ---
> > tools/testing/selftests/net/rds/test.py | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/net/rds/test.py b/tools/testing/selftests/net/rds/test.py
> > index e6bb109bcead..112a8059c030 100755
> > --- a/tools/testing/selftests/net/rds/test.py
> > +++ b/tools/testing/selftests/net/rds/test.py
> > @@ -14,8 +14,9 @@ import sys
> > import atexit
> > from pwd import getpwuid
> > from os import stat
> > -from lib.py import ip
> >
> > +sys.path.append("..")
> > +from lib.py.utils import ip
> >
> > libc = ctypes.cdll.LoadLibrary('libc.so.6')
> > setns = libc.setns
>
> Does this work regardless of where we try to run the script from?
> In other cross-imports we try to build the path based on __file__,
> see: tools/testing/selftests/drivers/net/lib/py/__init__.py
Yes, it works regardeless where we run the script from but I agree
with you to keep the same style used in other files.
Thanks for pointing out.
> Would be good to keep consistency.
Definitely. I'm sending a v2 patch with this in mind.
> --
> pw-bot: cr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-10 19:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08 8:22 [PATCH] selftests: net: rds: fix module not found Alessandro Zanni
2024-10-10 2:40 ` Jakub Kicinski
2024-10-10 19:11 ` Alessandro Zanni
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).