diff options
author | jadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4> | 2008-05-14 20:31:12 +0000 |
---|---|---|
committer | jadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4> | 2008-05-14 20:31:12 +0000 |
commit | 0b24062e596c3e08eb8eb1edcc85dd43e9e43dbe (patch) | |
tree | 8304d029a746864dde24386782a7ad31515a5ee0 | |
parent | 039e22b5c95d1e6c301021fa5258ab849012fd2d (diff) |
Risk: Medium
Visibility: Should remove a case where "real" errors get masked by
an accidental double-call of parser.end().
This change changes the parser.end() call to explicitly catch a
StopIteration error and keep going with a warning, rather than just
letting the exception propagate up. This can only happen if end() is
called multiple times, which is an error but not a serious enough one
to warrant a process-ending exception.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@1514 592f7852-d20e-0410-864c-8624ca9c26a4
-rw-r--r-- | tko/parsers/base.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tko/parsers/base.py b/tko/parsers/base.py index ee798d01..fe5ec5e4 100644 --- a/tko/parsers/base.py +++ b/tko/parsers/base.py @@ -1,4 +1,6 @@ -from autotest_lib.tko import status_lib +import traceback + +from autotest_lib.tko import status_lib, utils as tko_utils class parser(object): @@ -33,7 +35,14 @@ class parser(object): self.line_buffer.put_multiple(lines) # run the state machine to clear out the buffer self.finished = True - return self.state.next() + try: + return self.state.next() + except StopIteration: + msg = ("WARNING: parser was end()ed multiple times\n" + "Current traceback:\n" + + traceback.format_exc()) + tko_utils.dprint(msg) + return [] @staticmethod |