summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4>2008-05-15 17:56:37 +0000
committerjadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4>2008-05-15 17:56:37 +0000
commit2775c80ab3904fccd48e2e1e55fe598bdf9e5f6f (patch)
tree0bf098796bd049772c2058f3bd9497f10946ed4b
parentc0cdb7db5553f811d1b33625e2748f1d9fca891d (diff)
Risk: Low
Visibility: Should eliminate a case where a continuous parsing bug would fail an entire job. This fixes up parser.process_lines to catch StopIteration in the same way that end does. Code calling it and getting this exception is buggy, but it's better for the code to log the message can keep going without continuous parsing, rather than actually failing the job. It also adds some extra debugging info to both the process_lines and end handlers, printing out the current call stack as well as the exception traceback, since it's useful to see where the (bad) call is coming from and not just where the exception is coming from. Signed-off-by: John Admanski <jadmanski@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@1518 592f7852-d20e-0410-864c-8624ca9c26a4
-rw-r--r--tko/parsers/base.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/tko/parsers/base.py b/tko/parsers/base.py
index fe5ec5e4..c0517a8b 100644
--- a/tko/parsers/base.py
+++ b/tko/parsers/base.py
@@ -25,7 +25,17 @@ class parser(object):
""" Feed 'lines' into the parser state machine, and return
a list of all the new test results produced."""
self.line_buffer.put_multiple(lines)
- return self.state.next()
+ try:
+ return self.state.next()
+ except StopIteration:
+ msg = ("WARNING: parser was called to process status "
+ "lines after it was end()ed\n"
+ "Current traceback:\n" +
+ traceback.format_exc() +
+ "\nCurrent stack:\n" +
+ "".join(traceback.format_stack()))
+ tko_utils.dprint(msg)
+ return []
def end(self, lines=[]):
@@ -40,7 +50,9 @@ class parser(object):
except StopIteration:
msg = ("WARNING: parser was end()ed multiple times\n"
"Current traceback:\n" +
- traceback.format_exc())
+ traceback.format_exc() +
+ "\nCurrent stack:\n" +
+ "".join(traceback.format_stack()))
tko_utils.dprint(msg)
return []