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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 raise NotImplementedError() | 130 raise NotImplementedError() |
131 | 131 |
132 | 132 |
133 def SetupProblem(exception, test): | 133 def SetupProblem(exception, test): |
134 stderr = ">>> EXCEPTION: %s\n" % exception | 134 stderr = ">>> EXCEPTION: %s\n" % exception |
135 match = re.match(r"^.*No such file or directory: '(.*)'$", str(exception)) | 135 match = re.match(r"^.*No such file or directory: '(.*)'$", str(exception)) |
136 if match: | 136 if match: |
137 # Extra debuging information when files are claimed missing. | 137 # Extra debuging information when files are claimed missing. |
138 f = match.group(1) | 138 f = match.group(1) |
139 stderr += ">>> File %s exists? -> %s\n" % (f, os.path.exists(f)) | 139 stderr += ">>> File %s exists? -> %s\n" % (f, os.path.exists(f)) |
140 return test.id, output.Output(1, False, "", stderr), 0 | 140 return test.id, output.Output(1, False, "", stderr, None), 0 |
141 | 141 |
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.1.sancov, where 1234 was the process' PID |
153 and 1 is the test ID. | 153 and 1 is the test ID. |
154 """ | 154 """ |
155 if context.sancov_dir: | 155 if context.sancov_dir and output.pid is not None: |
156 sancov_file = os.path.join( | 156 sancov_file = os.path.join( |
157 context.sancov_dir, "%s.%d.sancov" % (self.test.shell(), output.pid)) | 157 context.sancov_dir, "%s.%d.sancov" % (self.test.shell(), output.pid)) |
158 | 158 |
159 # Some tests are expected to fail and don't produce coverage data. | 159 # Some tests are expected to fail and don't produce coverage data. |
160 if os.path.exists(sancov_file): | 160 if os.path.exists(sancov_file): |
161 parts = sancov_file.split(".") | 161 parts = sancov_file.split(".") |
162 new_sancov_file = ".".join( | 162 new_sancov_file = ".".join( |
163 parts[:-2] + ["test", str(self.test.id)] + parts[-1:]) | 163 parts[:-2] + ["test", str(self.test.id)] + parts[-1:]) |
164 assert not os.path.exists(new_sancov_file) | 164 assert not os.path.exists(new_sancov_file) |
165 os.rename(sancov_file, new_sancov_file) | 165 os.rename(sancov_file, new_sancov_file) |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 if self.context.verbose: | 385 if self.context.verbose: |
386 print text | 386 print text |
387 sys.stdout.flush() | 387 sys.stdout.flush() |
388 | 388 |
389 | 389 |
390 class BreakNowException(Exception): | 390 class BreakNowException(Exception): |
391 def __init__(self, value): | 391 def __init__(self, value): |
392 self.value = value | 392 self.value = value |
393 def __str__(self): | 393 def __str__(self): |
394 return repr(self.value) | 394 return repr(self.value) |
OLD | NEW |