| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # Exposes the builder and recipe configurations to GenTests in recipes. | 5 # Exposes the builder and recipe configurations to GenTests in recipes. |
| 6 | 6 |
| 7 import re | 7 import re |
| 8 | 8 |
| 9 from recipe_engine import recipe_test_api | 9 from recipe_engine import recipe_test_api |
| 10 from . import builders | 10 from . import builders |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 'name': 'mjsunit/Cool.Test2', | 33 'name': 'mjsunit/Cool.Test2', |
| 34 'flags': ['-f', '-g'], | 34 'flags': ['-f', '-g'], |
| 35 'command': 'd8 -f mjsunit/Cool.Test2', | 35 'command': 'd8 -f mjsunit/Cool.Test2', |
| 36 'duration': 0.1012, | 36 'duration': 0.1012, |
| 37 }, | 37 }, |
| 38 ] | 38 ] |
| 39 | 39 |
| 40 def iter_builders(self): | 40 def iter_builders(self): |
| 41 return builders.iter_builders() | 41 return builders.iter_builders() |
| 42 | 42 |
| 43 def output_json(self, has_failures=False, wrong_results=False, flakes=False): | 43 def output_json(self, has_failures=False, wrong_results=False, flakes=False, |
| 44 unmarked_slow_test=False): |
| 45 slowest_tests = V8TestApi.SLOWEST_TESTS |
| 46 if unmarked_slow_test: |
| 47 slowest_tests += [{ |
| 48 'name': 'mjsunit/slow', |
| 49 'flags': [], |
| 50 'command': 'd8 -f mjsunit/slow', |
| 51 'duration': 123.0, |
| 52 'marked_slow': False, |
| 53 }] |
| 44 if not has_failures: | 54 if not has_failures: |
| 45 return self.m.json.output([{ | 55 return self.m.json.output([{ |
| 46 'arch': 'theArch', | 56 'arch': 'theArch', |
| 47 'mode': 'theMode', | 57 'mode': 'theMode', |
| 48 'results': [], | 58 'results': [], |
| 49 'slowest_tests': V8TestApi.SLOWEST_TESTS, | 59 'slowest_tests': slowest_tests, |
| 50 }]) | 60 }]) |
| 51 if wrong_results: | 61 if wrong_results: |
| 52 return self.m.json.output([{ | 62 return self.m.json.output([{ |
| 53 'arch': 'theArch1', | 63 'arch': 'theArch1', |
| 54 'mode': 'theMode1', | 64 'mode': 'theMode1', |
| 55 'results': [], | 65 'results': [], |
| 56 'slowest_tests': V8TestApi.SLOWEST_TESTS, | 66 'slowest_tests': slowest_tests, |
| 57 }, | 67 }, |
| 58 { | 68 { |
| 59 'arch': 'theArch2', | 69 'arch': 'theArch2', |
| 60 'mode': 'theMode2', | 70 'mode': 'theMode2', |
| 61 'results': [], | 71 'results': [], |
| 62 'slowest_tests': V8TestApi.SLOWEST_TESTS, | 72 'slowest_tests': slowest_tests, |
| 63 }]) | 73 }]) |
| 64 if flakes: | 74 if flakes: |
| 65 return self.m.json.output([{ | 75 return self.m.json.output([{ |
| 66 'arch': 'theArch1', | 76 'arch': 'theArch1', |
| 67 'mode': 'theMode1', | 77 'mode': 'theMode1', |
| 68 'results': [ | 78 'results': [ |
| 69 { | 79 { |
| 70 'flags': [], | 80 'flags': [], |
| 71 'result': 'FAIL', | 81 'result': 'FAIL', |
| 72 'expected': ['PASS', 'SLOW'], | 82 'expected': ['PASS', 'SLOW'], |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 'variant': 'default', | 126 'variant': 'default', |
| 117 'random_seed': 123, | 127 'random_seed': 123, |
| 118 'run': 2, | 128 'run': 2, |
| 119 'stdout': 'Some output.', | 129 'stdout': 'Some output.', |
| 120 'stderr': '', | 130 'stderr': '', |
| 121 'name': 'suite-name/dir/test-name2', | 131 'name': 'suite-name/dir/test-name2', |
| 122 'command': 'd8 test.js', | 132 'command': 'd8 test.js', |
| 123 'exit_code': 1, | 133 'exit_code': 1, |
| 124 }, | 134 }, |
| 125 ], | 135 ], |
| 126 'slowest_tests': V8TestApi.SLOWEST_TESTS, | 136 'slowest_tests': slowest_tests, |
| 127 }]) | 137 }]) |
| 128 | 138 |
| 129 | 139 |
| 130 # Add enough failures to exceed the maximum number of shown failures | 140 # Add enough failures to exceed the maximum number of shown failures |
| 131 # (test-name9 will be cut off). | 141 # (test-name9 will be cut off). |
| 132 results = [] | 142 results = [] |
| 133 for i in range(0, 10): | 143 for i in range(0, 10): |
| 134 results.append({ | 144 results.append({ |
| 135 'flags': ['--opt42'], | 145 'flags': ['--opt42'], |
| 136 'result': 'FAIL', | 146 'result': 'FAIL', |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 'name': 'other-suite/dir/other-test-very-long-name%d' % i, | 180 'name': 'other-suite/dir/other-test-very-long-name%d' % i, |
| 171 'command': ('out/theMode/d8 --other ' | 181 'command': ('out/theMode/d8 --other ' |
| 172 'test/other-suite/dir/other-test-very-long-name.js'), | 182 'test/other-suite/dir/other-test-very-long-name.js'), |
| 173 'exit_code': 1, | 183 'exit_code': 1, |
| 174 }) | 184 }) |
| 175 | 185 |
| 176 return self.m.json.output([{ | 186 return self.m.json.output([{ |
| 177 'arch': 'theArch', | 187 'arch': 'theArch', |
| 178 'mode': 'theMode', | 188 'mode': 'theMode', |
| 179 'results': results, | 189 'results': results, |
| 180 'slowest_tests': V8TestApi.SLOWEST_TESTS, | 190 'slowest_tests': slowest_tests, |
| 181 }]) | 191 }]) |
| 182 | 192 |
| 183 def one_failure(self): | 193 def one_failure(self): |
| 184 return self.m.json.output([{ | 194 return self.m.json.output([{ |
| 185 'arch': 'theArch', | 195 'arch': 'theArch', |
| 186 'mode': 'theMode', | 196 'mode': 'theMode', |
| 187 'results': [ | 197 'results': [ |
| 188 { | 198 { |
| 189 'flags': [], | 199 'flags': [], |
| 190 'result': 'FAIL', | 200 'result': 'FAIL', |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 406 |
| 397 @recipe_test_api.mod_test_data | 407 @recipe_test_api.mod_test_data |
| 398 @staticmethod | 408 @staticmethod |
| 399 def wrong_results(wrong_results): | 409 def wrong_results(wrong_results): |
| 400 return wrong_results | 410 return wrong_results |
| 401 | 411 |
| 402 def __call__(self, test_failures=False, wrong_results=False, flakes=False): | 412 def __call__(self, test_failures=False, wrong_results=False, flakes=False): |
| 403 return (self.test_failures(test_failures) + | 413 return (self.test_failures(test_failures) + |
| 404 self.wrong_results(wrong_results) + | 414 self.wrong_results(wrong_results) + |
| 405 self.flakes(flakes)) | 415 self.flakes(flakes)) |
| OLD | NEW |