| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 class TestJob(Job): | 143 class TestJob(Job): |
| 144 def __init__(self, test): | 144 def __init__(self, test): |
| 145 self.test = test | 145 self.test = test |
| 146 | 146 |
| 147 def _rename_coverage_data(self, output, context): | 147 def _rename_coverage_data(self, output, context): |
| 148 """Rename coverage data. | 148 """Rename coverage data. |
| 149 | 149 |
| 150 Rename files with PIDs to files with unique test IDs, because the number | 150 Rename files with PIDs to files with unique test IDs, because the number |
| 151 of tests might be higher than pid_max. E.g.: | 151 of tests might be higher than pid_max. E.g.: |
| 152 d8.1234.sancov -> d8.test.1.sancov, where 1234 was the process' PID | 152 d8.1234.sancov -> d8.test.42.1.sancov, where 1234 was the process' PID, |
| 153 and 1 is the test ID. | 153 42 is the test ID and 1 is the attempt (the same test might be rerun on |
| 154 failures). |
| 154 """ | 155 """ |
| 155 if context.sancov_dir and output.pid is not None: | 156 if context.sancov_dir and output.pid is not None: |
| 156 sancov_file = os.path.join( | 157 sancov_file = os.path.join( |
| 157 context.sancov_dir, "%s.%d.sancov" % (self.test.shell(), output.pid)) | 158 context.sancov_dir, "%s.%d.sancov" % (self.test.shell(), output.pid)) |
| 158 | 159 |
| 159 # Some tests are expected to fail and don't produce coverage data. | 160 # Some tests are expected to fail and don't produce coverage data. |
| 160 if os.path.exists(sancov_file): | 161 if os.path.exists(sancov_file): |
| 161 parts = sancov_file.split(".") | 162 parts = sancov_file.split(".") |
| 162 new_sancov_file = ".".join( | 163 new_sancov_file = ".".join( |
| 163 parts[:-2] + ["test", str(self.test.id)] + parts[-1:]) | 164 parts[:-2] + |
| 165 ["test", str(self.test.id), str(self.test.run)] + |
| 166 parts[-1:] |
| 167 ) |
| 164 assert not os.path.exists(new_sancov_file) | 168 assert not os.path.exists(new_sancov_file) |
| 165 os.rename(sancov_file, new_sancov_file) | 169 os.rename(sancov_file, new_sancov_file) |
| 166 | 170 |
| 167 def Run(self, process_context): | 171 def Run(self, process_context): |
| 168 try: | 172 try: |
| 169 # 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 |
| 170 # suite object isn't pickled. | 174 # suite object isn't pickled. |
| 171 self.test.SetSuiteObject(process_context.suites) | 175 self.test.SetSuiteObject(process_context.suites) |
| 172 instr = _GetInstructions(self.test, process_context.context) | 176 instr = _GetInstructions(self.test, process_context.context) |
| 173 except Exception, e: | 177 except Exception, e: |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 if self.context.verbose: | 384 if self.context.verbose: |
| 381 print text | 385 print text |
| 382 sys.stdout.flush() | 386 sys.stdout.flush() |
| 383 | 387 |
| 384 | 388 |
| 385 class BreakNowException(Exception): | 389 class BreakNowException(Exception): |
| 386 def __init__(self, value): | 390 def __init__(self, value): |
| 387 self.value = value | 391 self.value = value |
| 388 def __str__(self): | 392 def __str__(self): |
| 389 return repr(self.value) | 393 return repr(self.value) |
| OLD | NEW |