blob: 416252553b3a8fe5241bf9607d3d7051e3a3b8fa [file] [log] [blame]
Jim Stichnothcc0ee132014-09-17 09:42:53 -07001#!/usr/bin/env python2
2
3import argparse
4import os
5import sys
6
7import szbuild
8
9from utils import FindBaseNaCl
10
11def 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 Stichnoth9738a9e2015-02-23 16:39:06 -080017 -- or --
18 './run_all.sh RunBenchmarks SetupPnaclX8632Opt {train|ref} ...'
Jim Stichnothcc0ee132014-09-17 09:42:53 -070019 """
20 nacl_root = FindBaseNaCl()
Jim Stichnoth336f6c42014-10-30 15:01:31 -070021 # 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 Stichnothcc0ee132014-09-17 09:42:53 -070026
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 Stichnoth9738a9e2015-02-23 16:39:06 -080036 suffix = 'pnacl.opt.x8632' if args.sandbox else 'gcc.opt.x8632'
Jim Stichnothcc0ee132014-09-17 09:42:53 -070037 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 Stichnoth9738a9e2015-02-23 16:39:06 -080046 '{name}.{suffix}'
47 ).format(root=nacl_root, comp=comp, name=name,
48 suffix=suffix))
Jim Stichnothcc0ee132014-09-17 09:42:53 -070049
50if __name__ == '__main__':
51 main()