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

Side by Side Diff: pydir/run-pnacl-sz.py

Issue 1776843002: Allow subzero tests to pass without le32-nacl-objdump. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Responses to code review Created 4 years, 9 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 | « no previous file | tests_lit/lit.cfg » ('j') | 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 python2 1 #!/usr/bin/env python2
2 2
3 import argparse 3 import argparse
4 import itertools 4 import itertools
5 import os 5 import os
6 import re 6 import re
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 import tempfile 9 import tempfile
10 10
(...skipping 13 matching lines...) Expand all
24 return flags[target] 24 return flags[target]
25 25
26 26
27 def TargetDisassemblerFlags(target): 27 def TargetDisassemblerFlags(target):
28 flags = { 'x8632': ['-Mintel'], 28 flags = { 'x8632': ['-Mintel'],
29 'x8664': ['-Mintel'], 29 'x8664': ['-Mintel'],
30 'arm32': [], 30 'arm32': [],
31 'mips32':[] } 31 'mips32':[] }
32 return flags[target] 32 return flags[target]
33 33
34 def GetObjdumpCmd():
35 """Return a suitable objdump command."""
36 return 'arm-nacl-objdump'
34 37
35 def main(): 38 def main():
36 """Run the pnacl-sz compiler on an llvm file. 39 """Run the pnacl-sz compiler on an llvm file.
37 40
38 Takes an llvm input file, freezes it into a pexe file, converts 41 Takes an llvm input file, freezes it into a pexe file, converts
39 it to a Subzero program, and finally compiles it. 42 it to a Subzero program, and finally compiles it.
40 """ 43 """
41 argparser = argparse.ArgumentParser( 44 argparser = argparse.ArgumentParser(
42 description=' ' + main.__doc__, 45 description=' ' + main.__doc__,
43 formatter_class=argparse.ArgumentDefaultsHelpFormatter) 46 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 asm_temp.close() 192 asm_temp.close()
190 output_file_name = asm_temp.name 193 output_file_name = asm_temp.name
191 if args.assemble and args.filetype != 'obj': 194 if args.assemble and args.filetype != 'obj':
192 cmd += (['|', os.path.join(pnacl_bin_path, 'llvm-mc')] + 195 cmd += (['|', os.path.join(pnacl_bin_path, 'llvm-mc')] +
193 TargetAssemblerFlags(args.target, args.sandbox) + 196 TargetAssemblerFlags(args.target, args.sandbox) +
194 ['-filetype=obj', '-o', output_file_name]) 197 ['-filetype=obj', '-o', output_file_name])
195 elif output_file_name: 198 elif output_file_name:
196 cmd += ['-o', output_file_name] 199 cmd += ['-o', output_file_name]
197 if args.disassemble: 200 if args.disassemble:
198 # Show wide instruction encodings, diassemble, and show relocs. 201 # Show wide instruction encodings, diassemble, and show relocs.
199 cmd += (['&&', os.path.join(pnacl_bin_path, 'le32-nacl-objdump')] + 202 cmd += (['&&', os.path.join(pnacl_bin_path, GetObjdumpCmd())] +
200 args.dis_flags + 203 args.dis_flags +
201 ['-w', '-d', '-r'] + TargetDisassemblerFlags(args.target) + 204 ['-w', '-d', '-r'] + TargetDisassemblerFlags(args.target) +
202 [output_file_name]) 205 [output_file_name])
203 206
204 stdout_result = shellcmd(cmd, echo=args.echo_cmd) 207 stdout_result = shellcmd(cmd, echo=args.echo_cmd)
205 if not args.echo_cmd: 208 if not args.echo_cmd:
206 sys.stdout.write(stdout_result) 209 sys.stdout.write(stdout_result)
207 if asm_temp and not keep_output_file: 210 if asm_temp and not keep_output_file:
208 os.remove(output_file_name) 211 os.remove(output_file_name)
209 212
210 if __name__ == '__main__': 213 if __name__ == '__main__':
211 main() 214 main()
OLDNEW
« no previous file with comments | « no previous file | tests_lit/lit.cfg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698