Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: pydir/crosstest.py

Issue 2085303002: Subzero, MIPS32: Cross-testing enabled for MIPS32 (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 subprocess 5 import subprocess
6 import sys 6 import sys
7 import tempfile 7 import tempfile
8 8
9 import targets 9 import targets
10 from szbuild import LinkNonsfi 10 from szbuild import LinkNonsfi
11 from utils import FindBaseNaCl, GetObjcopyCmd, get_sfi_string, shellcmd 11 from utils import FindBaseNaCl, GetObjcopyCmd, get_sfi_string, shellcmd
12 12
13 def main(): 13 def main():
14 """Builds a cross-test binary for comparing Subzero and llc translation. 14 """Builds a cross-test binary for comparing Subzero and llc translation.
15 15
16 Each --test argument is compiled once by llc and once by Subzero. C/C++ 16 Each --test argument is compiled once by llc and once by Subzero. C/C++
17 tests are first compiled down to PNaCl bitcode using pnacl-clang and 17 tests are first compiled down to PNaCl bitcode using pnacl-clang and
18 pnacl-opt. The --prefix argument ensures that symbol names are different 18 pnacl-opt. The --prefix argument ensures that symbol names are different
19 between the two object files, to avoid linking errors. 19 between the two object files, to avoid linking errors.
20 20
21 There is also a --driver argument that specifies the C/C++ file that calls 21 There is also a --driver argument that specifies the C/C++ file that calls
22 the test functions with a variety of interesting inputs and compares their 22 the test functions with a variety of interesting inputs and compares their
23 results. 23 results.
24 24
25 """ 25 """
26 # arch_map maps a Subzero target string to TargetInfo (e.g., triple). 26 # arch_map maps a Subzero target string to TargetInfo (e.g., triple).
27 arch_map = { 'x8632': targets.X8632Target, 27 arch_map = { 'x8632': targets.X8632Target,
28 'x8664': targets.X8664Target, 28 'x8664': targets.X8664Target,
29 'arm32': targets.ARM32Target } 29 'arm32': targets.ARM32Target,
30 'mips32': targets.MIPS32Target}
30 arch_sz_flags = { 'x8632': [], 31 arch_sz_flags = { 'x8632': [],
31 'x8664': [], 32 'x8664': [],
32 # For ARM, test a large stack offset as well. +/- 4095 is 33 # For ARM, test a large stack offset as well. +/- 4095 is
33 # the limit, so test somewhere near that boundary. 34 # the limit, so test somewhere near that boundary.
34 'arm32': ['--test-stack-extra', '4084'] 35 'arm32': ['--test-stack-extra', '4084'],
36 'mips32': ['--test-stack-extra', '4084']
35 } 37 }
36 arch_llc_flags_extra = { 38 arch_llc_flags_extra = {
37 # Use sse2 instructions regardless of input -mattr 39 # Use sse2 instructions regardless of input -mattr
38 # argument to avoid differences in (undefined) behavior of 40 # argument to avoid differences in (undefined) behavior of
39 # converting NaN to int. 41 # converting NaN to int.
40 'x8632': ['-mattr=sse2'], 42 'x8632': ['-mattr=sse2'],
41 'x8664': ['-mattr=sse2'], 43 'x8664': ['-mattr=sse2'],
42 'arm32': [], 44 'arm32': [],
45 'mips32':[],
43 } 46 }
44 desc = 'Build a cross-test that compares Subzero and llc translation.' 47 desc = 'Build a cross-test that compares Subzero and llc translation.'
45 argparser = argparse.ArgumentParser(description=desc) 48 argparser = argparse.ArgumentParser(description=desc)
46 argparser.add_argument('--test', required=True, action='append', 49 argparser.add_argument('--test', required=True, action='append',
47 metavar='TESTFILE_LIST', 50 metavar='TESTFILE_LIST',
48 help='List of C/C++/.ll files with test functions') 51 help='List of C/C++/.ll files with test functions')
49 argparser.add_argument('--driver', required=True, 52 argparser.add_argument('--driver', required=True,
50 metavar='DRIVER', 53 metavar='DRIVER',
51 help='Driver program') 54 help='Driver program')
52 argparser.add_argument('--target', required=False, default='x8632', 55 argparser.add_argument('--target', required=False, default='x8632',
53 choices=arch_map.keys(), 56 choices=arch_map.keys(),
54 metavar='TARGET', 57 metavar='TARGET',
55 help='Translation target architecture.' + 58 help='Translation target architecture.' +
56 ' Default %(default)s.') 59 ' Default %(default)s.')
57 argparser.add_argument('-O', required=False, default='2', dest='optlevel', 60 argparser.add_argument('-O', required=False, default='2', dest='optlevel',
58 choices=['m1', '-1', '0', '1', '2'], 61 choices=['m1', '-1', '0', '1', '2'],
59 metavar='OPTLEVEL', 62 metavar='OPTLEVEL',
60 help='Optimization level for llc and Subzero ' + 63 help='Optimization level for llc and Subzero ' +
61 '(m1 and -1 are equivalent).' + 64 '(m1 and -1 are equivalent).' +
62 ' Default %(default)s.') 65 ' Default %(default)s.')
63 argparser.add_argument('--clang-opt', required=False, default=True, 66 argparser.add_argument('--clang-opt', required=False, default=True,
64 dest='clang_opt') 67 dest='clang_opt')
65 argparser.add_argument('--mattr', required=False, default='sse2', 68 argparser.add_argument('--mattr', required=False, default='sse2',
66 dest='attr', choices=['sse2', 'sse4.1', 69 dest='attr', choices=['sse2', 'sse4.1',
67 'neon', 'hwdiv-arm'], 70 'neon', 'hwdiv-arm', 'base'],
68 metavar='ATTRIBUTE', 71 metavar='ATTRIBUTE',
69 help='Target attribute. Default %(default)s.') 72 help='Target attribute. Default %(default)s.')
70 argparser.add_argument('--sandbox', required=False, default=0, type=int, 73 argparser.add_argument('--sandbox', required=False, default=0, type=int,
71 dest='sandbox', 74 dest='sandbox',
72 help='Use sandboxing. Default "%(default)s".') 75 help='Use sandboxing. Default "%(default)s".')
73 argparser.add_argument('--nonsfi', required=False, default=0, type=int, 76 argparser.add_argument('--nonsfi', required=False, default=0, type=int,
74 dest='nonsfi', 77 dest='nonsfi',
75 help='Use Non-SFI mode. Default "%(default)s".') 78 help='Use Non-SFI mode. Default "%(default)s".')
76 argparser.add_argument('--prefix', required=True, 79 argparser.add_argument('--prefix', required=True,
77 metavar='SZ_PREFIX', 80 metavar='SZ_PREFIX',
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 objs.append(obj_llc) 262 objs.append(obj_llc)
260 if args.nonsfi: 263 if args.nonsfi:
261 LinkNonsfi(objs, os.path.join(args.dir, args.output), args.target) 264 LinkNonsfi(objs, os.path.join(args.dir, args.output), args.target)
262 elif args.sandbox: 265 elif args.sandbox:
263 LinkSandbox(objs, os.path.join(args.dir, args.output), args.target) 266 LinkSandbox(objs, os.path.join(args.dir, args.output), args.target)
264 else: 267 else:
265 LinkNative(objs, os.path.join(args.dir, args.output), args.target) 268 LinkNative(objs, os.path.join(args.dir, args.output), args.target)
266 269
267 if __name__ == '__main__': 270 if __name__ == '__main__':
268 main() 271 main()
OLDNEW
« Makefile.standalone ('K') | « Makefile.standalone ('k') | pydir/crosstest_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698