| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 the V8 project authors. All rights reserved. | 2 # Copyright 2016 the V8 project authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 V8 correctness fuzzer launcher script. | 7 V8 correctness fuzzer launcher script. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import argparse | 10 import argparse |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 # Ensure we use different executables when we claim we compare | 142 # Ensure we use different executables when we claim we compare |
| 143 # different architectures. | 143 # different architectures. |
| 144 # TODO(machenbach): Infer arch from gn's build output. | 144 # TODO(machenbach): Infer arch from gn's build output. |
| 145 if options.first_arch != options.second_arch: | 145 if options.first_arch != options.second_arch: |
| 146 assert options.first_d8 != options.second_d8 | 146 assert options.first_d8 != options.second_d8 |
| 147 | 147 |
| 148 return options | 148 return options |
| 149 | 149 |
| 150 | 150 |
| 151 def metadata_bailout(metadata, ignore_fun): |
| 152 """Print failure state and return if ignore_fun matches metadata.""" |
| 153 bug = (ignore_fun(metadata) or '').strip() |
| 154 if bug: |
| 155 print FAILURE_HEADER_TEMPLATE % dict( |
| 156 configs='', sources='', suppression=bug) |
| 157 return True |
| 158 return False |
| 159 |
| 160 |
| 151 def test_pattern_bailout(testcase, ignore_fun): | 161 def test_pattern_bailout(testcase, ignore_fun): |
| 152 """Print failure state and return if ignore_fun matches testcase.""" | 162 """Print failure state and return if ignore_fun matches testcase.""" |
| 153 with open(testcase) as f: | 163 with open(testcase) as f: |
| 154 bug = (ignore_fun(f.read()) or '').strip() | 164 bug = (ignore_fun(f.read()) or '').strip() |
| 155 if bug: | 165 if bug: |
| 156 print FAILURE_HEADER_TEMPLATE % dict( | 166 print FAILURE_HEADER_TEMPLATE % dict( |
| 157 configs='', sources='', suppression=bug) | 167 configs='', sources='', suppression=bug) |
| 158 return True | 168 return True |
| 159 return False | 169 return False |
| 160 | 170 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 184 | 194 |
| 185 def main(): | 195 def main(): |
| 186 options = parse_args() | 196 options = parse_args() |
| 187 | 197 |
| 188 # Suppressions are architecture and configuration specific. | 198 # Suppressions are architecture and configuration specific. |
| 189 suppress = v8_suppressions.get_suppression( | 199 suppress = v8_suppressions.get_suppression( |
| 190 options.first_arch, options.first_config, | 200 options.first_arch, options.first_config, |
| 191 options.second_arch, options.second_config, | 201 options.second_arch, options.second_config, |
| 192 ) | 202 ) |
| 193 | 203 |
| 194 if test_pattern_bailout(options.testcase, suppress.ignore): | |
| 195 return RETURN_FAIL | |
| 196 | |
| 197 # Get metadata. | 204 # Get metadata. |
| 198 with open(options.meta_data_path) as f: | 205 with open(options.meta_data_path) as f: |
| 199 metadata = json.load(f) | 206 metadata = json.load(f) |
| 200 | 207 |
| 208 if metadata_bailout(metadata, suppress.ignore_by_metadata): |
| 209 return RETURN_FAIL |
| 210 |
| 211 if test_pattern_bailout(options.testcase, suppress.ignore_by_content): |
| 212 return RETURN_FAIL |
| 213 |
| 201 common_flags = FLAGS + ['--random-seed', str(options.random_seed)] | 214 common_flags = FLAGS + ['--random-seed', str(options.random_seed)] |
| 202 first_config_flags = common_flags + CONFIGS[options.first_config] | 215 first_config_flags = common_flags + CONFIGS[options.first_config] |
| 203 second_config_flags = common_flags + CONFIGS[options.second_config] | 216 second_config_flags = common_flags + CONFIGS[options.second_config] |
| 204 | 217 |
| 205 def run_d8(d8, config_flags): | 218 def run_d8(d8, config_flags): |
| 206 args = [d8] + config_flags + PREAMBLE + [options.testcase] | 219 args = [d8] + config_flags + PREAMBLE + [options.testcase] |
| 207 if d8.endswith('.py'): | 220 if d8.endswith('.py'): |
| 208 # Wrap with python in tests. | 221 # Wrap with python in tests. |
| 209 args = [sys.executable] + args | 222 args = [sys.executable] + args |
| 210 return v8_commands.Execute( | 223 return v8_commands.Execute( |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 configs='', sources='', suppression='wrong_usage') | 282 configs='', sources='', suppression='wrong_usage') |
| 270 result = RETURN_FAIL | 283 result = RETURN_FAIL |
| 271 except Exception as e: | 284 except Exception as e: |
| 272 print FAILURE_HEADER_TEMPLATE % dict( | 285 print FAILURE_HEADER_TEMPLATE % dict( |
| 273 configs='', sources='', suppression='internal_error') | 286 configs='', sources='', suppression='internal_error') |
| 274 print '# Internal error: %s' % e | 287 print '# Internal error: %s' % e |
| 275 traceback.print_exc(file=sys.stdout) | 288 traceback.print_exc(file=sys.stdout) |
| 276 result = RETURN_FAIL | 289 result = RETURN_FAIL |
| 277 | 290 |
| 278 sys.exit(result) | 291 sys.exit(result) |
| OLD | NEW |