| 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 |
| 11 import hashlib |
| 11 import itertools | 12 import itertools |
| 12 import json | 13 import json |
| 13 import os | 14 import os |
| 14 import re | 15 import re |
| 15 import sys | 16 import sys |
| 16 import traceback | 17 import traceback |
| 17 | 18 |
| 18 import v8_commands | 19 import v8_commands |
| 19 import v8_suppressions | 20 import v8_suppressions |
| 20 | 21 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ### End of configuration %(first_config_label)s | 78 ### End of configuration %(first_config_label)s |
| 78 # | 79 # |
| 79 ### Start of configuration %(second_config_label)s: | 80 ### Start of configuration %(second_config_label)s: |
| 80 %(second_config_output)s | 81 %(second_config_output)s |
| 81 ### End of configuration %(second_config_label)s | 82 ### End of configuration %(second_config_label)s |
| 82 """ | 83 """ |
| 83 | 84 |
| 84 FUZZ_TEST_RE = re.compile(r'.*fuzz(-\d+\.js)') | 85 FUZZ_TEST_RE = re.compile(r'.*fuzz(-\d+\.js)') |
| 85 SOURCE_RE = re.compile(r'print\("v8-foozzie source: (.*)"\);') | 86 SOURCE_RE = re.compile(r'print\("v8-foozzie source: (.*)"\);') |
| 86 | 87 |
| 88 # The number of hex digits used from the hash of the original source file path. |
| 89 # Keep the number small to avoid duplicate explosion. |
| 90 ORIGINAL_SOURCE_HASH_LENGTH = 3 |
| 91 |
| 92 # Placeholder string if no original source file could be determined. |
| 93 ORIGINAL_SOURCE_DEFAULT = 'none' |
| 94 |
| 87 def parse_args(): | 95 def parse_args(): |
| 88 parser = argparse.ArgumentParser() | 96 parser = argparse.ArgumentParser() |
| 89 parser.add_argument( | 97 parser.add_argument( |
| 90 '--random-seed', type=int, required=True, | 98 '--random-seed', type=int, required=True, |
| 91 help='random seed passed to both runs') | 99 help='random seed passed to both runs') |
| 92 parser.add_argument( | 100 parser.add_argument( |
| 93 '--first-arch', help='first architecture', default='x64') | 101 '--first-arch', help='first architecture', default='x64') |
| 94 parser.add_argument( | 102 parser.add_argument( |
| 95 '--second-arch', help='second architecture', default='x64') | 103 '--second-arch', help='second architecture', default='x64') |
| 96 parser.add_argument( | 104 parser.add_argument( |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 return RETURN_FAIL | 236 return RETURN_FAIL |
| 229 | 237 |
| 230 second_config_output = run_d8(options.second_d8, second_config_flags) | 238 second_config_output = run_d8(options.second_d8, second_config_flags) |
| 231 | 239 |
| 232 # Bailout based on second run's output. | 240 # Bailout based on second run's output. |
| 233 if pass_bailout(second_config_output, 2): | 241 if pass_bailout(second_config_output, 2): |
| 234 return RETURN_PASS | 242 return RETURN_PASS |
| 235 if fail_bailout(second_config_output, suppress.ignore_by_output2): | 243 if fail_bailout(second_config_output, suppress.ignore_by_output2): |
| 236 return RETURN_FAIL | 244 return RETURN_FAIL |
| 237 | 245 |
| 238 difference, source, source_key = suppress.diff( | 246 difference, source = suppress.diff( |
| 239 first_config_output.stdout, second_config_output.stdout) | 247 first_config_output.stdout, second_config_output.stdout) |
| 248 |
| 249 if source: |
| 250 source_key = hashlib.sha1(source).hexdigest()[:ORIGINAL_SOURCE_HASH_LENGTH] |
| 251 else: |
| 252 source = ORIGINAL_SOURCE_DEFAULT |
| 253 source_key = ORIGINAL_SOURCE_DEFAULT |
| 254 |
| 240 if difference: | 255 if difference: |
| 241 # The first three entries will be parsed by clusterfuzz. Format changes | 256 # The first three entries will be parsed by clusterfuzz. Format changes |
| 242 # will require changes on the clusterfuzz side. | 257 # will require changes on the clusterfuzz side. |
| 243 first_config_label = '%s,%s' % (options.first_arch, options.first_config) | 258 first_config_label = '%s,%s' % (options.first_arch, options.first_config) |
| 244 second_config_label = '%s,%s' % (options.second_arch, options.second_config) | 259 second_config_label = '%s,%s' % (options.second_arch, options.second_config) |
| 245 print FAILURE_TEMPLATE % dict( | 260 print FAILURE_TEMPLATE % dict( |
| 246 configs='%s:%s' % (first_config_label, second_config_label), | 261 configs='%s:%s' % (first_config_label, second_config_label), |
| 247 source_key=source_key, | 262 source_key=source_key, |
| 248 suppression='', # We can't tie bugs to differences. | 263 suppression='', # We can't tie bugs to differences. |
| 249 first_config_label=first_config_label, | 264 first_config_label=first_config_label, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 275 configs='', source_key='', suppression='wrong_usage') | 290 configs='', source_key='', suppression='wrong_usage') |
| 276 result = RETURN_FAIL | 291 result = RETURN_FAIL |
| 277 except Exception as e: | 292 except Exception as e: |
| 278 print FAILURE_HEADER_TEMPLATE % dict( | 293 print FAILURE_HEADER_TEMPLATE % dict( |
| 279 configs='', source_key='', suppression='internal_error') | 294 configs='', source_key='', suppression='internal_error') |
| 280 print '# Internal error: %s' % e | 295 print '# Internal error: %s' % e |
| 281 traceback.print_exc(file=sys.stdout) | 296 traceback.print_exc(file=sys.stdout) |
| 282 result = RETURN_FAIL | 297 result = RETURN_FAIL |
| 283 | 298 |
| 284 sys.exit(result) | 299 sys.exit(result) |
| OLD | NEW |