| 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, env): | 52 def __init__(self, command, test_id, timeout, verbose): |
| 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 | |
| 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 |
| 65 def MakeProcessContext(context): | 64 def MakeProcessContext(context): |
| 66 """Generate a process-local context. | 65 """Generate a process-local context. |
| 67 | 66 |
| (...skipping 37 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 return Instructions(command, test.id, timeout, context.verbose, test.env) | 114 return Instructions(command, test.id, timeout, context.verbose) |
| 116 | 115 |
| 117 | 116 |
| 118 class Job(object): | 117 class Job(object): |
| 119 """Stores data to be sent over the multi-process boundary. | 118 """Stores data to be sent over the multi-process boundary. |
| 120 | 119 |
| 121 All contained fields will be pickled/unpickled. | 120 All contained fields will be pickled/unpickled. |
| 122 """ | 121 """ |
| 123 | 122 |
| 124 def Run(self, process_context): | 123 def Run(self, process_context): |
| 125 """Executes the job. | 124 """Executes the job. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 def Run(self, process_context): | 171 def Run(self, process_context): |
| 173 try: | 172 try: |
| 174 # Retrieve a new suite object on the worker-process side. The original | 173 # Retrieve a new suite object on the worker-process side. The original |
| 175 # suite object isn't pickled. | 174 # suite object isn't pickled. |
| 176 self.test.SetSuiteObject(process_context.suites) | 175 self.test.SetSuiteObject(process_context.suites) |
| 177 instr = _GetInstructions(self.test, process_context.context) | 176 instr = _GetInstructions(self.test, process_context.context) |
| 178 except Exception, e: | 177 except Exception, e: |
| 179 return SetupProblem(e, self.test) | 178 return SetupProblem(e, self.test) |
| 180 | 179 |
| 181 start_time = time.time() | 180 start_time = time.time() |
| 182 output = commands.Execute(instr.command, instr.verbose, instr.timeout, | 181 output = commands.Execute(instr.command, instr.verbose, instr.timeout) |
| 183 instr.env) | |
| 184 self._rename_coverage_data(output, process_context.context) | 182 self._rename_coverage_data(output, process_context.context) |
| 185 return (instr.id, output, time.time() - start_time) | 183 return (instr.id, output, time.time() - start_time) |
| 186 | 184 |
| 187 | 185 |
| 188 def RunTest(job, process_context): | 186 def RunTest(job, process_context): |
| 189 return job.Run(process_context) | 187 return job.Run(process_context) |
| 190 | 188 |
| 191 | 189 |
| 192 class Runner(object): | 190 class Runner(object): |
| 193 | 191 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 if self.context.verbose: | 389 if self.context.verbose: |
| 392 print text | 390 print text |
| 393 sys.stdout.flush() | 391 sys.stdout.flush() |
| 394 | 392 |
| 395 | 393 |
| 396 class BreakNowException(Exception): | 394 class BreakNowException(Exception): |
| 397 def __init__(self, value): | 395 def __init__(self, value): |
| 398 self.value = value | 396 self.value = value |
| 399 def __str__(self): | 397 def __str__(self): |
| 400 return repr(self.value) | 398 return repr(self.value) |
| OLD | NEW |