Chromium Code Reviews| Index: pydir/crosstest_generator.py |
| diff --git a/pydir/crosstest_generator.py b/pydir/crosstest_generator.py |
| index 945ad0086b597ea4dbaf7968919bb20af2b43908..a0aa4fa2347f5300d822dd1e6b953e8d86ae56bc 100755 |
| --- a/pydir/crosstest_generator.py |
| +++ b/pydir/crosstest_generator.py |
| @@ -27,6 +27,22 @@ def Match(desc, includes, excludes, default_match): |
| return True |
| return default_match |
| + |
| +def RunNativePrefix(toolchain_root, target, run_cmd): |
| + """Returns a prefix for running an executable for the target. |
| + |
| + For example, we may be running an ARM or MIPS target executable on an |
| + x86 machine and need to use an emulator. |
| + """ |
| + arch_map = { 'x8632' : '', |
| + 'x8664' : '', |
| + 'arm32' : os.path.join(toolchain_root, 'arm_trusted', |
| + 'run_under_qemu_arm'), |
| + } |
| + prefix = arch_map[target] |
| + return (prefix + ' ' + run_cmd) if prefix else run_cmd |
| + |
| + |
| def main(): |
| """Framework for cross test generation and execution. |
| @@ -39,13 +55,20 @@ def main(): |
| root = FindBaseNaCl() |
| # The rest of the attribute sets. |
| - targets = [ 'x8632' ] |
| + targets = [ 'x8632', 'arm32' ] |
| sandboxing = [ 'native', 'sandbox' ] |
| opt_levels = [ 'Om1', 'O2' ] |
| - arch_attrs = [ 'sse2', 'sse4.1' ] |
| + arch_attrs = { 'x8632': [ 'sse2', 'sse4.1' ], |
| + 'arm32': [ 'neon', 'hwdiv-arm' ] } |
| + flat_attrs = [] |
| + for v in arch_attrs.values(): |
| + flat_attrs += v |
| + arch_flags = { 'x8632': [], |
| + # ARM doesn't have an integrated assembler yet. |
| + 'arm32': ['--filetype=asm'] } |
| # all_keys is only used in the help text. |
| all_keys = '; '.join([' '.join(targets), ' '.join(sandboxing), |
| - ' '.join(opt_levels), ' '.join(arch_attrs)]) |
| + ' '.join(opt_levels), ' '.join(flat_attrs)]) |
| argparser = argparse.ArgumentParser( |
| description=' ' + main.__doc__ + |
| @@ -76,6 +99,8 @@ def main(): |
| help='Output directory') |
| argparser.add_argument('--lit', default=False, action='store_true', |
| help='Generate files for lit testing') |
| + argparser.add_argument('--toolchain-root', dest='toolchain_root', |
| + help='Path to toolchain binaries.') |
| args = argparser.parse_args() |
| # Run from the crosstest directory to make it easy to grab inputs. |
| @@ -113,7 +138,7 @@ def main(): |
| for target in targets: |
| for sb in sandboxing: |
| for opt in opt_levels: |
| - for attr in arch_attrs: |
| + for attr in arch_attrs[target]: |
| desc = [ test, target, sb, opt, attr ] |
| if Match(set(desc), includes, excludes, default_match): |
| exe = '{test}_{target}_{sb}_{opt}_{attr}'.format( |
| @@ -134,12 +159,15 @@ def main(): |
| '--driver={drv}'.format(drv=tests.get(test, 'driver')), |
| ] + extra + \ |
| [ '--test=' + t |
| - for t in tests.get(test, 'test').split(' ') ] |
| + for t in tests.get(test, 'test').split(' ') ] + \ |
|
Jim Stichnoth
2015/06/17 01:14:10
I wonder if we can get rid of the icky backslashes
jvoung (off chromium)
2015/06/17 17:07:53
Done.
|
| + arch_flags[target] |
| run_cmd_base = os.path.join(args.dir, exe) |
| # Generate the run command. |
| run_cmd = run_cmd_base |
| if sb == 'sandbox': |
| run_cmd = '{root}/run.py -q '.format(root=root) + run_cmd |
| + else: |
| + run_cmd = RunNativePrefix(args.toolchain_root, target, run_cmd) |
| if args.lit: |
| # Create a file to drive the lit test. |
| with open(run_cmd_base + '.xtest', 'w') as f: |