Chromium Code Reviews| 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', |
| 48 'mips32-base': ' -cpu mips32r5-generic'}) | |
| 46 prefix = arch_map[target] + attr_map[target + '-' + attr] | 49 prefix = arch_map[target] + attr_map[target + '-' + attr] |
| 47 return (prefix + ' ' + run_cmd) if prefix else run_cmd | 50 return (prefix + ' ' + run_cmd) if prefix else run_cmd |
| 48 | 51 |
| 49 def NonsfiLoaderArch(target): | 52 def NonsfiLoaderArch(target): |
| 50 """Returns the arch for the nonsfi_loader""" | 53 """Returns the arch for the nonsfi_loader""" |
| 51 arch_map = { 'arm32' : 'arm', | 54 arch_map = { 'arm32' : 'arm', |
| 52 'x8632' : 'x86-32', | 55 'x8632' : 'x86-32', |
| 56 'mips32' : 'mips', | |
| 53 } | 57 } |
| 54 return arch_map[target] | 58 return arch_map[target] |
| 55 | 59 |
| 56 | 60 |
| 57 def main(): | 61 def main(): |
| 58 """Framework for cross test generation and execution. | 62 """Framework for cross test generation and execution. |
| 59 | 63 |
| 60 Builds and executes cross tests from the space of all possible attribute | 64 Builds and executes cross tests from the space of all possible attribute |
| 61 combinations. The space can be restricted by providing subsets of attributes | 65 combinations. The space can be restricted by providing subsets of attributes |
| 62 to specifically include or exclude. | 66 to specifically include or exclude. |
| 63 """ | 67 """ |
| 64 # pypath is where to find other Subzero python scripts. | 68 # pypath is where to find other Subzero python scripts. |
| 65 pypath = os.path.abspath(os.path.dirname(sys.argv[0])) | 69 pypath = os.path.abspath(os.path.dirname(sys.argv[0])) |
| 66 root = FindBaseNaCl() | 70 root = FindBaseNaCl() |
| 67 | 71 |
| 68 # The rest of the attribute sets. | 72 # The rest of the attribute sets. |
| 69 targets = [ 'x8632', 'x8664', 'arm32' ] | 73 targets = [ 'x8632', 'x8664', 'arm32', 'mips32' ] |
| 70 sandboxing = [ 'native', 'sandbox', 'nonsfi' ] | 74 sandboxing = [ 'native', 'sandbox', 'nonsfi' ] |
| 71 opt_levels = [ 'Om1', 'O2' ] | 75 opt_levels = [ 'Om1', 'O2' ] |
| 72 arch_attrs = { 'x8632': [ 'sse2', 'sse4.1' ], | 76 arch_attrs = { 'x8632': [ 'sse2', 'sse4.1' ], |
| 73 'x8664': [ 'sse2', 'sse4.1' ], | 77 'x8664': [ 'sse2', 'sse4.1' ], |
| 74 'arm32': [ 'neon', 'hwdiv-arm' ] } | 78 'arm32': [ 'neon', 'hwdiv-arm' ], |
| 79 'mips32': ['base'] } | |
|
Jim Stichnoth
2016/08/23 14:56:49
[ 'base' ]
for consistency
obucinac
2016/09/05 16:55:59
Done.
| |
| 75 flat_attrs = [] | 80 flat_attrs = [] |
| 76 for v in arch_attrs.values(): | 81 for v in arch_attrs.values(): |
| 77 flat_attrs += v | 82 flat_attrs += v |
| 78 arch_flags = { 'x8632': [], | 83 arch_flags = { 'x8632': [], |
| 79 'x8664': [], | 84 'x8664': [], |
| 80 'arm32': [] } | 85 'arm32': [], |
| 86 'mips32': []} | |
|
Jim Stichnoth
2016/08/23 14:56:49
Add back in the space before the closing brace?
obucinac
2016/09/05 16:55:59
Done.
| |
| 81 # all_keys is only used in the help text. | 87 # all_keys is only used in the help text. |
| 82 all_keys = '; '.join([' '.join(targets), ' '.join(sandboxing), | 88 all_keys = '; '.join([' '.join(targets), ' '.join(sandboxing), |
| 83 ' '.join(opt_levels), ' '.join(flat_attrs)]) | 89 ' '.join(opt_levels), ' '.join(flat_attrs)]) |
| 84 | 90 |
| 85 argparser = argparse.ArgumentParser( | 91 argparser = argparse.ArgumentParser( |
| 86 description=' ' + main.__doc__ + | 92 description=' ' + main.__doc__ + |
| 87 'The set of attributes is the set of tests plus the following:\n' + | 93 'The set of attributes is the set of tests plus the following:\n' + |
| 88 all_keys, formatter_class=argparse.RawTextHelpFormatter) | 94 all_keys, formatter_class=argparse.RawTextHelpFormatter) |
| 89 argparser.add_argument('--config', default='crosstest.cfg', dest='config', | 95 argparser.add_argument('--config', default='crosstest.cfg', dest='config', |
| 90 metavar='FILE', help='Test configuration file') | 96 metavar='FILE', help='Test configuration file') |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 echo=args.verbose) | 221 echo=args.verbose) |
| 216 if (args.defer): | 222 if (args.defer): |
| 217 deferred_cmds.append(run_cmd) | 223 deferred_cmds.append(run_cmd) |
| 218 else: | 224 else: |
| 219 shellcmd(run_cmd, echo=True) | 225 shellcmd(run_cmd, echo=True) |
| 220 for run_cmd in deferred_cmds: | 226 for run_cmd in deferred_cmds: |
| 221 shellcmd(run_cmd, echo=True) | 227 shellcmd(run_cmd, echo=True) |
| 222 | 228 |
| 223 if __name__ == '__main__': | 229 if __name__ == '__main__': |
| 224 main() | 230 main() |
| OLD | NEW |