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

Side by Side Diff: tests_lit/lit.cfg

Issue 689753002: Remove building llvm2ice.build_atts from Subzero build. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 6 years, 1 month 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
« pydir/if.py ('K') | « pydir/ifatts.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # -*- Python -*- 1 # -*- Python -*-
2 # Taken from utils/lit/tests in the LLVM tree and hacked together to support 2 # Taken from utils/lit/tests in the LLVM tree and hacked together to support
3 # our tests. 3 # our tests.
4 # 4 #
5 # Note: This configuration has simple commands to run Subzero's translator. 5 # Note: This configuration has simple commands to run Subzero's translator.
6 # They have the form %X2i (i.e. %p2i, %l2i, and %lc2i) where X is defined 6 # They have the form %X2i (i.e. %p2i, %l2i, and %lc2i) where X is defined
7 # as follows: 7 # as follows:
8 # 8 #
9 # p : Run Subzero's translator, building ICE from PNaCl bitcode directly. 9 # p : Run Subzero's translator, building ICE from PNaCl bitcode directly.
10 # l : Run Subzero's translator, converting the .ll file to a PNaCl bitcode 10 # l : Run Subzero's translator, converting the .ll file to a PNaCl bitcode
(...skipping 21 matching lines...) Expand all
32 # existence of %l2i and %lc2i), you can use the %if command (which is 32 # existence of %l2i and %lc2i), you can use the %if command (which is
33 # a short hand for using pydir/ifatts.py). 33 # a short hand for using pydir/ifatts.py).
34 34
35 import os 35 import os
36 import re 36 import re
37 import sys 37 import sys
38 38
39 import lit.formats 39 import lit.formats
40 40
41 sys.path.insert(0, 'pydir') 41 sys.path.insert(0, 'pydir')
42 from utils import FindBaseNaCl 42 from utils import FindBaseNaCl, shellcmd
43 from ifatts import GetFileAttributes 43 from ifatts import GetFileAttributes
44 44
45 # name: The name of this test suite. 45 # name: The name of this test suite.
46 config.name = 'subzero' 46 config.name = 'subzero'
47 47
48 # testFormat: The test format to use to interpret tests. 48 # testFormat: The test format to use to interpret tests.
49 config.test_format = lit.formats.ShTest() 49 config.test_format = lit.formats.ShTest()
50 50
51 # suffixes: A list of file extensions to treat as test files. 51 # suffixes: A list of file extensions to treat as test files.
52 config.suffixes = ['.ll'] 52 config.suffixes = ['.ll']
53 53
54 # test_source_root: The root path where tests are located. 54 # test_source_root: The root path where tests are located.
55 config.test_source_root = os.path.dirname(__file__) 55 config.test_source_root = os.path.dirname(__file__)
56 config.test_exec_root = config.test_source_root 56 config.test_exec_root = config.test_source_root
57 config.target_triple = '(unused)' 57 config.target_triple = '(unused)'
58 58
59 src_root = os.path.join(FindBaseNaCl(), 'toolchain_build/src/subzero') 59 src_root = os.path.join(FindBaseNaCl(), 'toolchain_build/src/subzero')
60 bin_root = src_root 60 bin_root = src_root
61 config.substitutions.append(('%{src_root}', src_root)) 61 config.substitutions.append(('%{src_root}', src_root))
62 config.substitutions.append(('%{python}', sys.executable)) 62 config.substitutions.append(('%{python}', sys.executable))
63 63
64 pydir = os.path.join(bin_root, 'pydir') 64 pydir = os.path.join(bin_root, 'pydir')
65 65
66 # Finding LLVM binary tools. All tools used in the tests must be listed in 66 # Finding LLVM binary tools. All tools used in the tests must be listed in
67 # the llvmbintools list. 67 # the llvmbintools list.
68 llvmbinpath = os.path.abspath(os.environ.get('LLVM_BIN_PATH')) 68 llvmbinpath = os.path.abspath(os.environ.get('LLVM_BIN_PATH'))
69 69
70 # Define the location of the llvm2ice tool. 70 # Define the location of the llvm2ice tool.
71 llvm2icetool = os.path.join(bin_root, 'llvm2ice') 71 llvm2icetool = os.path.join(bin_root, 'llvm2ice')
72 llvm2icetoolatts = os.path.join(bin_root, 'llvm2ice.build_atts') 72 llvm2iceatts = shellcmd(' '.join([llvm2icetool, '--build-atts']),
73 echo=False).split()
73 74
74 # Add build attributes of llvm2ice tool to the set of available features. 75 # Add build attributes of llvm2ice tool to the set of available features.
75 config.available_features.update(GetFileAttributes(llvm2icetoolatts)) 76 config.available_features.update(llvm2iceatts)
76 77
77 # Base command for testing build attributes 78 def if_cond_flag(Value):
78 if_atts_base = [os.path.join(pydir, 'ifatts.py'), llvm2icetoolatts] 79 if Value:
79 if_atts_cmd = if_atts_base + ['--command'] 80 return '--cond=true'
80 ifl2i_atts_cmd = if_atts_base + ['--att=allow_llvm_ir', '--command'] 81 else:
81 iflc2i_atts_cmd = if_atts_base + ['--att=allow_llvm_ir', 82 return '--cond=false'
82 '--att=allow_llvm_ir_as_input', 83
83 '--command'] 84 # shell conditional commands.
85 if_atts = [os.path.join(pydir, 'if.py')]
86 if_atts_cmd = (if_atts + ['--have=' + att for att in llvm2iceatts] +
87 ['--command'])
88 ifl2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir' in llvm2iceatts),
89 '--command']
90 iflc2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir_as_input'
91 in llvm2iceatts), '--command']
84 92
85 # Base command for running llvm2ice 93 # Base command for running llvm2ice
86 llvm2ice_cmd = [os.path.join(pydir, 'run-llvm2ice.py'), 94 llvm2ice_cmd = [os.path.join(pydir, 'run-llvm2ice.py'),
87 '--llvm2ice', llvm2icetool, 95 '--llvm2ice', llvm2icetool,
88 '--llvm-bin-path', llvmbinpath] 96 '--llvm-bin-path', llvmbinpath]
89 97
90 # Run commands only if corresponding build attributes apply, including 98 # Run commands only if corresponding build attributes apply, including
91 # for each compiler setup. 99 # for each compiler setup.
92 config.substitutions.append(('%ifp', ' ')) 100 config.substitutions.append(('%ifp', ' '))
93 config.substitutions.append(('%iflc', ' '.join(iflc2i_atts_cmd))) 101 config.substitutions.append(('%iflc', ' '.join(iflc2i_atts_cmd)))
(...skipping 28 matching lines...) Expand all
122 # Add a feature to detect the Python version. 130 # Add a feature to detect the Python version.
123 config.available_features.add("python%d.%d" % (sys.version_info[0], 131 config.available_features.add("python%d.%d" % (sys.version_info[0],
124 sys.version_info[1])) 132 sys.version_info[1]))
125 133
126 # Debugging output 134 # Debugging output
127 def dbg(s): 135 def dbg(s):
128 print '[DBG] %s' % s 136 print '[DBG] %s' % s
129 137
130 dbg('bin_root = %s' % bin_root) 138 dbg('bin_root = %s' % bin_root)
131 dbg('llvmbinpath = %s' % llvmbinpath) 139 dbg('llvmbinpath = %s' % llvmbinpath)
140 dbg("Build attributes = %s" % llvm2iceatts)
OLDNEW
« pydir/if.py ('K') | « pydir/ifatts.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698