 Chromium Code Reviews
 Chromium Code Reviews Issue 1531623007:
  Add option to force filetype=asm for testing  (Closed) 
  Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
    
  
    Issue 1531623007:
  Add option to force filetype=asm for testing  (Closed) 
  Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master| OLD | NEW | 
|---|---|
| 1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 | 
| 2 | 2 | 
| 3 import argparse | 3 import argparse | 
| 4 import ConfigParser | 4 import ConfigParser | 
| 5 import os | 5 import os | 
| 6 import shutil | 6 import shutil | 
| 7 import sys | 7 import sys | 
| 8 | 8 | 
| 9 from utils import shellcmd | 9 from utils import shellcmd | 
| 10 from utils import FindBaseNaCl | 10 from utils import FindBaseNaCl | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 default=('{root}/toolchain_build/src/subzero/' + | 100 default=('{root}/toolchain_build/src/subzero/' + | 
| 101 'crosstest/Output').format(root=root), | 101 'crosstest/Output').format(root=root), | 
| 102 help='Output directory') | 102 help='Output directory') | 
| 103 argparser.add_argument('--lit', default=False, action='store_true', | 103 argparser.add_argument('--lit', default=False, action='store_true', | 
| 104 help='Generate files for lit testing') | 104 help='Generate files for lit testing') | 
| 105 argparser.add_argument('--toolchain-root', dest='toolchain_root', | 105 argparser.add_argument('--toolchain-root', dest='toolchain_root', | 
| 106 default=( | 106 default=( | 
| 107 '{root}/toolchain/linux_x86/pnacl_newlib_raw/bin' | 107 '{root}/toolchain/linux_x86/pnacl_newlib_raw/bin' | 
| 108 ).format(root=root), | 108 ).format(root=root), | 
| 109 help='Path to toolchain binaries.') | 109 help='Path to toolchain binaries.') | 
| 110 argparser.add_argument('--filetype', default=None, dest='filetype', | |
| 111 help='File type for compilation {asm, iasm, obj}.') | |
| 
Jim Stichnoth
2016/01/10 03:08:55
I suggest documenting this something like "...file
 
sehr
2016/01/11 21:49:47
I'm not sure I totally got what you're saying, but
 | |
| 110 args = argparser.parse_args() | 112 args = argparser.parse_args() | 
| 111 | 113 | 
| 112 # Run from the crosstest directory to make it easy to grab inputs. | 114 # Run from the crosstest directory to make it easy to grab inputs. | 
| 113 crosstest_dir = '{root}/toolchain_build/src/subzero/crosstest'.format( | 115 crosstest_dir = '{root}/toolchain_build/src/subzero/crosstest'.format( | 
| 114 root=root) | 116 root=root) | 
| 115 os.chdir(crosstest_dir) | 117 os.chdir(crosstest_dir) | 
| 116 | 118 | 
| 117 tests = ConfigParser.RawConfigParser() | 119 tests = ConfigParser.RawConfigParser() | 
| 118 tests.read('crosstest.cfg') | 120 tests.read('crosstest.cfg') | 
| 119 | 121 | 
| (...skipping 25 matching lines...) Expand all Loading... | |
| 145 for sb in sandboxing: | 147 for sb in sandboxing: | 
| 146 for opt in opt_levels: | 148 for opt in opt_levels: | 
| 147 for attr in arch_attrs[target]: | 149 for attr in arch_attrs[target]: | 
| 148 desc = [ test, target, sb, opt, attr ] | 150 desc = [ test, target, sb, opt, attr ] | 
| 149 if Match(set(desc), includes, excludes, default_match): | 151 if Match(set(desc), includes, excludes, default_match): | 
| 150 exe = '{test}_{target}_{sb}_{opt}_{attr}'.format( | 152 exe = '{test}_{target}_{sb}_{opt}_{attr}'.format( | 
| 151 test=test, target=target, sb=sb, opt=opt, | 153 test=test, target=target, sb=sb, opt=opt, | 
| 152 attr=attr) | 154 attr=attr) | 
| 153 extra = (tests.get(test, 'flags').split(' ') | 155 extra = (tests.get(test, 'flags').split(' ') | 
| 154 if tests.has_option(test, 'flags') else []) | 156 if tests.has_option(test, 'flags') else []) | 
| 157 if args.filetype: | |
| 158 extra += ['--filetype={ftype}'.format(ftype=args.filetype)] | |
| 155 # Generate the compile command. | 159 # Generate the compile command. | 
| 156 cmp_cmd = ( | 160 cmp_cmd = ( | 
| 157 ['{path}/crosstest.py'.format(path=pypath), | 161 ['{path}/crosstest.py'.format(path=pypath), | 
| 158 '-{opt}'.format(opt=opt), | 162 '-{opt}'.format(opt=opt), | 
| 159 '--mattr={attr}'.format(attr=attr), | 163 '--mattr={attr}'.format(attr=attr), | 
| 160 '--prefix=Subzero_', | 164 '--prefix=Subzero_', | 
| 161 '--target={target}'.format(target=target), | 165 '--target={target}'.format(target=target), | 
| 162 '--nonsfi={nsfi}'.format(nsfi='1' if sb=='nonsfi' else '0'), | 166 '--nonsfi={nsfi}'.format(nsfi='1' if sb=='nonsfi' else '0'), | 
| 163 '--sandbox={sb}'.format(sb='1' if sb=='sandbox' else '0'), | 167 '--sandbox={sb}'.format(sb='1' if sb=='sandbox' else '0'), | 
| 164 '--dir={dir}'.format(dir=args.dir), | 168 '--dir={dir}'.format(dir=args.dir), | 
| (...skipping 30 matching lines...) Expand all Loading... | |
| 195 echo=args.verbose) | 199 echo=args.verbose) | 
| 196 if (args.defer): | 200 if (args.defer): | 
| 197 deferred_cmds.append(run_cmd) | 201 deferred_cmds.append(run_cmd) | 
| 198 else: | 202 else: | 
| 199 shellcmd(run_cmd, echo=True) | 203 shellcmd(run_cmd, echo=True) | 
| 200 for run_cmd in deferred_cmds: | 204 for run_cmd in deferred_cmds: | 
| 201 shellcmd(run_cmd, echo=True) | 205 shellcmd(run_cmd, echo=True) | 
| 202 | 206 | 
| 203 if __name__ == '__main__': | 207 if __name__ == '__main__': | 
| 204 main() | 208 main() | 
| OLD | NEW |