Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: client/common_lib/log.py

Issue 3554003: Merge remote branch 'cros/upstream' into tempbranch3 (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/bin/partition.py ('k') | client/common_lib/revision_control.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « client/bin/partition.py ('k') | client/common_lib/revision_control.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698