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

Side by Side Diff: tools/testrunner/objects/testcase.py

Issue 360113003: Let test runner rerun failures to test for flakes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « tools/testrunner/objects/context.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 the V8 project authors. All rights reserved. 1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 20 matching lines...) Expand all
31 class TestCase(object): 31 class TestCase(object):
32 def __init__(self, suite, path, flags=[], dependency=None): 32 def __init__(self, suite, path, flags=[], dependency=None):
33 self.suite = suite # TestSuite object 33 self.suite = suite # TestSuite object
34 self.path = path # string, e.g. 'div-mod', 'test-api/foo' 34 self.path = path # string, e.g. 'div-mod', 'test-api/foo'
35 self.flags = flags # list of strings, flags specific to this test case 35 self.flags = flags # list of strings, flags specific to this test case
36 self.dependency = dependency # |path| for testcase that must be run first 36 self.dependency = dependency # |path| for testcase that must be run first
37 self.outcomes = None 37 self.outcomes = None
38 self.output = None 38 self.output = None
39 self.id = None # int, used to map result back to TestCase instance 39 self.id = None # int, used to map result back to TestCase instance
40 self.duration = None # assigned during execution 40 self.duration = None # assigned during execution
41 self.run = 1 # The nth time this test is executed.
41 42
42 def CopyAddingFlags(self, flags): 43 def CopyAddingFlags(self, flags):
43 copy = TestCase(self.suite, self.path, self.flags + flags, self.dependency) 44 copy = TestCase(self.suite, self.path, self.flags + flags, self.dependency)
44 copy.outcomes = self.outcomes 45 copy.outcomes = self.outcomes
45 return copy 46 return copy
46 47
47 def PackTask(self): 48 def PackTask(self):
48 """ 49 """
49 Extracts those parts of this object that are required to run the test 50 Extracts those parts of this object that are required to run the test
50 and returns them as a JSON serializable object. 51 and returns them as a JSON serializable object.
51 """ 52 """
52 assert self.id is not None 53 assert self.id is not None
53 return [self.suitename(), self.path, self.flags, 54 return [self.suitename(), self.path, self.flags,
54 self.dependency, list(self.outcomes or []), self.id] 55 self.dependency, list(self.outcomes or []), self.id]
55 56
56 @staticmethod 57 @staticmethod
57 def UnpackTask(task): 58 def UnpackTask(task):
58 """Creates a new TestCase object based on packed task data.""" 59 """Creates a new TestCase object based on packed task data."""
59 # For the order of the fields, refer to PackTask() above. 60 # For the order of the fields, refer to PackTask() above.
60 test = TestCase(str(task[0]), task[1], task[2], task[3]) 61 test = TestCase(str(task[0]), task[1], task[2], task[3])
61 test.outcomes = set(task[4]) 62 test.outcomes = set(task[4])
62 test.id = task[5] 63 test.id = task[5]
64 test.run = 1
63 return test 65 return test
64 66
65 def SetSuiteObject(self, suites): 67 def SetSuiteObject(self, suites):
66 self.suite = suites[self.suite] 68 self.suite = suites[self.suite]
67 69
68 def PackResult(self): 70 def PackResult(self):
69 """Serializes the output of the TestCase after it has run.""" 71 """Serializes the output of the TestCase after it has run."""
70 self.suite.StripOutputForTransmit(self) 72 self.suite.StripOutputForTransmit(self)
71 return [self.id, self.output.Pack(), self.duration] 73 return [self.id, self.output.Pack(), self.duration]
72 74
73 def MergeResult(self, result): 75 def MergeResult(self, result):
74 """Applies the contents of a Result to this object.""" 76 """Applies the contents of a Result to this object."""
75 assert result[0] == self.id 77 assert result[0] == self.id
76 self.output = output.Output.Unpack(result[1]) 78 self.output = output.Output.Unpack(result[1])
77 self.duration = result[2] 79 self.duration = result[2]
78 80
79 def suitename(self): 81 def suitename(self):
80 return self.suite.name 82 return self.suite.name
81 83
82 def GetLabel(self): 84 def GetLabel(self):
83 return self.suitename() + "/" + self.suite.CommonTestName(self) 85 return self.suitename() + "/" + self.suite.CommonTestName(self)
OLDNEW
« no previous file with comments | « tools/testrunner/objects/context.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698