Re: [rteval PATCH] rteval: cyclictest.py: Fix config check
From: chensong_2000@189.cn <hidden>
Date: 2021-07-29 01:51:30
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 写道:
quoted hunk ↗ jump to hunk
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 <redacted> --- 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")