summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-03-14 15:09:00 +1100
committerChris Johns <chrisj@rtems.org>2016-03-14 15:09:00 +1100
commit3e9b17994afb78da6bd26c0585dc239bea354ec8 (patch)
tree4e6cf4f29c7c8e11be1124f5b9c95fb9b9155d02
parentPython 2 and python 3 refactor fixes. (diff)
downloadrtems-tools-3e9b17994afb78da6bd26c0585dc239bea354ec8.tar.bz2
rtemstoolkit: Fix execute's writer thread to not eval() the input.
The conversion to Python3 added an eval() call which is wrong. Fix the spelling in execute. Fix labels in the tester gdb locking. Check the debug-trace arguments. Close #2642.
-rwxr-xr-xrtemstoolkit/execute.py14
-rw-r--r--tester/rt/gdb.py4
-rw-r--r--tester/rt/report.py4
-rw-r--r--tester/rt/test.py5
4 files changed, 15 insertions, 12 deletions
diff --git a/rtemstoolkit/execute.py b/rtemstoolkit/execute.py
index 0dc9d4c..d89e0e4 100755
--- a/rtemstoolkit/execute.py
+++ b/rtemstoolkit/execute.py
@@ -138,10 +138,10 @@ class execute(object):
block and return None or False if this thread is to exit and True if this
is a timeout check."""
if trace_threads:
- print('executte:_writethread: start')
+ print('execute:_writethread: start')
try:
while True:
- lines = eval(input())
+ lines = input()
if type(lines) == str:
try:
fh.write(bytes(lines, sys.stdin.encoding))
@@ -153,14 +153,14 @@ class execute(object):
break
except:
if trace_threads:
- print('executte:_writethread: exception')
+ print('execute:_writethread: exception')
pass
try:
fh.close()
except:
pass
if trace_threads:
- print('executte:_writethread: finished')
+ print('execute:_writethread: finished')
def _readthread(exe, fh, out, prefix = ''):
"""Read from a file handle and write to the output handler
@@ -177,7 +177,7 @@ class execute(object):
log.flush()
if trace_threads:
- print('executte:_readthread: start')
+ print('execute:_readthread: start')
count = 0
line = ''
try:
@@ -199,7 +199,7 @@ class execute(object):
except:
raise
if trace_threads:
- print('executte:_readthread: exception')
+ print('execute:_readthread: exception')
pass
try:
fh.close()
@@ -208,7 +208,7 @@ class execute(object):
if len(line):
_output_line(line, exe, prefix, out, 100)
if trace_threads:
- print('executte:_readthread: finished')
+ print('execute:_readthread: finished')
def _timerthread(exe, interval, function):
"""Timer thread is used to timeout a process if no output is
diff --git a/tester/rt/gdb.py b/tester/rt/gdb.py
index c054422..6e56d36 100644
--- a/tester/rt/gdb.py
+++ b/tester/rt/gdb.py
@@ -138,12 +138,12 @@ class gdb(object):
def _writer(self):
try:
try:
- self._lock('_open')
+ self._lock('_writer')
try:
if self.process is None:
return None
finally:
- self._unlock('_open')
+ self._unlock('_writer')
line = self.input.get(timeout = 0.5)
if self.trace:
print('>>> input: queue=%d' % (self.input.qsize()), line)
diff --git a/tester/rt/report.py b/tester/rt/report.py
index 1aa1f35..ee282a5 100644
--- a/tester/rt/report.py
+++ b/tester/rt/report.py
@@ -145,6 +145,7 @@ class report(object):
if name not in self.results:
self.lock.release()
raise error.general('test report missing: %s' % (name))
+ exe = path.basename(self.results[name]['exe'])
result = self.results[name]['result']
time = self.results[name]['end'] - self.results[name]['start']
if mode != 'none':
@@ -158,8 +159,7 @@ class report(object):
log.output(header)
if output:
log.output(output)
- if header:
- log.output('Result: %-10s Time: %s' % (result, str(time)))
+ log.output('Result: %-10s Time: %s %s' % (result, str(time), exe))
def summary(self):
def show_state(results, state, max_len):
diff --git a/tester/rt/test.py b/tester/rt/test.py
index 72b5fea..b886491 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -217,7 +217,10 @@ def run(command_path = None):
opts.log_info()
debug_trace = opts.find_arg('--debug-trace')
if debug_trace:
- debug_trace = debug_trace[1]
+ if len(debug_trace) != 1:
+ debug_trace = debug_trace[1]
+ else:
+ raise error.general('no debug flags, can be: console,gdb,output')
else:
debug_trace = ''
opts.defaults['debug_trace'] = debug_trace