| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 # | 72 # |
| 73 ### Start of configuration %(first_config_label)s: | 73 ### Start of configuration %(first_config_label)s: |
| 74 %(first_config_output)s | 74 %(first_config_output)s |
| 75 ### End of configuration %(first_config_label)s | 75 ### End of configuration %(first_config_label)s |
| 76 # | 76 # |
| 77 ### Start of configuration %(second_config_label)s: | 77 ### Start of configuration %(second_config_label)s: |
| 78 %(second_config_output)s | 78 %(second_config_output)s |
| 79 ### End of configuration %(second_config_label)s | 79 ### End of configuration %(second_config_label)s |
| 80 """ | 80 """ |
| 81 | 81 |
| 82 FUZZ_TEST_RE = re.compile(r'.*fuzz(-\d+\.js)') |
| 82 | 83 |
| 83 def parse_args(): | 84 def parse_args(): |
| 84 parser = argparse.ArgumentParser() | 85 parser = argparse.ArgumentParser() |
| 85 parser.add_argument( | 86 parser.add_argument( |
| 86 '--random-seed', type=int, required=True, | 87 '--random-seed', type=int, required=True, |
| 87 help='random seed passed to both runs') | 88 help='random seed passed to both runs') |
| 88 parser.add_argument( | 89 parser.add_argument( |
| 89 '--first-arch', help='first architecture', default='x64') | 90 '--first-arch', help='first architecture', default='x64') |
| 90 parser.add_argument( | 91 parser.add_argument( |
| 91 '--second-arch', help='second architecture', default='x64') | 92 '--second-arch', help='second architecture', default='x64') |
| (...skipping 18 matching lines...) Expand all Loading... |
| 110 assert options.first_arch in SUPPORTED_ARCHS | 111 assert options.first_arch in SUPPORTED_ARCHS |
| 111 assert options.second_arch in SUPPORTED_ARCHS | 112 assert options.second_arch in SUPPORTED_ARCHS |
| 112 assert options.first_config in CONFIGS | 113 assert options.first_config in CONFIGS |
| 113 assert options.second_config in CONFIGS | 114 assert options.second_config in CONFIGS |
| 114 | 115 |
| 115 # Ensure we have a test case. | 116 # Ensure we have a test case. |
| 116 assert (os.path.exists(options.testcase) and | 117 assert (os.path.exists(options.testcase) and |
| 117 os.path.isfile(options.testcase)), ( | 118 os.path.isfile(options.testcase)), ( |
| 118 'Test case %s doesn\'t exist' % options.testcase) | 119 'Test case %s doesn\'t exist' % options.testcase) |
| 119 | 120 |
| 121 # Deduce metadata file name from test case. This also removes |
| 122 # the prefix the test case might get during minimization. |
| 123 suffix = FUZZ_TEST_RE.match(os.path.basename(options.testcase)).group(1) |
| 120 options.meta_data_path = os.path.join( | 124 options.meta_data_path = os.path.join( |
| 121 os.path.dirname(options.testcase), | 125 os.path.dirname(options.testcase), 'meta' + suffix) |
| 122 'meta' + os.path.basename(options.testcase)[len('fuzz'):]) | |
| 123 assert os.path.exists(options.meta_data_path), ( | 126 assert os.path.exists(options.meta_data_path), ( |
| 124 'Metadata %s doesn\'t exist' % options.meta_data_path) | 127 'Metadata %s doesn\'t exist' % options.meta_data_path) |
| 125 | 128 |
| 126 # Use first d8 as default for second d8. | 129 # Use first d8 as default for second d8. |
| 127 options.second_d8 = options.second_d8 or options.first_d8 | 130 options.second_d8 = options.second_d8 or options.first_d8 |
| 128 | 131 |
| 129 # Ensure absolute paths. | 132 # Ensure absolute paths. |
| 130 if not os.path.isabs(options.first_d8): | 133 if not os.path.isabs(options.first_d8): |
| 131 options.first_d8 = os.path.join(BASE_PATH, options.first_d8) | 134 options.first_d8 = os.path.join(BASE_PATH, options.first_d8) |
| 132 if not os.path.isabs(options.second_d8): | 135 if not os.path.isabs(options.second_d8): |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 configs='', sources='', suppression='wrong_usage') | 269 configs='', sources='', suppression='wrong_usage') |
| 267 result = RETURN_FAIL | 270 result = RETURN_FAIL |
| 268 except Exception as e: | 271 except Exception as e: |
| 269 print FAILURE_HEADER_TEMPLATE % dict( | 272 print FAILURE_HEADER_TEMPLATE % dict( |
| 270 configs='', sources='', suppression='internal_error') | 273 configs='', sources='', suppression='internal_error') |
| 271 print '# Internal error: %s' % e | 274 print '# Internal error: %s' % e |
| 272 traceback.print_exc(file=sys.stdout) | 275 traceback.print_exc(file=sys.stdout) |
| 273 result = RETURN_FAIL | 276 result = RETURN_FAIL |
| 274 | 277 |
| 275 sys.exit(result) | 278 sys.exit(result) |
| OLD | NEW |