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

Unified Diff: tko/parsers/version_0.py

Issue 3885001: Change Autotest status parser from fail-hard to fail-safe. (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: Created 10 years, 2 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 | « no previous file | tko/parsers/version_0_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tko/parsers/version_0.py
diff --git a/tko/parsers/version_0.py b/tko/parsers/version_0.py
index 3341c228eaddc650ba9588e728261bc1dc162077..c568e8f6dbc878d25e724652411cd214fcf08424 100644
--- a/tko/parsers/version_0.py
+++ b/tko/parsers/version_0.py
@@ -253,18 +253,25 @@ class status_line(object):
return None
indent, line = re.search(r"^(\t*)(.*)$", line, flags=re.DOTALL).groups()
indent = len(indent)
- line = line.strip()
# split the line into the fixed and optional fields
- parts = line.split("\t")
- status, subdir, testname = parts[0:3]
- reason = parts[-1]
- optional_parts = parts[3:-1]
-
- # all the optional parts should be of the form "key=value"
- assert sum('=' not in part for part in optional_parts) == 0
- optional_fields = dict(part.split("=", 1)
- for part in optional_parts)
+ parts = line.rstrip("\n").split("\t")
+
+ part_index = 3
+ status, subdir, testname = parts[0:part_index]
+
+ # all optional parts should be of the form "key=value". once we've found
+ # a non-matching part, treat it and the rest of the parts as the reason.
+ optional_fields = {}
+ while part_index < len(parts):
+ kv = re.search(r"^(\w+)=(.+)", parts[part_index])
+ if not kv:
+ break
+
+ optional_fields[kv.group(1)] = kv.group(2)
+ part_index += 1
+
+ reason = "\t".join(parts[part_index:])
# build up a new status_line and return it
return cls(indent, status, subdir, testname, reason,
« no previous file with comments | « no previous file | tko/parsers/version_0_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698