linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [rteval PATCH] rteval: cyclictest.py: Fix config check
@ 2021-07-28 11:21 Atsushi Nemoto
  2021-07-29  1:41 ` chensong_2000
  0 siblings, 1 reply; 4+ messages in thread
From: Atsushi Nemoto @ 2021-07-28 11:21 UTC (permalink / raw)
  To: linux-rt-users, John Kacur

The self.__cfg itself is not a dictionary and "key in self.__cfg"
does not work as expected.
Use "key in self.__cfg.keys()" instead.

This bug was introduced by the commit fd3b732f714d ("rteval: 2to3
transformations")

Signed-off-by: Atsushi Nemoto <atsushi.nemoto@sord.co.jp>
---
 rteval/modules/measurement/cyclictest.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py
index b1755d4..8957dcb 100644
--- a/rteval/modules/measurement/cyclictest.py
+++ b/rteval/modules/measurement/cyclictest.py
@@ -265,7 +265,7 @@ class Cyclictest(rtevalModulePrototype):
 
 
     def _WorkloadPrepare(self):
-        self.__interval = 'interval' in self.__cfg and '-i%d' % int(self.__cfg.interval) or ""
+        self.__interval = 'interval' in self.__cfg.keys() and '-i%d' % int(self.__cfg.interval) or ""
 
         self.__cmd = ['cyclictest',
                       self.__interval,
@@ -280,10 +280,10 @@ class Cyclictest(rtevalModulePrototype):
             self.__cmd.append('-t')
             self.__cmd.append('-a')
 
-        if 'threads' in self.__cfg and self.__cfg.threads:
+        if 'threads' in self.__cfg.keys() and self.__cfg.threads:
             self.__cmd.append("-t%d" % int(self.__cfg.threads))
 
-        if 'breaktrace' in self.__cfg and self.__cfg.breaktrace:
+        if 'breaktrace' in self.__cfg.keys() and self.__cfg.breaktrace:
             self.__cmd.append("-b%d" % int(self.__cfg.breaktrace))
             self.__cmd.append("--tracemark")
 
@@ -300,7 +300,7 @@ class Cyclictest(rtevalModulePrototype):
         self.__nullfp = os.open('/dev/null', os.O_RDWR)
 
         debugdir = self.__get_debugfs_mount()
-        if 'breaktrace' in self.__cfg and self.__cfg.breaktrace and debugdir:
+        if 'breaktrace' in self.__cfg.keys() and self.__cfg.breaktrace and debugdir:
             # Ensure that the trace log is clean
             trace = os.path.join(debugdir, 'tracing', 'trace')
             fp = open(os.path.join(trace), "w")
-- 
2.11.0


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

* Re: [rteval PATCH] rteval: cyclictest.py: Fix config check
  2021-07-28 11:21 [rteval PATCH] rteval: cyclictest.py: Fix config check Atsushi Nemoto
@ 2021-07-29  1:41 ` chensong_2000
  2021-07-29  1:55   ` Atsushi Nemoto
  0 siblings, 1 reply; 4+ messages in thread
From: chensong_2000 @ 2021-07-29  1:41 UTC (permalink / raw)
  To: Atsushi Nemoto, linux-rt-users, John Kacur

Mr. Nemoto,

If i understand it correctly, cyclictest.py is python cyclictest, is it? 
It's interesting and i would like to give it a try.

Could you please let me know where i can clone its code, i failed to 
find it in rt-tests.git.

many thanks.

BR

Song

在 2021/7/28 下午7:21, Atsushi Nemoto 写道:
> The self.__cfg itself is not a dictionary and "key in self.__cfg"
> does not work as expected.
> Use "key in self.__cfg.keys()" instead.
> 
> This bug was introduced by the commit fd3b732f714d ("rteval: 2to3
> transformations")
> 
> Signed-off-by: Atsushi Nemoto <atsushi.nemoto@sord.co.jp>
> ---
>   rteval/modules/measurement/cyclictest.py | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py
> index b1755d4..8957dcb 100644
> --- a/rteval/modules/measurement/cyclictest.py
> +++ b/rteval/modules/measurement/cyclictest.py
> @@ -265,7 +265,7 @@ class Cyclictest(rtevalModulePrototype):
>   
>   
>       def _WorkloadPrepare(self):
> -        self.__interval = 'interval' in self.__cfg and '-i%d' % int(self.__cfg.interval) or ""
> +        self.__interval = 'interval' in self.__cfg.keys() and '-i%d' % int(self.__cfg.interval) or ""
>   
>           self.__cmd = ['cyclictest',
>                         self.__interval,
> @@ -280,10 +280,10 @@ class Cyclictest(rtevalModulePrototype):
>               self.__cmd.append('-t')
>               self.__cmd.append('-a')
>   
> -        if 'threads' in self.__cfg and self.__cfg.threads:
> +        if 'threads' in self.__cfg.keys() and self.__cfg.threads:
>               self.__cmd.append("-t%d" % int(self.__cfg.threads))
>   
> -        if 'breaktrace' in self.__cfg and self.__cfg.breaktrace:
> +        if 'breaktrace' in self.__cfg.keys() and self.__cfg.breaktrace:
>               self.__cmd.append("-b%d" % int(self.__cfg.breaktrace))
>               self.__cmd.append("--tracemark")
>   
> @@ -300,7 +300,7 @@ class Cyclictest(rtevalModulePrototype):
>           self.__nullfp = os.open('/dev/null', os.O_RDWR)
>   
>           debugdir = self.__get_debugfs_mount()
> -        if 'breaktrace' in self.__cfg and self.__cfg.breaktrace and debugdir:
> +        if 'breaktrace' in self.__cfg.keys() and self.__cfg.breaktrace and debugdir:
>               # Ensure that the trace log is clean
>               trace = os.path.join(debugdir, 'tracing', 'trace')
>               fp = open(os.path.join(trace), "w")
> 

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

* Re: [rteval PATCH] rteval: cyclictest.py: Fix config check
  2021-07-29  1:41 ` chensong_2000
@ 2021-07-29  1:55   ` Atsushi Nemoto
  2021-07-29  2:06     ` chensong_2000
  0 siblings, 1 reply; 4+ messages in thread
From: Atsushi Nemoto @ 2021-07-29  1:55 UTC (permalink / raw)
  To: chensong_2000; +Cc: linux-rt-users, jkacur

On Thu, 29 Jul 2021 09:41:09 +0800, "chensong_2000@189.cn" <chensong_2000@189.cn> wrote:
> If i understand it correctly, cyclictest.py is python cyclictest, is it? It's interesting and i would like to give it a try.

No.  It is a part of the rteval tool.

> Could you please let me know where i can clone its code, i failed to find it in rt-tests.git.

https://git.kernel.org/pub/scm/utils/rteval/rteval.git

---
Atsushi Nemoto

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

* Re: [rteval PATCH] rteval: cyclictest.py: Fix config check
  2021-07-29  1:55   ` Atsushi Nemoto
@ 2021-07-29  2:06     ` chensong_2000
  0 siblings, 0 replies; 4+ messages in thread
From: chensong_2000 @ 2021-07-29  2:06 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-rt-users, jkacur

got it, thanks again.

Song

在 2021/7/29 上午9:55, Atsushi Nemoto 写道:
> On Thu, 29 Jul 2021 09:41:09 +0800, "chensong_2000@189.cn" <chensong_2000@189.cn> wrote:
>> If i understand it correctly, cyclictest.py is python cyclictest, is it? It's interesting and i would like to give it a try.
> 
> No.  It is a part of the rteval tool.
> 
>> Could you please let me know where i can clone its code, i failed to find it in rt-tests.git.
> 
> https://git.kernel.org/pub/scm/utils/rteval/rteval.git
> 
> ---
> Atsushi Nemoto
> 

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

end of thread, other threads:[~2021-07-29  2:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 11:21 [rteval PATCH] rteval: cyclictest.py: Fix config check Atsushi Nemoto
2021-07-29  1:41 ` chensong_2000
2021-07-29  1:55   ` Atsushi Nemoto
2021-07-29  2:06     ` chensong_2000

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