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 24 matching lines...) Expand all Loading... |
35 x86 machine and need to use an emulator. | 35 x86 machine and need to use an emulator. |
36 """ | 36 """ |
37 arch_map = { 'x8632' : '', | 37 arch_map = { 'x8632' : '', |
38 'x8664' : '', | 38 'x8664' : '', |
39 'arm32' : os.path.join(toolchain_root, 'arm_trusted', | 39 'arm32' : os.path.join(toolchain_root, 'arm_trusted', |
40 'run_under_qemu_arm'), | 40 'run_under_qemu_arm'), |
41 } | 41 } |
42 prefix = arch_map[target] | 42 prefix = arch_map[target] |
43 return (prefix + ' ' + run_cmd) if prefix else run_cmd | 43 return (prefix + ' ' + run_cmd) if prefix else run_cmd |
44 | 44 |
| 45 def NonsfiLoaderArch(target): |
| 46 """Returns the arch for the nonsfi_loader""" |
| 47 arch_map = { 'arm32' : 'arm', |
| 48 'x8632' : 'x86-32', |
| 49 } |
| 50 return arch_map[target] |
| 51 |
45 | 52 |
46 def main(): | 53 def main(): |
47 """Framework for cross test generation and execution. | 54 """Framework for cross test generation and execution. |
48 | 55 |
49 Builds and executes cross tests from the space of all possible attribute | 56 Builds and executes cross tests from the space of all possible attribute |
50 combinations. The space can be restricted by providing subsets of attributes | 57 combinations. The space can be restricted by providing subsets of attributes |
51 to specifically include or exclude. | 58 to specifically include or exclude. |
52 """ | 59 """ |
53 # pypath is where to find other Subzero python scripts. | 60 # pypath is where to find other Subzero python scripts. |
54 pypath = os.path.abspath(os.path.dirname(sys.argv[0])) | 61 pypath = os.path.abspath(os.path.dirname(sys.argv[0])) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 extra + | 176 extra + |
170 ['--test=' + t | 177 ['--test=' + t |
171 for t in tests.get(test, 'test').split(' ')] + | 178 for t in tests.get(test, 'test').split(' ')] + |
172 arch_flags[target]) | 179 arch_flags[target]) |
173 run_cmd_base = os.path.join(args.dir, exe) | 180 run_cmd_base = os.path.join(args.dir, exe) |
174 # Generate the run command. | 181 # Generate the run command. |
175 run_cmd = run_cmd_base | 182 run_cmd = run_cmd_base |
176 if sb == 'sandbox': | 183 if sb == 'sandbox': |
177 run_cmd = '{root}/run.py -q '.format(root=root) + run_cmd | 184 run_cmd = '{root}/run.py -q '.format(root=root) + run_cmd |
178 elif sb == 'nonsfi': | 185 elif sb == 'nonsfi': |
179 run_cmd = ('{root}/scons-out/opt-linux-x86-32/obj/src/nonsfi/' + | 186 run_cmd = ( |
180 'loader/nonsfi_loader ').format(root=root) + run_cmd | 187 '{root}/scons-out/opt-linux-{arch}/obj/src/nonsfi/' + |
| 188 'loader/nonsfi_loader ').format( |
| 189 root=root, arch=NonsfiLoaderArch(target)) + run_cmd |
| 190 run_cmd = RunNativePrefix(args.toolchain_root, target, run_cmd) |
181 else: | 191 else: |
182 run_cmd = RunNativePrefix(args.toolchain_root, target, run_cmd) | 192 run_cmd = RunNativePrefix(args.toolchain_root, target, run_cmd) |
183 if args.lit: | 193 if args.lit: |
184 # Create a file to drive the lit test. | 194 # Create a file to drive the lit test. |
185 with open(run_cmd_base + '.xtest', 'w') as f: | 195 with open(run_cmd_base + '.xtest', 'w') as f: |
186 f.write('# RUN: sh %s | FileCheck %s\n') | 196 f.write('# RUN: sh %s | FileCheck %s\n') |
187 f.write('cd ' + crosstest_dir + ' && \\\n') | 197 f.write('cd ' + crosstest_dir + ' && \\\n') |
188 f.write(' '.join(cmp_cmd) + ' && \\\n') | 198 f.write(' '.join(cmp_cmd) + ' && \\\n') |
189 f.write(run_cmd + '\n') | 199 f.write(run_cmd + '\n') |
190 f.write('echo Recreate a failure using ' + __file__ + | 200 f.write('echo Recreate a failure using ' + __file__ + |
191 ' --toolchain-root=' + args.toolchain_root + | 201 ' --toolchain-root=' + args.toolchain_root + |
192 ' --include=' + ','.join(desc) + '\n') | 202 ' --include=' + ','.join(desc) + '\n') |
193 f.write('# CHECK: Failures=0\n') | 203 f.write('# CHECK: Failures=0\n') |
194 else: | 204 else: |
195 if not args.no_compile: | 205 if not args.no_compile: |
196 shellcmd(cmp_cmd, | 206 shellcmd(cmp_cmd, |
197 echo=args.verbose) | 207 echo=args.verbose) |
198 if (args.defer): | 208 if (args.defer): |
199 deferred_cmds.append(run_cmd) | 209 deferred_cmds.append(run_cmd) |
200 else: | 210 else: |
201 shellcmd(run_cmd, echo=True) | 211 shellcmd(run_cmd, echo=True) |
202 for run_cmd in deferred_cmds: | 212 for run_cmd in deferred_cmds: |
203 shellcmd(run_cmd, echo=True) | 213 shellcmd(run_cmd, echo=True) |
204 | 214 |
205 if __name__ == '__main__': | 215 if __name__ == '__main__': |
206 main() | 216 main() |
OLD | NEW |