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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 from ..objects import output | 42 from ..objects import output |
43 | 43 |
44 | 44 |
45 # Base dir of the v8 checkout. | 45 # Base dir of the v8 checkout. |
46 BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname( | 46 BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname( |
47 os.path.abspath(__file__))))) | 47 os.path.abspath(__file__))))) |
48 TEST_DIR = os.path.join(BASE_DIR, "test") | 48 TEST_DIR = os.path.join(BASE_DIR, "test") |
49 | 49 |
50 | 50 |
51 class Instructions(object): | 51 class Instructions(object): |
52 def __init__(self, command, dep_command, test_id, timeout, verbose): | 52 def __init__(self, command, test_id, timeout, verbose): |
53 self.command = command | 53 self.command = command |
54 self.dep_command = dep_command | |
55 self.id = test_id | 54 self.id = test_id |
56 self.timeout = timeout | 55 self.timeout = timeout |
57 self.verbose = verbose | 56 self.verbose = verbose |
58 | 57 |
59 | 58 |
60 # Structure that keeps global information per worker process. | 59 # Structure that keeps global information per worker process. |
61 ProcessContext = collections.namedtuple( | 60 ProcessContext = collections.namedtuple( |
62 "process_context", ["suites", "context"]) | 61 "process_context", ["suites", "context"]) |
63 | 62 |
64 | 63 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 if ("--stress-opt" in test.flags or | 104 if ("--stress-opt" in test.flags or |
106 "--stress-opt" in context.mode_flags or | 105 "--stress-opt" in context.mode_flags or |
107 "--stress-opt" in context.extra_flags): | 106 "--stress-opt" in context.extra_flags): |
108 timeout *= 4 | 107 timeout *= 4 |
109 if "--noenable-vfp3" in context.extra_flags: | 108 if "--noenable-vfp3" in context.extra_flags: |
110 timeout *= 2 | 109 timeout *= 2 |
111 # FIXME(machenbach): Make this more OO. Don't expose default outcomes or | 110 # FIXME(machenbach): Make this more OO. Don't expose default outcomes or |
112 # the like. | 111 # the like. |
113 if statusfile.IsSlow(test.outcomes or [statusfile.PASS]): | 112 if statusfile.IsSlow(test.outcomes or [statusfile.PASS]): |
114 timeout *= 2 | 113 timeout *= 2 |
115 if test.dependency is not None: | 114 return Instructions(command, test.id, timeout, context.verbose) |
116 dep_command = [ c.replace(test.path, test.dependency) for c in command ] | |
117 else: | |
118 dep_command = None | |
119 return Instructions( | |
120 command, dep_command, test.id, timeout, context.verbose) | |
121 | 115 |
122 | 116 |
123 class Job(object): | 117 class Job(object): |
124 """Stores data to be sent over the multi-process boundary. | 118 """Stores data to be sent over the multi-process boundary. |
125 | 119 |
126 All contained fields will be pickled/unpickled. | 120 All contained fields will be pickled/unpickled. |
127 """ | 121 """ |
128 | 122 |
129 def Run(self, process_context): | 123 def Run(self, process_context): |
130 """Executes the job. | 124 """Executes the job. |
(...skipping 22 matching lines...) Expand all Loading... |
153 def Run(self, process_context): | 147 def Run(self, process_context): |
154 try: | 148 try: |
155 # Retrieve a new suite object on the worker-process side. The original | 149 # Retrieve a new suite object on the worker-process side. The original |
156 # suite object isn't pickled. | 150 # suite object isn't pickled. |
157 self.test.SetSuiteObject(process_context.suites) | 151 self.test.SetSuiteObject(process_context.suites) |
158 instr = _GetInstructions(self.test, process_context.context) | 152 instr = _GetInstructions(self.test, process_context.context) |
159 except Exception, e: | 153 except Exception, e: |
160 return SetupProblem(e, self.test) | 154 return SetupProblem(e, self.test) |
161 | 155 |
162 start_time = time.time() | 156 start_time = time.time() |
163 if instr.dep_command is not None: | |
164 dep_output = commands.Execute( | |
165 instr.dep_command, instr.verbose, instr.timeout) | |
166 # TODO(jkummerow): We approximate the test suite specific function | |
167 # IsFailureOutput() by just checking the exit code here. Currently | |
168 # only cctests define dependencies, for which this simplification is | |
169 # correct. | |
170 if dep_output.exit_code != 0: | |
171 return (instr.id, dep_output, time.time() - start_time) | |
172 output = commands.Execute(instr.command, instr.verbose, instr.timeout) | 157 output = commands.Execute(instr.command, instr.verbose, instr.timeout) |
173 return (instr.id, output, time.time() - start_time) | 158 return (instr.id, output, time.time() - start_time) |
174 | 159 |
175 | 160 |
176 def RunTest(job, process_context): | 161 def RunTest(job, process_context): |
177 return job.Run(process_context) | 162 return job.Run(process_context) |
178 | 163 |
179 | 164 |
180 class Runner(object): | 165 class Runner(object): |
181 | 166 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 if self.context.verbose: | 364 if self.context.verbose: |
380 print text | 365 print text |
381 sys.stdout.flush() | 366 sys.stdout.flush() |
382 | 367 |
383 | 368 |
384 class BreakNowException(Exception): | 369 class BreakNowException(Exception): |
385 def __init__(self, value): | 370 def __init__(self, value): |
386 self.value = value | 371 self.value = value |
387 def __str__(self): | 372 def __str__(self): |
388 return repr(self.value) | 373 return repr(self.value) |
OLD | NEW |