| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 self.suite = suite # TestSuite object | 34 self.suite = suite # TestSuite object |
| 35 self.path = path # string, e.g. 'div-mod', 'test-api/foo' | 35 self.path = path # string, e.g. 'div-mod', 'test-api/foo' |
| 36 self.flags = flags or [] # list of strings, flags specific to this test | 36 self.flags = flags or [] # list of strings, flags specific to this test |
| 37 self.variant = variant # name of the used testing variant | 37 self.variant = variant # name of the used testing variant |
| 38 self.override_shell = override_shell | 38 self.override_shell = override_shell |
| 39 self.outcomes = frozenset([]) | 39 self.outcomes = frozenset([]) |
| 40 self.output = None | 40 self.output = None |
| 41 self.id = None # int, used to map result back to TestCase instance | 41 self.id = None # int, used to map result back to TestCase instance |
| 42 self.duration = None # assigned during execution | 42 self.duration = None # assigned during execution |
| 43 self.run = 1 # The nth time this test is executed. | 43 self.run = 1 # The nth time this test is executed. |
| 44 self.env = {} |
| 44 | 45 |
| 45 def CopyAddingFlags(self, variant, flags): | 46 def CopyAddingFlags(self, variant, flags): |
| 46 copy = TestCase(self.suite, self.path, variant, self.flags + flags, | 47 copy = TestCase(self.suite, self.path, variant, self.flags + flags, |
| 47 self.override_shell) | 48 self.override_shell) |
| 48 copy.outcomes = self.outcomes | 49 copy.outcomes = self.outcomes |
| 50 copy.env = self.env |
| 49 return copy | 51 return copy |
| 50 | 52 |
| 51 def PackTask(self): | 53 def PackTask(self): |
| 52 """ | 54 """ |
| 53 Extracts those parts of this object that are required to run the test | 55 Extracts those parts of this object that are required to run the test |
| 54 and returns them as a JSON serializable object. | 56 and returns them as a JSON serializable object. |
| 55 """ | 57 """ |
| 56 assert self.id is not None | 58 assert self.id is not None |
| 57 return [self.suitename(), self.path, self.variant, self.flags, | 59 return [self.suitename(), self.path, self.variant, self.flags, |
| 58 self.override_shell, list(self.outcomes or []), | 60 self.override_shell, list(self.outcomes or []), |
| 59 self.id] | 61 self.id, self.env] |
| 60 | 62 |
| 61 @staticmethod | 63 @staticmethod |
| 62 def UnpackTask(task): | 64 def UnpackTask(task): |
| 63 """Creates a new TestCase object based on packed task data.""" | 65 """Creates a new TestCase object based on packed task data.""" |
| 64 # For the order of the fields, refer to PackTask() above. | 66 # For the order of the fields, refer to PackTask() above. |
| 65 test = TestCase(str(task[0]), task[1], task[2], task[3], task[4]) | 67 test = TestCase(str(task[0]), task[1], task[2], task[3], task[4]) |
| 66 test.outcomes = frozenset(task[5]) | 68 test.outcomes = frozenset(task[5]) |
| 67 test.id = task[6] | 69 test.id = task[6] |
| 68 test.run = 1 | 70 test.run = 1 |
| 71 test.env = task[7] |
| 69 return test | 72 return test |
| 70 | 73 |
| 71 def SetSuiteObject(self, suites): | 74 def SetSuiteObject(self, suites): |
| 72 self.suite = suites[self.suite] | 75 self.suite = suites[self.suite] |
| 73 | 76 |
| 74 def PackResult(self): | 77 def PackResult(self): |
| 75 """Serializes the output of the TestCase after it has run.""" | 78 """Serializes the output of the TestCase after it has run.""" |
| 76 self.suite.StripOutputForTransmit(self) | 79 self.suite.StripOutputForTransmit(self) |
| 77 return [self.id, self.output.Pack(), self.duration] | 80 return [self.id, self.output.Pack(), self.duration] |
| 78 | 81 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 104 def __cmp__(self, other): | 107 def __cmp__(self, other): |
| 105 # Make sure that test cases are sorted correctly if sorted without | 108 # Make sure that test cases are sorted correctly if sorted without |
| 106 # key function. But using a key function is preferred for speed. | 109 # key function. But using a key function is preferred for speed. |
| 107 return cmp( | 110 return cmp( |
| 108 (self.suite.name, self.path, self.flags), | 111 (self.suite.name, self.path, self.flags), |
| 109 (other.suite.name, other.path, other.flags), | 112 (other.suite.name, other.path, other.flags), |
| 110 ) | 113 ) |
| 111 | 114 |
| 112 def __str__(self): | 115 def __str__(self): |
| 113 return "[%s/%s %s]" % (self.suite.name, self.path, self.flags) | 116 return "[%s/%s %s]" % (self.suite.name, self.path, self.flags) |
| OLD | NEW |