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, test_id, timeout, verbose): | 52 def __init__(self, command, test_id, timeout, verbose, env): |
53 self.command = command | 53 self.command = command |
54 self.id = test_id | 54 self.id = test_id |
55 self.timeout = timeout | 55 self.timeout = timeout |
56 self.verbose = verbose | 56 self.verbose = verbose |
| 57 self.env = env |
57 | 58 |
58 | 59 |
59 # Structure that keeps global information per worker process. | 60 # Structure that keeps global information per worker process. |
60 ProcessContext = collections.namedtuple( | 61 ProcessContext = collections.namedtuple( |
61 "process_context", ["suites", "context"]) | 62 "process_context", ["suites", "context"]) |
62 | 63 |
63 | 64 |
64 def MakeProcessContext(context): | 65 def MakeProcessContext(context): |
65 """Generate a process-local context. | 66 """Generate a process-local context. |
66 | 67 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 if ("--stress-opt" in test.flags or | 105 if ("--stress-opt" in test.flags or |
105 "--stress-opt" in context.mode_flags or | 106 "--stress-opt" in context.mode_flags or |
106 "--stress-opt" in context.extra_flags): | 107 "--stress-opt" in context.extra_flags): |
107 timeout *= 4 | 108 timeout *= 4 |
108 if "--noenable-vfp3" in context.extra_flags: | 109 if "--noenable-vfp3" in context.extra_flags: |
109 timeout *= 2 | 110 timeout *= 2 |
110 # FIXME(machenbach): Make this more OO. Don't expose default outcomes or | 111 # FIXME(machenbach): Make this more OO. Don't expose default outcomes or |
111 # the like. | 112 # the like. |
112 if statusfile.IsSlow(test.outcomes or [statusfile.PASS]): | 113 if statusfile.IsSlow(test.outcomes or [statusfile.PASS]): |
113 timeout *= 2 | 114 timeout *= 2 |
114 return Instructions(command, test.id, timeout, context.verbose) | 115 return Instructions(command, test.id, timeout, context.verbose, test.env) |
115 | 116 |
116 | 117 |
117 class Job(object): | 118 class Job(object): |
118 """Stores data to be sent over the multi-process boundary. | 119 """Stores data to be sent over the multi-process boundary. |
119 | 120 |
120 All contained fields will be pickled/unpickled. | 121 All contained fields will be pickled/unpickled. |
121 """ | 122 """ |
122 | 123 |
123 def Run(self, process_context): | 124 def Run(self, process_context): |
124 """Executes the job. | 125 """Executes the job. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 def Run(self, process_context): | 172 def Run(self, process_context): |
172 try: | 173 try: |
173 # Retrieve a new suite object on the worker-process side. The original | 174 # Retrieve a new suite object on the worker-process side. The original |
174 # suite object isn't pickled. | 175 # suite object isn't pickled. |
175 self.test.SetSuiteObject(process_context.suites) | 176 self.test.SetSuiteObject(process_context.suites) |
176 instr = _GetInstructions(self.test, process_context.context) | 177 instr = _GetInstructions(self.test, process_context.context) |
177 except Exception, e: | 178 except Exception, e: |
178 return SetupProblem(e, self.test) | 179 return SetupProblem(e, self.test) |
179 | 180 |
180 start_time = time.time() | 181 start_time = time.time() |
181 output = commands.Execute(instr.command, instr.verbose, instr.timeout) | 182 output = commands.Execute(instr.command, instr.verbose, instr.timeout, |
| 183 instr.env) |
182 self._rename_coverage_data(output, process_context.context) | 184 self._rename_coverage_data(output, process_context.context) |
183 return (instr.id, output, time.time() - start_time) | 185 return (instr.id, output, time.time() - start_time) |
184 | 186 |
185 | 187 |
186 def RunTest(job, process_context): | 188 def RunTest(job, process_context): |
187 return job.Run(process_context) | 189 return job.Run(process_context) |
188 | 190 |
189 | 191 |
190 class Runner(object): | 192 class Runner(object): |
191 | 193 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 if self.context.verbose: | 391 if self.context.verbose: |
390 print text | 392 print text |
391 sys.stdout.flush() | 393 sys.stdout.flush() |
392 | 394 |
393 | 395 |
394 class BreakNowException(Exception): | 396 class BreakNowException(Exception): |
395 def __init__(self, value): | 397 def __init__(self, value): |
396 self.value = value | 398 self.value = value |
397 def __str__(self): | 399 def __str__(self): |
398 return repr(self.value) | 400 return repr(self.value) |
OLD | NEW |