From 14e294ca6ad3722b77d88d22eff3e9c268c1cccc Mon Sep 17 00:00:00 2001 From: Vallari Agrawal Date: Mon, 20 Jun 2022 14:53:15 +0530 Subject: [PATCH] orch/run: seek to EOF after each scan Signed-off-by: Vallari Agrawal --- teuthology/orchestra/run.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/teuthology/orchestra/run.py b/teuthology/orchestra/run.py index 196c093afb..7b9c05ca23 100644 --- a/teuthology/orchestra/run.py +++ b/teuthology/orchestra/run.py @@ -245,25 +245,31 @@ class ErrorScanner(object): return None, None ERROR_PATTERN = { - "nose": r"ERROR:\s", + "prev_error": r"UnitTestError", + "nose": r"ERROR: \s", "gtest": r"\[\s\sFAILED\s\s\]", } error_test = None error_msg = None + log.debug("__flag__ pointer at: {}".format(ErrorScanner.__flag__)) f = open(logfile, 'r') - f.seek(ErrorScanner.__flag__ + 1) - while f: - line = f.readline() + f.seek(ErrorScanner.__flag__) + + for line in f: for test in self.test_names: pattern = ERROR_PATTERN[test] error = re.search(pattern, line) if error: - error_test = test - error_msg = line[error.start():].strip() - break + is_old_error = re.search(ERROR_PATTERN['prev_error'], line) + if not is_old_error: + error_test = test + error_msg = line[error.start():].strip() + break if error_msg: break + + f.seek(0, 2) # seek to EOF ErrorScanner.__flag__ = f.tell() f.close() return error_test, error_msg -- 2.39.5