| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 assert options.first_arch in SUPPORTED_ARCHS | 110 assert options.first_arch in SUPPORTED_ARCHS |
| 111 assert options.second_arch in SUPPORTED_ARCHS | 111 assert options.second_arch in SUPPORTED_ARCHS |
| 112 assert options.first_config in CONFIGS | 112 assert options.first_config in CONFIGS |
| 113 assert options.second_config in CONFIGS | 113 assert options.second_config in CONFIGS |
| 114 | 114 |
| 115 # Ensure we have a test case. | 115 # Ensure we have a test case. |
| 116 assert (os.path.exists(options.testcase) and | 116 assert (os.path.exists(options.testcase) and |
| 117 os.path.isfile(options.testcase)), ( | 117 os.path.isfile(options.testcase)), ( |
| 118 'Test case %s doesn\'t exist' % options.testcase) | 118 'Test case %s doesn\'t exist' % options.testcase) |
| 119 | 119 |
| 120 resources_path = os.path.join( | 120 options.meta_data_path = os.path.join( |
| 121 os.path.dirname(options.testcase), | 121 os.path.dirname(options.testcase), |
| 122 'resources' + os.path.basename(options.testcase)[len('fuzz'):]) | 122 'meta' + os.path.basename(options.testcase)[len('fuzz'):]) |
| 123 assert os.path.exists(resources_path), ( | |
| 124 'Resources file %s doesn\'t exist' % resources_path) | |
| 125 | |
| 126 with open(resources_path) as f: | |
| 127 resources = f.read().strip().splitlines() | |
| 128 assert len(resources) == 1 | |
| 129 options.meta_data_path = os.path.join( | |
| 130 os.path.dirname(resources_path), resources[0]) | |
| 131 assert os.path.exists(options.meta_data_path), ( | 123 assert os.path.exists(options.meta_data_path), ( |
| 132 'Metadata %s doesn\'t exist' % options.meta_data_path) | 124 'Metadata %s doesn\'t exist' % options.meta_data_path) |
| 133 | 125 |
| 134 # Use first d8 as default for second d8. | 126 # Use first d8 as default for second d8. |
| 135 options.second_d8 = options.second_d8 or options.first_d8 | 127 options.second_d8 = options.second_d8 or options.first_d8 |
| 136 | 128 |
| 137 # Ensure absolute paths. | 129 # Ensure absolute paths. |
| 138 options.first_d8 = os.path.abspath(options.first_d8) | 130 if not os.path.isabs(options.first_d8): |
| 139 options.second_d8 = os.path.abspath(options.second_d8) | 131 options.first_d8 = os.path.join(BASE_PATH, options.first_d8) |
| 132 if not os.path.isabs(options.second_d8): |
| 133 options.second_d8 = os.path.join(BASE_PATH, options.second_d8) |
| 140 | 134 |
| 141 # Ensure executables exist. | 135 # Ensure executables exist. |
| 142 assert os.path.exists(options.first_d8) | 136 assert os.path.exists(options.first_d8) |
| 143 assert os.path.exists(options.second_d8) | 137 assert os.path.exists(options.second_d8) |
| 144 | 138 |
| 145 # Ensure we use different executables when we claim we compare | 139 # Ensure we use different executables when we claim we compare |
| 146 # different architectures. | 140 # different architectures. |
| 147 # TODO(machenbach): Infer arch from gn's build output. | 141 # TODO(machenbach): Infer arch from gn's build output. |
| 148 if options.first_arch != options.second_arch: | 142 if options.first_arch != options.second_arch: |
| 149 assert options.first_d8 != options.second_d8 | 143 assert options.first_d8 != options.second_d8 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 configs='', sources='', suppression='wrong_usage') | 266 configs='', sources='', suppression='wrong_usage') |
| 273 result = RETURN_FAIL | 267 result = RETURN_FAIL |
| 274 except Exception as e: | 268 except Exception as e: |
| 275 print FAILURE_HEADER_TEMPLATE % dict( | 269 print FAILURE_HEADER_TEMPLATE % dict( |
| 276 configs='', sources='', suppression='internal_error') | 270 configs='', sources='', suppression='internal_error') |
| 277 print '# Internal error: %s' % e | 271 print '# Internal error: %s' % e |
| 278 traceback.print_exc(file=sys.stdout) | 272 traceback.print_exc(file=sys.stdout) |
| 279 result = RETURN_FAIL | 273 result = RETURN_FAIL |
| 280 | 274 |
| 281 sys.exit(result) | 275 sys.exit(result) |
| OLD | NEW |