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 | |
12 import itertools | 11 import itertools |
13 import json | 12 import json |
14 import os | 13 import os |
15 import re | 14 import re |
16 import sys | 15 import sys |
17 import traceback | 16 import traceback |
18 | 17 |
19 import v8_commands | 18 import v8_commands |
20 import v8_suppressions | 19 import v8_suppressions |
21 | 20 |
22 CONFIGS = dict( | 21 CONFIGS = dict( |
23 default=[], | 22 default=[], |
24 validate_asm=['--validate-asm'], # Maybe add , '--disable-asm-warnings' | 23 validate_asm=['--validate-asm'], # Maybe add , '--disable-asm-warnings' |
25 fullcode=['--nocrankshaft', '--turbo-filter=~'], | 24 fullcode=['--nocrankshaft', '--turbo-filter=~'], |
26 noturbo=['--turbo-filter=~', '--noturbo-asm'], | 25 noturbo=['--turbo-filter=~', '--noturbo-asm'], |
27 noturbo_opt=['--always-opt', '--turbo-filter=~', '--noturbo-asm'], | 26 noturbo_opt=['--always-opt', '--turbo-filter=~', '--noturbo-asm'], |
28 ignition_staging=['--ignition-staging'], | 27 ignition_staging=['--ignition-staging'], |
29 ignition_turbo=['--ignition-staging', '--turbo'], | 28 ignition_turbo=['--ignition-staging', '--turbo'], |
30 ignition_turbo_opt=['--ignition-staging', '--turbo', '--always-opt'], | 29 ignition_turbo_opt=['--ignition-staging', '--turbo', '--always-opt'], |
31 ) | 30 ) |
32 | 31 |
33 # Timeout in seconds for one d8 run. | 32 # Timeout in seconds for one d8 run. |
34 TIMEOUT = 3 | 33 TIMEOUT = 3 |
35 | 34 |
36 # Return codes. | 35 # Return codes. |
37 RETURN_PASS = 0 | 36 RETURN_PASS = 0 |
38 RETURN_FAIL = 2 | 37 RETURN_FAIL = 2 |
39 | 38 |
40 # The number of hex digits used from the hash of the original source file path. | |
41 # Keep the number small to avoid duplicate explosion. | |
42 SOURCE_HASH_LENGTH = 3 | |
43 | |
44 BASE_PATH = os.path.dirname(os.path.abspath(__file__)) | 39 BASE_PATH = os.path.dirname(os.path.abspath(__file__)) |
45 PREAMBLE = [ | 40 PREAMBLE = [ |
46 os.path.join(BASE_PATH, 'v8_mock.js'), | 41 os.path.join(BASE_PATH, 'v8_mock.js'), |
47 os.path.join(BASE_PATH, 'v8_suppressions.js'), | 42 os.path.join(BASE_PATH, 'v8_suppressions.js'), |
48 ] | 43 ] |
49 | 44 |
50 FLAGS = ['--abort_on_stack_overflow', '--expose-gc', '--allow-natives-syntax', | 45 FLAGS = ['--abort_on_stack_overflow', '--expose-gc', '--allow-natives-syntax', |
51 '--invoke-weak-callbacks', '--omit-quit', '--es-staging'] | 46 '--invoke-weak-callbacks', '--omit-quit', '--es-staging'] |
52 | 47 |
53 SUPPORTED_ARCHS = ['ia32', 'x64', 'arm', 'arm64'] | 48 SUPPORTED_ARCHS = ['ia32', 'x64', 'arm', 'arm64'] |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 return RETURN_FAIL | 236 return RETURN_FAIL |
242 | 237 |
243 second_config_output = run_d8(options.second_d8, second_config_flags) | 238 second_config_output = run_d8(options.second_d8, second_config_flags) |
244 | 239 |
245 # Bailout based on second run's output. | 240 # Bailout based on second run's output. |
246 if pass_bailout(second_config_output, 2): | 241 if pass_bailout(second_config_output, 2): |
247 return RETURN_PASS | 242 return RETURN_PASS |
248 if fail_bailout(second_config_output, suppress.ignore_by_output2): | 243 if fail_bailout(second_config_output, suppress.ignore_by_output2): |
249 return RETURN_FAIL | 244 return RETURN_FAIL |
250 | 245 |
251 difference, source = suppress.diff( | 246 difference, source_key = suppress.diff( |
252 first_config_output.stdout, second_config_output.stdout) | 247 first_config_output.stdout, second_config_output.stdout) |
253 if difference: | 248 if difference: |
254 # The first three entries will be parsed by clusterfuzz. Format changes | 249 # The first three entries will be parsed by clusterfuzz. Format changes |
255 # will require changes on the clusterfuzz side. | 250 # will require changes on the clusterfuzz side. |
256 first_config_label = '%s,%s' % (options.first_arch, options.first_config) | 251 first_config_label = '%s,%s' % (options.first_arch, options.first_config) |
257 second_config_label = '%s,%s' % (options.second_arch, options.second_config) | 252 second_config_label = '%s,%s' % (options.second_arch, options.second_config) |
258 print FAILURE_TEMPLATE % dict( | 253 print FAILURE_TEMPLATE % dict( |
259 configs='%s:%s' % (first_config_label, second_config_label), | 254 configs='%s:%s' % (first_config_label, second_config_label), |
260 sources=hashlib.sha1(source).hexdigest()[:SOURCE_HASH_LENGTH], | 255 sources=source_key, |
261 suppression='', # We can't tie bugs to differences. | 256 suppression='', # We can't tie bugs to differences. |
262 first_config_label=first_config_label, | 257 first_config_label=first_config_label, |
263 second_config_label=second_config_label, | 258 second_config_label=second_config_label, |
264 first_config_flags=' '.join(first_config_flags), | 259 first_config_flags=' '.join(first_config_flags), |
265 second_config_flags=' '.join(second_config_flags), | 260 second_config_flags=' '.join(second_config_flags), |
266 first_config_output=first_config_output.stdout, | 261 first_config_output=first_config_output.stdout, |
267 second_config_output=second_config_output.stdout, | 262 second_config_output=second_config_output.stdout, |
268 difference=difference, | 263 difference=difference, |
269 ) | 264 ) |
270 return RETURN_FAIL | 265 return RETURN_FAIL |
(...skipping 16 matching lines...) Expand all Loading... |
287 configs='', sources='', suppression='wrong_usage') | 282 configs='', sources='', suppression='wrong_usage') |
288 result = RETURN_FAIL | 283 result = RETURN_FAIL |
289 except Exception as e: | 284 except Exception as e: |
290 print FAILURE_HEADER_TEMPLATE % dict( | 285 print FAILURE_HEADER_TEMPLATE % dict( |
291 configs='', sources='', suppression='internal_error') | 286 configs='', sources='', suppression='internal_error') |
292 print '# Internal error: %s' % e | 287 print '# Internal error: %s' % e |
293 traceback.print_exc(file=sys.stdout) | 288 traceback.print_exc(file=sys.stdout) |
294 result = RETURN_FAIL | 289 result = RETURN_FAIL |
295 | 290 |
296 sys.exit(result) | 291 sys.exit(result) |
OLD | NEW |