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

Side by Side Diff: tko/parsers/version_0.py

Issue 3719002: Add support for multi-line status messages. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tko/parsers/version_0_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import re, os 1 import re, os
2 2
3 from autotest_lib.client.common_lib import utils as common_utils 3 from autotest_lib.client.common_lib import utils as common_utils
4 from autotest_lib.tko import utils as tko_utils, models, status_lib 4 from autotest_lib.tko import utils as tko_utils, models, status_lib
5 from autotest_lib.tko.parsers import base 5 from autotest_lib.tko.parsers import base
6 6
7 7
8 class NoHostnameError(Exception): 8 class NoHostnameError(Exception):
9 pass 9 pass
10 10
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 @staticmethod 245 @staticmethod
246 def is_status_line(line): 246 def is_status_line(line):
247 return re.search(r"^\t*(\S[^\t]*\t){3}", line) is not None 247 return re.search(r"^\t*(\S[^\t]*\t){3}", line) is not None
248 248
249 249
250 @classmethod 250 @classmethod
251 def parse_line(cls, line): 251 def parse_line(cls, line):
252 if not status_line.is_status_line(line): 252 if not status_line.is_status_line(line):
253 return None 253 return None
254 indent, line = re.search(r"^(\t*)(.*)$", line).groups() 254 indent, line = re.search(r"^(\t*)(.*)$", line, flags=re.DOTALL).groups()
255 indent = len(indent) 255 indent = len(indent)
256 line = line.strip()
256 257
257 # split the line into the fixed and optional fields 258 # split the line into the fixed and optional fields
258 parts = line.split("\t") 259 parts = line.split("\t")
259 status, subdir, testname = parts[0:3] 260 status, subdir, testname = parts[0:3]
260 reason = parts[-1] 261 reason = parts[-1]
261 optional_parts = parts[3:-1] 262 optional_parts = parts[3:-1]
262 263
263 # all the optional parts should be of the form "key=value" 264 # all the optional parts should be of the form "key=value"
264 assert sum('=' not in part for part in optional_parts) == 0 265 assert sum('=' not in part for part in optional_parts) == 0
265 optional_fields = dict(part.split("=", 1) 266 optional_fields = dict(part.split("=", 1)
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 testname = "boot.%d" % boot_count 438 testname = "boot.%d" % boot_count
438 reason = "machine did not return from reboot" 439 reason = "machine did not return from reboot"
439 tko_utils.dprint(("Adding: ABORT\nSubdir:----\n" 440 tko_utils.dprint(("Adding: ABORT\nSubdir:----\n"
440 "Testname:%s\n%s") 441 "Testname:%s\n%s")
441 % (testname, reason)) 442 % (testname, reason))
442 new_test = test.parse_test(self.job, None, testname, 443 new_test = test.parse_test(self.job, None, testname,
443 "ABORT", reason, 444 "ABORT", reason,
444 current_kernel, None, None) 445 current_kernel, None, None)
445 new_tests.append(new_test) 446 new_tests.append(new_test)
446 yield new_tests 447 yield new_tests
OLDNEW
« 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