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