Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1072)

Side by Side Diff: tools/foozzie/v8_foozzie.py

Issue 2649133010: [foozzie] Support multi-architecture builds (Closed)
Patch Set: Review Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « infra/mb/mb_config.pyl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 FUZZ_TEST_RE = re.compile(r'.*fuzz(-\d+\.js)') 85 FUZZ_TEST_RE = re.compile(r'.*fuzz(-\d+\.js)')
86 SOURCE_RE = re.compile(r'print\("v8-foozzie source: (.*)"\);') 86 SOURCE_RE = re.compile(r'print\("v8-foozzie source: (.*)"\);')
87 87
88 # The number of hex digits used from the hash of the original source file path. 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. 89 # Keep the number small to avoid duplicate explosion.
90 ORIGINAL_SOURCE_HASH_LENGTH = 3 90 ORIGINAL_SOURCE_HASH_LENGTH = 3
91 91
92 # Placeholder string if no original source file could be determined. 92 # Placeholder string if no original source file could be determined.
93 ORIGINAL_SOURCE_DEFAULT = 'none' 93 ORIGINAL_SOURCE_DEFAULT = 'none'
94 94
95
96 def infer_arch(d8):
97 """Infer the V8 architecture from the build configuration next to the
98 executable.
99 """
100 with open(os.path.join(os.path.dirname(d8), 'v8_build_config.json')) as f:
101 arch = json.load(f)['v8_current_cpu']
102 return 'ia32' if arch == 'x86' else arch
103
104
95 def parse_args(): 105 def parse_args():
96 parser = argparse.ArgumentParser() 106 parser = argparse.ArgumentParser()
97 parser.add_argument( 107 parser.add_argument(
98 '--random-seed', type=int, required=True, 108 '--random-seed', type=int, required=True,
99 help='random seed passed to both runs') 109 help='random seed passed to both runs')
100 parser.add_argument( 110 parser.add_argument(
101 '--first-arch', help='first architecture', default='x64')
102 parser.add_argument(
103 '--second-arch', help='second architecture', default='x64')
104 parser.add_argument(
105 '--first-config', help='first configuration', default='fullcode') 111 '--first-config', help='first configuration', default='fullcode')
106 parser.add_argument( 112 parser.add_argument(
107 '--second-config', help='second configuration', default='fullcode') 113 '--second-config', help='second configuration', default='fullcode')
108 parser.add_argument( 114 parser.add_argument(
109 '--first-d8', default='d8', 115 '--first-d8', default='d8',
110 help='optional path to first d8 executable, ' 116 help='optional path to first d8 executable, '
111 'default: bundled in the same directory as this script') 117 'default: bundled in the same directory as this script')
112 parser.add_argument( 118 parser.add_argument(
113 '--second-d8', 119 '--second-d8',
114 help='optional path to second d8 executable, default: same as first') 120 help='optional path to second d8 executable, default: same as first')
115 parser.add_argument('testcase', help='path to test case') 121 parser.add_argument('testcase', help='path to test case')
116 options = parser.parse_args() 122 options = parser.parse_args()
117 123
118 # Ensure we make a sane comparison.
119 assert (options.first_arch != options.second_arch or
120 options.first_config != options.second_config) , (
121 'Need either arch or config difference.')
122 assert options.first_arch in SUPPORTED_ARCHS
123 assert options.second_arch in SUPPORTED_ARCHS
124 assert options.first_config in CONFIGS
125 assert options.second_config in CONFIGS
126
127 # Ensure we have a test case. 124 # Ensure we have a test case.
128 assert (os.path.exists(options.testcase) and 125 assert (os.path.exists(options.testcase) and
129 os.path.isfile(options.testcase)), ( 126 os.path.isfile(options.testcase)), (
130 'Test case %s doesn\'t exist' % options.testcase) 127 'Test case %s doesn\'t exist' % options.testcase)
131 128
132 # Use first d8 as default for second d8. 129 # Use first d8 as default for second d8.
133 options.second_d8 = options.second_d8 or options.first_d8 130 options.second_d8 = options.second_d8 or options.first_d8
134 131
135 # Ensure absolute paths. 132 # Ensure absolute paths.
136 if not os.path.isabs(options.first_d8): 133 if not os.path.isabs(options.first_d8):
137 options.first_d8 = os.path.join(BASE_PATH, options.first_d8) 134 options.first_d8 = os.path.join(BASE_PATH, options.first_d8)
138 if not os.path.isabs(options.second_d8): 135 if not os.path.isabs(options.second_d8):
139 options.second_d8 = os.path.join(BASE_PATH, options.second_d8) 136 options.second_d8 = os.path.join(BASE_PATH, options.second_d8)
140 137
141 # Ensure executables exist. 138 # Ensure executables exist.
142 assert os.path.exists(options.first_d8) 139 assert os.path.exists(options.first_d8)
143 assert os.path.exists(options.second_d8) 140 assert os.path.exists(options.second_d8)
144 141
145 # Ensure we use different executables when we claim we compare 142 # Infer architecture from build artifacts.
146 # different architectures. 143 options.first_arch = infer_arch(options.first_d8)
147 # TODO(machenbach): Infer arch from gn's build output. 144 options.second_arch = infer_arch(options.second_d8)
148 if options.first_arch != options.second_arch: 145
149 assert options.first_d8 != options.second_d8 146 # Ensure we make a sane comparison.
147 assert (options.first_arch != options.second_arch or
148 options.first_config != options.second_config), (
149 'Need either arch or config difference.')
150 assert options.first_arch in SUPPORTED_ARCHS
151 assert options.second_arch in SUPPORTED_ARCHS
152 assert options.first_config in CONFIGS
153 assert options.second_config in CONFIGS
150 154
151 return options 155 return options
152 156
153 157
154 def get_meta_data(content): 158 def get_meta_data(content):
155 """Extracts original-source-file paths from test case content.""" 159 """Extracts original-source-file paths from test case content."""
156 sources = [] 160 sources = []
157 for line in content.splitlines(): 161 for line in content.splitlines():
158 match = SOURCE_RE.match(line) 162 match = SOURCE_RE.match(line)
159 if match: 163 if match:
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 configs='', source_key='', suppression='wrong_usage') 295 configs='', source_key='', suppression='wrong_usage')
292 result = RETURN_FAIL 296 result = RETURN_FAIL
293 except Exception as e: 297 except Exception as e:
294 print FAILURE_HEADER_TEMPLATE % dict( 298 print FAILURE_HEADER_TEMPLATE % dict(
295 configs='', source_key='', suppression='internal_error') 299 configs='', source_key='', suppression='internal_error')
296 print '# Internal error: %s' % e 300 print '# Internal error: %s' % e
297 traceback.print_exc(file=sys.stdout) 301 traceback.print_exc(file=sys.stdout)
298 result = RETURN_FAIL 302 result = RETURN_FAIL
299 303
300 sys.exit(result) 304 sys.exit(result)
OLDNEW
« no previous file with comments | « infra/mb/mb_config.pyl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698