diff mbox series

[rteval] rteval: cyclictest.py: Fix config check

Message ID 20210728.202110.2259637121232602746.atsushi.nemoto@sord.co.jp
State New
Headers show
Series [rteval] rteval: cyclictest.py: Fix config check | expand

Commit Message

Atsushi Nemoto July 28, 2021, 11:21 a.m. UTC
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(-)

Comments

Atsushi Nemoto July 29, 2021, 1:55 a.m. UTC | #1
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
diff mbox series

Patch

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