Jim Stichnoth | cc0ee13 | 2014-09-17 09:42:53 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python2 |
| 2 | |
| 3 | import argparse |
| 4 | import os |
| 5 | import sys |
| 6 | |
| 7 | import szbuild |
| 8 | |
| 9 | from utils import FindBaseNaCl |
| 10 | |
| 11 | def main(): |
| 12 | """Build native gcc-style executables for one or all Spec2K components. |
| 13 | |
| 14 | Afterwards, the executables can be run from the |
| 15 | native_client/tests/spec2k/ directory as: |
| 16 | './run_all.sh RunBenchmarks SetupGccX8632Opt {train|ref} ...' |
Jim Stichnoth | 9738a9e | 2015-02-23 16:39:06 -0800 | [diff] [blame] | 17 | -- or -- |
| 18 | './run_all.sh RunBenchmarks SetupPnaclX8632Opt {train|ref} ...' |
Jim Stichnoth | cc0ee13 | 2014-09-17 09:42:53 -0700 | [diff] [blame] | 19 | """ |
| 20 | nacl_root = FindBaseNaCl() |
Jim Stichnoth | 336f6c4 | 2014-10-30 15:01:31 -0700 | [diff] [blame] | 21 | # Use the same default ordering as spec2k/run_all.sh. |
| 22 | components = [ '177.mesa', '179.art', '183.equake', '188.ammp', '164.gzip', |
| 23 | '175.vpr', '176.gcc', '181.mcf', '186.crafty', '197.parser', |
| 24 | '253.perlbmk', '254.gap', '255.vortex', '256.bzip2', |
| 25 | '300.twolf', '252.eon' ] |
Jim Stichnoth | cc0ee13 | 2014-09-17 09:42:53 -0700 | [diff] [blame] | 26 | |
| 27 | argparser = argparse.ArgumentParser(description=main.__doc__) |
| 28 | szbuild.AddOptionalArgs(argparser) |
| 29 | argparser.add_argument('comps', nargs='*', default=components) |
| 30 | args = argparser.parse_args() |
| 31 | bad = set(args.comps) - set(components) |
| 32 | if bad: |
| 33 | print 'Unknown component{s}: '.format(s='s' if len(bad) > 1 else '') + \ |
| 34 | ' '.join(x for x in bad) |
| 35 | sys.exit(1) |
Jim Stichnoth | 9738a9e | 2015-02-23 16:39:06 -0800 | [diff] [blame] | 36 | suffix = 'pnacl.opt.x8632' if args.sandbox else 'gcc.opt.x8632' |
Jim Stichnoth | cc0ee13 | 2014-09-17 09:42:53 -0700 | [diff] [blame] | 37 | for comp in args.comps: |
| 38 | name = os.path.splitext(comp)[1] or comp |
| 39 | if name[0] == '.': |
| 40 | name = name[1:] |
| 41 | szbuild.ProcessPexe(args, |
| 42 | ('{root}/tests/spec2k/{comp}/' + |
| 43 | '{name}.opt.stripped.pexe' |
| 44 | ).format(root=nacl_root, comp=comp, name=name), |
| 45 | ('{root}/tests/spec2k/{comp}/' + |
Jim Stichnoth | 9738a9e | 2015-02-23 16:39:06 -0800 | [diff] [blame] | 46 | '{name}.{suffix}' |
| 47 | ).format(root=nacl_root, comp=comp, name=name, |
| 48 | suffix=suffix)) |
Jim Stichnoth | cc0ee13 | 2014-09-17 09:42:53 -0700 | [diff] [blame] | 49 | |
| 50 | if __name__ == '__main__': |
| 51 | main() |