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

Side by Side Diff: scripts/slave/gtest/test_result.py

Issue 10636008: Convert runtest to have a built-in annotator. (Closed) Base URL: http://git.chromium.org/chromium/tools/build.git@master
Patch Set: Fix nits. Created 8 years, 5 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
« no previous file with comments | « scripts/common/gtest_utils.py ('k') | scripts/slave/gtest_slave_utils.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 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 def canonical_name(name): 5 def canonical_name(name):
6 new_name = name.replace('FLAKY_', '', 1) 6 new_name = name.replace('FLAKY_', '', 1)
7 new_name = new_name.replace('FAILS_', '', 1) 7 new_name = new_name.replace('FAILS_', '', 1)
8 new_name = new_name.replace('DISABLED_', '', 1) 8 new_name = new_name.replace('DISABLED_', '', 1)
9 return new_name 9 return new_name
10 10
11 class TestResult(object): 11 class TestResult(object):
12 """A simple class that represents a single test result.""" 12 """A simple class that represents a single test result."""
13 13
14 # Test modifier constants. 14 # Test modifier constants.
15 (NONE, FAILS, FLAKY, DISABLED) = range(4) 15 (NONE, FAILS, FLAKY, DISABLED) = range(4)
16 16
17 def __init__(self, test, failed, not_run=False, elapsed_time=0): 17 def __init__(self, test, failed, not_run=False, elapsed_time=0):
18 self.test_name = canonical_name(test) 18 self.test_name = canonical_name(test)
19 self.failed = failed 19 self.failed = failed
20 self.test_run_time = elapsed_time 20 self.test_run_time = elapsed_time
21 21
22 test_name = test 22 test_name = test
23 try: 23 try:
24 test_name = test.split('.')[1] 24 test_name = test.split('.')[1]
25 except IndexError: 25 except IndexError:
26 pass 26 pass
27 27
28 if not_run: 28 if not_run:
29 self.modifier = self.DISABLED 29 self.modifier = self.DISABLED
30 elif test_name.startswith('FAILS_'): 30 elif test_name.startswith('FAILS_'):
31 self.modifier = self.FAILS 31 self.modifier = self.FAILS
32 elif test_name.startswith('FLAKY_'): 32 elif test_name.startswith('FLAKY_'):
33 self.modifier = self.FLAKY 33 self.modifier = self.FLAKY
34 elif test_name.startswith('DISABLED_'): 34 elif test_name.startswith('DISABLED_'):
35 self.modifier = self.DISABLED 35 self.modifier = self.DISABLED
36 else: 36 else:
37 self.modifier = self.NONE 37 self.modifier = self.NONE
38 38
39 def fixable(self): 39 def fixable(self):
40 return self.failed or self.modifier == self.DISABLED 40 return self.failed or self.modifier == self.DISABLED
OLDNEW
« no previous file with comments | « scripts/common/gtest_utils.py ('k') | scripts/slave/gtest_slave_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698