OLD | NEW |
1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 |
2 | 2 |
3 import argparse | 3 import argparse |
4 import collections | 4 import collections |
5 import ConfigParser | 5 import ConfigParser |
6 import os | 6 import os |
7 import shutil | 7 import shutil |
8 import sys | 8 import sys |
9 | 9 |
10 from utils import shellcmd | 10 from utils import shellcmd |
(...skipping 21 matching lines...) Expand all Loading... |
32 def RunNativePrefix(toolchain_root, target, attr, run_cmd): | 32 def RunNativePrefix(toolchain_root, target, attr, run_cmd): |
33 """Returns a prefix for running an executable for the target. | 33 """Returns a prefix for running an executable for the target. |
34 | 34 |
35 For example, we may be running an ARM or MIPS target executable on an | 35 For example, we may be running an ARM or MIPS target executable on an |
36 x86 machine and need to use an emulator. | 36 x86 machine and need to use an emulator. |
37 """ | 37 """ |
38 arch_map = { 'x8632' : '', | 38 arch_map = { 'x8632' : '', |
39 'x8664' : '', | 39 'x8664' : '', |
40 'arm32' : os.path.join(toolchain_root, 'arm_trusted', | 40 'arm32' : os.path.join(toolchain_root, 'arm_trusted', |
41 'run_under_qemu_arm'), | 41 'run_under_qemu_arm'), |
| 42 'mips32': os.path.join(toolchain_root, 'mips_trusted', |
| 43 'run_under_qemu_mips32'), |
42 } | 44 } |
43 attr_map = collections.defaultdict(str, { | 45 attr_map = collections.defaultdict(str, { |
44 'arm32-neon': ' -cpu cortex-a9', | 46 'arm32-neon': ' -cpu cortex-a9', |
45 'arm32-hwdiv-arm': ' -cpu cortex-a15' }) | 47 'arm32-hwdiv-arm': ' -cpu cortex-a15' }) |
46 prefix = arch_map[target] + attr_map[target + '-' + attr] | 48 prefix = arch_map[target] + attr_map[target + '-' + attr] |
47 return (prefix + ' ' + run_cmd) if prefix else run_cmd | 49 return (prefix + ' ' + run_cmd) if prefix else run_cmd |
48 | 50 |
49 def NonsfiLoaderArch(target): | 51 def NonsfiLoaderArch(target): |
50 """Returns the arch for the nonsfi_loader""" | 52 """Returns the arch for the nonsfi_loader""" |
51 arch_map = { 'arm32' : 'arm', | 53 arch_map = { 'arm32' : 'arm', |
52 'x8632' : 'x86-32', | 54 'x8632' : 'x86-32', |
| 55 'mips32' : 'mips', |
53 } | 56 } |
54 return arch_map[target] | 57 return arch_map[target] |
55 | 58 |
56 | 59 |
57 def main(): | 60 def main(): |
58 """Framework for cross test generation and execution. | 61 """Framework for cross test generation and execution. |
59 | 62 |
60 Builds and executes cross tests from the space of all possible attribute | 63 Builds and executes cross tests from the space of all possible attribute |
61 combinations. The space can be restricted by providing subsets of attributes | 64 combinations. The space can be restricted by providing subsets of attributes |
62 to specifically include or exclude. | 65 to specifically include or exclude. |
63 """ | 66 """ |
64 # pypath is where to find other Subzero python scripts. | 67 # pypath is where to find other Subzero python scripts. |
65 pypath = os.path.abspath(os.path.dirname(sys.argv[0])) | 68 pypath = os.path.abspath(os.path.dirname(sys.argv[0])) |
66 root = FindBaseNaCl() | 69 root = FindBaseNaCl() |
67 | 70 |
68 # The rest of the attribute sets. | 71 # The rest of the attribute sets. |
69 targets = [ 'x8632', 'x8664', 'arm32' ] | 72 targets = [ 'x8632', 'x8664', 'arm32', 'mips32' ] |
70 sandboxing = [ 'native', 'sandbox', 'nonsfi' ] | 73 sandboxing = [ 'native', 'sandbox', 'nonsfi' ] |
71 opt_levels = [ 'Om1', 'O2' ] | 74 opt_levels = [ 'Om1', 'O2' ] |
72 arch_attrs = { 'x8632': [ 'sse2', 'sse4.1' ], | 75 arch_attrs = { 'x8632': [ 'sse2', 'sse4.1' ], |
73 'x8664': [ 'sse2', 'sse4.1' ], | 76 'x8664': [ 'sse2', 'sse4.1' ], |
74 'arm32': [ 'neon', 'hwdiv-arm' ] } | 77 'arm32': [ 'neon', 'hwdiv-arm' ], |
| 78 'mips32': ['base'] } |
75 flat_attrs = [] | 79 flat_attrs = [] |
76 for v in arch_attrs.values(): | 80 for v in arch_attrs.values(): |
77 flat_attrs += v | 81 flat_attrs += v |
78 arch_flags = { 'x8632': [], | 82 arch_flags = { 'x8632': [], |
79 'x8664': [], | 83 'x8664': [], |
80 'arm32': [] } | 84 'arm32': [], |
| 85 'mips32': []} |
81 # all_keys is only used in the help text. | 86 # all_keys is only used in the help text. |
82 all_keys = '; '.join([' '.join(targets), ' '.join(sandboxing), | 87 all_keys = '; '.join([' '.join(targets), ' '.join(sandboxing), |
83 ' '.join(opt_levels), ' '.join(flat_attrs)]) | 88 ' '.join(opt_levels), ' '.join(flat_attrs)]) |
84 | 89 |
85 argparser = argparse.ArgumentParser( | 90 argparser = argparse.ArgumentParser( |
86 description=' ' + main.__doc__ + | 91 description=' ' + main.__doc__ + |
87 'The set of attributes is the set of tests plus the following:\n' + | 92 'The set of attributes is the set of tests plus the following:\n' + |
88 all_keys, formatter_class=argparse.RawTextHelpFormatter) | 93 all_keys, formatter_class=argparse.RawTextHelpFormatter) |
89 argparser.add_argument('--config', default='crosstest.cfg', dest='config', | 94 argparser.add_argument('--config', default='crosstest.cfg', dest='config', |
90 metavar='FILE', help='Test configuration file') | 95 metavar='FILE', help='Test configuration file') |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 echo=args.verbose) | 220 echo=args.verbose) |
216 if (args.defer): | 221 if (args.defer): |
217 deferred_cmds.append(run_cmd) | 222 deferred_cmds.append(run_cmd) |
218 else: | 223 else: |
219 shellcmd(run_cmd, echo=True) | 224 shellcmd(run_cmd, echo=True) |
220 for run_cmd in deferred_cmds: | 225 for run_cmd in deferred_cmds: |
221 shellcmd(run_cmd, echo=True) | 226 shellcmd(run_cmd, echo=True) |
222 | 227 |
223 if __name__ == '__main__': | 228 if __name__ == '__main__': |
224 main() | 229 main() |
OLD | NEW |