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 -- or -- |
| 18 './run_all.sh RunBenchmarks SetupPnaclX8632Opt {train|ref} ...' |
17 """ | 19 """ |
18 nacl_root = FindBaseNaCl() | 20 nacl_root = FindBaseNaCl() |
19 # Use the same default ordering as spec2k/run_all.sh. | 21 # Use the same default ordering as spec2k/run_all.sh. |
20 components = [ '177.mesa', '179.art', '183.equake', '188.ammp', '164.gzip', | 22 components = [ '177.mesa', '179.art', '183.equake', '188.ammp', '164.gzip', |
21 '175.vpr', '176.gcc', '181.mcf', '186.crafty', '197.parser', | 23 '175.vpr', '176.gcc', '181.mcf', '186.crafty', '197.parser', |
22 '253.perlbmk', '254.gap', '255.vortex', '256.bzip2', | 24 '253.perlbmk', '254.gap', '255.vortex', '256.bzip2', |
23 '300.twolf', '252.eon' ] | 25 '300.twolf', '252.eon' ] |
24 | 26 |
25 argparser = argparse.ArgumentParser(description=main.__doc__) | 27 argparser = argparse.ArgumentParser(description=main.__doc__) |
26 szbuild.AddOptionalArgs(argparser) | 28 szbuild.AddOptionalArgs(argparser) |
27 argparser.add_argument('comps', nargs='*', default=components) | 29 argparser.add_argument('comps', nargs='*', default=components) |
28 args = argparser.parse_args() | 30 args = argparser.parse_args() |
29 bad = set(args.comps) - set(components) | 31 bad = set(args.comps) - set(components) |
30 if bad: | 32 if bad: |
31 print 'Unknown component{s}: '.format(s='s' if len(bad) > 1 else '') + \ | 33 print 'Unknown component{s}: '.format(s='s' if len(bad) > 1 else '') + \ |
32 ' '.join(x for x in bad) | 34 ' '.join(x for x in bad) |
33 sys.exit(1) | 35 sys.exit(1) |
| 36 suffix = 'pnacl.opt.x8632' if args.sandbox else 'gcc.opt.x8632' |
34 for comp in args.comps: | 37 for comp in args.comps: |
35 name = os.path.splitext(comp)[1] or comp | 38 name = os.path.splitext(comp)[1] or comp |
36 if name[0] == '.': | 39 if name[0] == '.': |
37 name = name[1:] | 40 name = name[1:] |
38 szbuild.ProcessPexe(args, | 41 szbuild.ProcessPexe(args, |
39 ('{root}/tests/spec2k/{comp}/' + | 42 ('{root}/tests/spec2k/{comp}/' + |
40 '{name}.opt.stripped.pexe' | 43 '{name}.opt.stripped.pexe' |
41 ).format(root=nacl_root, comp=comp, name=name), | 44 ).format(root=nacl_root, comp=comp, name=name), |
42 ('{root}/tests/spec2k/{comp}/' + | 45 ('{root}/tests/spec2k/{comp}/' + |
43 '{name}.gcc.opt.x8632' | 46 '{name}.{suffix}' |
44 ).format(root=nacl_root, comp=comp, name=name)) | 47 ).format(root=nacl_root, comp=comp, name=name, |
| 48 suffix=suffix)) |
45 | 49 |
46 if __name__ == '__main__': | 50 if __name__ == '__main__': |
47 main() | 51 main() |
OLD | NEW |