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

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

Issue 1531623007: Add option to force filetype=asm for testing (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Formatting Created 5 years 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
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 help='Assemble the output') 71 help='Assemble the output')
72 argparser.add_argument('--disassemble', required=False, 72 argparser.add_argument('--disassemble', required=False,
73 action='store_true', 73 action='store_true',
74 help='Disassemble the assembled output') 74 help='Disassemble the assembled output')
75 argparser.add_argument('--dis-flags', required=False, 75 argparser.add_argument('--dis-flags', required=False,
76 action='append', default=[], 76 action='append', default=[],
77 help='Add a disassembler flag') 77 help='Add a disassembler flag')
78 argparser.add_argument('--filetype', default='iasm', dest='filetype', 78 argparser.add_argument('--filetype', default='iasm', dest='filetype',
79 choices=['obj', 'asm', 'iasm'], 79 choices=['obj', 'asm', 'iasm'],
80 help='Output file type. Default %(default)s.') 80 help='Output file type. Default %(default)s.')
81 argparser.add_argument('--forceasm', required=False, action='store_true',
82 help='Force --filetype=asm.')
Jim Stichnoth 2015/12/20 18:42:23 OCD: Remove the '.' from the help string for consi
sehr 2016/01/07 18:53:11 Done.
81 argparser.add_argument('--target', default='x8632', dest='target', 83 argparser.add_argument('--target', default='x8632', dest='target',
82 choices=['x8632','arm32','mips32'], 84 choices=['x8632','arm32','mips32'],
83 help='Target architecture. Default %(default)s.') 85 help='Target architecture. Default %(default)s.')
84 argparser.add_argument('--echo-cmd', required=False, 86 argparser.add_argument('--echo-cmd', required=False,
85 action='store_true', 87 action='store_true',
86 help='Trace command that generates ICE instructions') 88 help='Trace command that generates ICE instructions')
87 argparser.add_argument('--tbc', required=False, action='store_true', 89 argparser.add_argument('--tbc', required=False, action='store_true',
88 help='Input is textual bitcode (not .ll)') 90 help='Input is textual bitcode (not .ll)')
89 argparser.add_argument('--expect-fail', required=False, action='store_true', 91 argparser.add_argument('--expect-fail', required=False, action='store_true',
90 help='Negate success of run by using LLVM not') 92 help='Negate success of run by using LLVM not')
(...skipping 13 matching lines...) Expand all
104 if args.llvm_source and args.no_local_syms: 106 if args.llvm_source and args.no_local_syms:
105 raise RuntimeError("Can't specify both '--llvm-source' and " + 107 raise RuntimeError("Can't specify both '--llvm-source' and " +
106 "'--no-local-syms'") 108 "'--no-local-syms'")
107 109
108 if args.llvm_source and args.tbc: 110 if args.llvm_source and args.tbc:
109 raise RuntimeError("Can't specify both '--tbc' and '--llvm-source'") 111 raise RuntimeError("Can't specify both '--tbc' and '--llvm-source'")
110 112
111 if args.llvm and args.tbc: 113 if args.llvm and args.tbc:
112 raise RuntimeError("Can't specify both '--tbc' and '--llvm'") 114 raise RuntimeError("Can't specify both '--tbc' and '--llvm'")
113 115
116 if args.forceasm:
117 if args.filetype == 'asm':
118 pass
119 elif args.filetype == 'iasm':
120 # TODO(sehr) implement forceasm for iasm.
121 pass
122 elif args.filetype == 'obj':
123 args.filetype = 'asm'
124 args.assemble = True
125
114 cmd = [] 126 cmd = []
115 if args.tbc: 127 if args.tbc:
116 cmd = [os.path.join(pnacl_bin_path, 'pnacl-bcfuzz'), llfile, 128 cmd = [os.path.join(pnacl_bin_path, 'pnacl-bcfuzz'), llfile,
117 '-bitcode-as-text', '-output', '-', '|'] 129 '-bitcode-as-text', '-output', '-', '|']
118 elif not args.llvm_source: 130 elif not args.llvm_source:
119 cmd = [os.path.join(pnacl_bin_path, 'llvm-as'), llfile, '-o', '-', '|', 131 cmd = [os.path.join(pnacl_bin_path, 'llvm-as'), llfile, '-o', '-', '|',
120 os.path.join(pnacl_bin_path, 'pnacl-freeze')] 132 os.path.join(pnacl_bin_path, 'pnacl-freeze')]
121 if not args.no_local_syms: 133 if not args.no_local_syms:
122 cmd += ['--allow-local-symbol-tables'] 134 cmd += ['--allow-local-symbol-tables']
123 cmd += ['|'] 135 cmd += ['|']
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 [asm_temp.name]) 177 [asm_temp.name])
166 178
167 stdout_result = shellcmd(cmd, echo=args.echo_cmd) 179 stdout_result = shellcmd(cmd, echo=args.echo_cmd)
168 if not args.echo_cmd: 180 if not args.echo_cmd:
169 sys.stdout.write(stdout_result) 181 sys.stdout.write(stdout_result)
170 if asm_temp: 182 if asm_temp:
171 os.remove(asm_temp.name) 183 os.remove(asm_temp.name)
172 184
173 if __name__ == '__main__': 185 if __name__ == '__main__':
174 main() 186 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698