Index: client/common_lib/log.py |
diff --git a/client/common_lib/log.py b/client/common_lib/log.py |
index 4af1d3f1bb803ab21f45f6de0c2935eb5c736e72..a54ad2dd7caa638d54ff874c674a5c8dc8182410 100644 |
--- a/client/common_lib/log.py |
+++ b/client/common_lib/log.py |
@@ -1,17 +1,29 @@ |
import sys, re, traceback |
- |
+# these statuses are ordered such that a status earlier in the list will |
+# override a status later in a list (e.g. ERROR during a test will override |
+# prior GOOD results, but WARN will not override a FAIL) |
job_statuses = ["TEST_NA", "ABORT", "ERROR", "FAIL", "WARN", "GOOD", "ALERT", |
"RUNNING", "NOSTATUS"] |
def is_valid_status(status): |
- if not re.match(r'(START|INFO|(END )?('+'|'.join(job_statuses)+'))$', |
+ if not re.match(r'(START|INFO|(END )?(' + '|'.join(job_statuses) + '))$', |
status): |
return False |
else: |
return True |
+def is_failure(status): |
+ if not is_valid_status(status): |
+ return False |
+ if status in ('START', 'INFO'): |
+ return False |
+ if status.startswith('END '): |
+ status = status[len('END '):] |
+ return job_statuses.index(status) <= job_statuses.index("FAIL") |
+ |
+ |
def record(fn): |
""" |
Generic method decorator for logging calls under the |