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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 action='store_true', | 97 action='store_true', |
98 help="Don't build; reuse binaries from the last run") | 98 help="Don't build; reuse binaries from the last run") |
99 argparser.add_argument('--dir', dest='dir', metavar='DIRECTORY', | 99 argparser.add_argument('--dir', dest='dir', metavar='DIRECTORY', |
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 help='Path to toolchain binaries.') | 106 help='Path to toolchain binaries.') |
| 107 argparser.add_argument('--filetype', default=None, dest='filetype', |
| 108 help='File type for compilation {asm, iasm, obj}.') |
107 args = argparser.parse_args() | 109 args = argparser.parse_args() |
108 | 110 |
109 # Run from the crosstest directory to make it easy to grab inputs. | 111 # Run from the crosstest directory to make it easy to grab inputs. |
110 crosstest_dir = '{root}/toolchain_build/src/subzero/crosstest'.format( | 112 crosstest_dir = '{root}/toolchain_build/src/subzero/crosstest'.format( |
111 root=root) | 113 root=root) |
112 os.chdir(crosstest_dir) | 114 os.chdir(crosstest_dir) |
113 | 115 |
114 tests = ConfigParser.RawConfigParser() | 116 tests = ConfigParser.RawConfigParser() |
115 tests.read('crosstest.cfg') | 117 tests.read('crosstest.cfg') |
116 | 118 |
(...skipping 25 matching lines...) Expand all Loading... |
142 for sb in sandboxing: | 144 for sb in sandboxing: |
143 for opt in opt_levels: | 145 for opt in opt_levels: |
144 for attr in arch_attrs[target]: | 146 for attr in arch_attrs[target]: |
145 desc = [ test, target, sb, opt, attr ] | 147 desc = [ test, target, sb, opt, attr ] |
146 if Match(set(desc), includes, excludes, default_match): | 148 if Match(set(desc), includes, excludes, default_match): |
147 exe = '{test}_{target}_{sb}_{opt}_{attr}'.format( | 149 exe = '{test}_{target}_{sb}_{opt}_{attr}'.format( |
148 test=test, target=target, sb=sb, opt=opt, | 150 test=test, target=target, sb=sb, opt=opt, |
149 attr=attr) | 151 attr=attr) |
150 extra = (tests.get(test, 'flags').split(' ') | 152 extra = (tests.get(test, 'flags').split(' ') |
151 if tests.has_option(test, 'flags') else []) | 153 if tests.has_option(test, 'flags') else []) |
| 154 if args.filetype: |
| 155 extra += ['--filetype={ftype}'.format(ftype=args.filetype)] |
152 # Generate the compile command. | 156 # Generate the compile command. |
153 cmp_cmd = ( | 157 cmp_cmd = ( |
154 ['{path}/crosstest.py'.format(path=pypath), | 158 ['{path}/crosstest.py'.format(path=pypath), |
155 '-{opt}'.format(opt=opt), | 159 '-{opt}'.format(opt=opt), |
156 '--mattr={attr}'.format(attr=attr), | 160 '--mattr={attr}'.format(attr=attr), |
157 '--prefix=Subzero_', | 161 '--prefix=Subzero_', |
158 '--target={target}'.format(target=target), | 162 '--target={target}'.format(target=target), |
159 '--sandbox={sb}'.format(sb='1' if sb=='sandbox' else '0'), | 163 '--sandbox={sb}'.format(sb='1' if sb=='sandbox' else '0'), |
160 '--dir={dir}'.format(dir=args.dir), | 164 '--dir={dir}'.format(dir=args.dir), |
161 '--output={exe}'.format(exe=exe), | 165 '--output={exe}'.format(exe=exe), |
(...skipping 26 matching lines...) Expand all Loading... |
188 echo=args.verbose) | 192 echo=args.verbose) |
189 if (args.defer): | 193 if (args.defer): |
190 deferred_cmds.append(run_cmd) | 194 deferred_cmds.append(run_cmd) |
191 else: | 195 else: |
192 shellcmd(run_cmd, echo=True) | 196 shellcmd(run_cmd, echo=True) |
193 for run_cmd in deferred_cmds: | 197 for run_cmd in deferred_cmds: |
194 shellcmd(run_cmd, echo=True) | 198 shellcmd(run_cmd, echo=True) |
195 | 199 |
196 if __name__ == '__main__': | 200 if __name__ == '__main__': |
197 main() | 201 main() |
OLD | NEW |