0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 # -*- Python -*-
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 # Configuration file for the 'lit' test runner.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 import os
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 import sys
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 import re
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 import platform
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 import lit.util
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 import lit.formats
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 # name: The name of this test suite.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 config.name = 'LLVM'
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 # Tweak PATH for Win32 to decide to use bash.exe or not.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 if sys.platform in ['win32']:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 # Seek sane tools in directories and set to $PATH.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 path = getattr(config, 'lit_tools_dir', None)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 path = lit_config.getToolsPath(path,
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 config.environment['PATH'],
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 ['cmp.exe', 'grep.exe', 'sed.exe'])
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 if path is not None:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 path = os.path.pathsep.join((path,
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 config.environment['PATH']))
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 config.environment['PATH'] = path
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 # Choose between lit's internal shell pipeline runner and a real shell. If
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 # LIT_USE_INTERNAL_SHELL is in the environment, we use that as an override.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 if use_lit_shell:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 # 0 is external, "" is default, and everything else is internal.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 execute_external = (use_lit_shell == "0")
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 else:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 # Otherwise we default to internal on Windows and external elsewhere, as
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 # bash on Windows is usually very slow.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 execute_external = (not sys.platform in ['win32'])
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 # testFormat: The test format to use to interpret tests.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 config.test_format = lit.formats.ShTest(execute_external)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 # suffixes: A list of file extensions to treat as test files. This is overriden
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 # by individual lit.local.cfg files in the test subdirectories.
|
95
|
44 config.suffixes = ['.ll', '.c', '.cxx', '.test', '.txt', '.s']
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47 # subdirectories contain auxiliary inputs for various tests in their parent
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 # directories.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49 config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt']
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 # test_source_root: The root path where tests are located.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
52 config.test_source_root = os.path.dirname(__file__)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54 # test_exec_root: The root path where tests should be run.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55 llvm_obj_root = getattr(config, 'llvm_obj_root', None)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
56 if llvm_obj_root is not None:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
57 config.test_exec_root = os.path.join(llvm_obj_root, 'test')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
58
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
59 # Tweak the PATH to include the tools dir.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
60 if llvm_obj_root is not None:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
62 if not llvm_tools_dir:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63 lit_config.fatal('No LLVM tools dir set!')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64 path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 config.environment['PATH'] = path
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 # Propagate 'HOME' through the environment.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
68 if 'HOME' in os.environ:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 config.environment['HOME'] = os.environ['HOME']
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71 # Propagate 'INCLUDE' through the environment.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 if 'INCLUDE' in os.environ:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
73 config.environment['INCLUDE'] = os.environ['INCLUDE']
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
74
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
75 # Propagate 'LIB' through the environment.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
76 if 'LIB' in os.environ:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
77 config.environment['LIB'] = os.environ['LIB']
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
78
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
79 # Propagate the temp directory. Windows requires this because it uses \Windows\
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
80 # if none of these are present.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
81 if 'TMP' in os.environ:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 config.environment['TMP'] = os.environ['TMP']
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
83 if 'TEMP' in os.environ:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
84 config.environment['TEMP'] = os.environ['TEMP']
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
85
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
86 # Propagate LLVM_SRC_ROOT into the environment.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
87 config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
88
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
89 # Propagate PYTHON_EXECUTABLE into the environment
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
90 config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable',
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 '')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
92
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
93 # Propagate path to symbolizer for ASan/MSan.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
94 for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
95 if symbolizer in os.environ:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
96 config.environment[symbolizer] = os.environ[symbolizer]
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
97
|
83
|
98 # Set up OCAMLPATH to include newly built OCaml libraries.
|
|
99 llvm_lib_dir = getattr(config, 'llvm_lib_dir', None)
|
|
100 if llvm_lib_dir is None:
|
|
101 if llvm_obj_root is not None:
|
|
102 llvm_lib_dir = os.path.join(llvm_obj_root, 'lib')
|
|
103
|
|
104 if llvm_lib_dir is not None:
|
|
105 llvm_ocaml_lib = os.path.join(llvm_lib_dir, 'ocaml')
|
|
106 if llvm_ocaml_lib is not None:
|
|
107 if 'OCAMLPATH' in os.environ:
|
|
108 ocamlpath = os.path.pathsep.join((llvm_ocaml_lib, os.environ['OCAMLPATH']))
|
|
109 config.environment['OCAMLPATH'] = ocamlpath
|
|
110 else:
|
|
111 config.environment['OCAMLPATH'] = llvm_ocaml_lib
|
|
112
|
|
113 if 'CAML_LD_LIBRARY_PATH' in os.environ:
|
|
114 caml_ld_library_path = os.path.pathsep.join((llvm_ocaml_lib,
|
|
115 os.environ['CAML_LD_LIBRARY_PATH']))
|
|
116 config.environment['CAML_LD_LIBRARY_PATH'] = caml_ld_library_path
|
|
117 else:
|
|
118 config.environment['CAML_LD_LIBRARY_PATH'] = llvm_ocaml_lib
|
|
119
|
|
120 # Set up OCAMLRUNPARAM to enable backtraces in OCaml tests.
|
|
121 config.environment['OCAMLRUNPARAM'] = 'b'
|
77
|
122
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
123 ###
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
124
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
125 import os
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
126
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
127 # Check that the object root is known.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
128 if config.test_exec_root is None:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
129 # Otherwise, we haven't loaded the site specific configuration (the user is
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
130 # probably trying to run on a test file directly, and either the site
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
131 # configuration hasn't been created by the build system, or we are in an
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
132 # out-of-tree build situation).
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
133
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
134 # Check for 'llvm_site_config' user parameter, and use that if available.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
135 site_cfg = lit_config.params.get('llvm_site_config', None)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
136 if site_cfg and os.path.exists(site_cfg):
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
137 lit_config.load_config(config, site_cfg)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
138 raise SystemExit
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
139
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
140 # Try to detect the situation where we are using an out-of-tree build by
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
141 # looking for 'llvm-config'.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
142 #
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
143 # FIXME: I debated (i.e., wrote and threw away) adding logic to
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
144 # automagically generate the lit.site.cfg if we are in some kind of fresh
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
145 # build situation. This means knowing how to invoke the build system
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
146 # though, and I decided it was too much magic.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
147
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
148 llvm_config = lit.util.which('llvm-config', config.environment['PATH'])
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
149 if not llvm_config:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
150 lit_config.fatal('No site specific configuration available!')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
151
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
152 # Get the source and object roots.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
153 llvm_src_root = lit.util.capture(['llvm-config', '--src-root']).strip()
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
154 llvm_obj_root = lit.util.capture(['llvm-config', '--obj-root']).strip()
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
155
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
156 # Validate that we got a tree which points to here.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
157 this_src_root = os.path.dirname(config.test_source_root)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
158 if os.path.realpath(llvm_src_root) != os.path.realpath(this_src_root):
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
159 lit_config.fatal('No site specific configuration available!')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
160
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
161 # Check that the site specific configuration exists.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
162 site_cfg = os.path.join(llvm_obj_root, 'test', 'lit.site.cfg')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
163 if not os.path.exists(site_cfg):
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
164 lit_config.fatal('No site specific configuration available!')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
165
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
166 # Okay, that worked. Notify the user of the automagic, and reconfigure.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
167 lit_config.note('using out-of-tree build at %r' % llvm_obj_root)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
168 lit_config.load_config(config, site_cfg)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
169 raise SystemExit
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
170
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
171 ###
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
172
|
77
|
173 lli = 'lli'
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
174 # The target triple used by default by lli is the process target triple (some
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
175 # triple appropriate for generating code for the current process) but because
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
176 # we don't support COFF in MCJIT well enough for the tests, force ELF format on
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
177 # Windows. FIXME: the process target triple should be used here, but this is
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
178 # difficult to obtain on Windows.
|
95
|
179 if re.search(r'cygwin|mingw32|windows-gnu|windows-msvc|win32', config.host_triple):
|
77
|
180 lli += ' -mtriple='+config.host_triple+'-elf'
|
|
181 config.substitutions.append( ('%lli', lli ) )
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
182
|
77
|
183 # Similarly, have a macro to use llc with DWARF even when the host is win32.
|
|
184 llc_dwarf = 'llc'
|
|
185 if re.search(r'win32', config.target_triple):
|
|
186 llc_dwarf += ' -mtriple='+config.target_triple.replace('-win32', '-mingw32')
|
|
187 config.substitutions.append( ('%llc_dwarf', llc_dwarf) )
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
188
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
189 # Add site-specific substitutions.
|
83
|
190 config.substitutions.append( ('%gold', config.gold_executable) )
|
95
|
191 config.substitutions.append( ('%ld64', config.ld64_executable) )
|
83
|
192 config.substitutions.append( ('%go', config.go_executable) )
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
193 config.substitutions.append( ('%llvmshlibdir', config.llvm_shlib_dir) )
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
194 config.substitutions.append( ('%shlibext', config.llvm_shlib_ext) )
|
77
|
195 config.substitutions.append( ('%exeext', config.llvm_exe_ext) )
|
|
196 config.substitutions.append( ('%python', config.python_executable) )
|
100
|
197 config.substitutions.append( ('%host_cc', config.host_cc) )
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
198
|
83
|
199 # OCaml substitutions.
|
|
200 # Support tests for both native and bytecode builds.
|
|
201 config.substitutions.append( ('%ocamlc',
|
|
202 "%s ocamlc -cclib -L%s %s" %
|
|
203 (config.ocamlfind_executable, llvm_lib_dir, config.ocaml_flags)) )
|
|
204 if config.have_ocamlopt in ('1', 'TRUE'):
|
|
205 config.substitutions.append( ('%ocamlopt',
|
|
206 "%s ocamlopt -cclib -L%s -cclib -Wl,-rpath,%s %s" %
|
|
207 (config.ocamlfind_executable, llvm_lib_dir, llvm_lib_dir, config.ocaml_flags)) )
|
|
208 else:
|
|
209 config.substitutions.append( ('%ocamlopt', "true" ) )
|
|
210
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
211 # For each occurrence of an llvm tool name as its own word, replace it
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
212 # with the full path to the build directory holding that tool. This
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
213 # ensures that we are testing the tools just built and not some random
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
214 # tools that might happen to be in the user's PATH. Thus this list
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
215 # includes every tool placed in $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
216 # (llvm_tools_dir in lit parlance).
|
77
|
217
|
|
218 # Avoid matching RUN line fragments that are actually part of
|
|
219 # path names or options or whatever.
|
|
220 # The regex is a pre-assertion to avoid matching a preceding
|
|
221 # dot, hyphen, carat, or slash (.foo, -foo, etc.). Some patterns
|
|
222 # also have a post-assertion to not match a trailing hyphen (foo-).
|
|
223 NOJUNK = r"(?<!\.|-|\^|/)"
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
224
|
95
|
225
|
|
226 def find_tool_substitution(pattern):
|
|
227 # Extract the tool name from the pattern. This relies on the tool
|
|
228 # name being surrounded by \b word match operators. If the
|
|
229 # pattern starts with "| ", include it in the string to be
|
|
230 # substituted.
|
|
231 tool_match = re.match(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$",
|
|
232 pattern)
|
|
233 tool_pipe = tool_match.group(2)
|
|
234 tool_name = tool_match.group(4)
|
|
235 # Did the user specify the tool path + arguments? This allows things like
|
|
236 # llvm-lit "-Dllc=llc -enable-misched -verify-machineinstrs"
|
|
237 tool_path = lit_config.params.get(tool_name)
|
|
238 if tool_path is None:
|
|
239 tool_path = lit.util.which(tool_name, llvm_tools_dir)
|
100
|
240 if tool_path is None:
|
|
241 return tool_name, tool_path, tool_pipe
|
95
|
242 if (tool_name == "llc" and
|
|
243 'LLVM_ENABLE_MACHINE_VERIFIER' in os.environ and
|
|
244 os.environ['LLVM_ENABLE_MACHINE_VERIFIER'] == "1"):
|
|
245 tool_path += " -verify-machineinstrs"
|
100
|
246 if (tool_name == "llvm-go"):
|
|
247 tool_path += " go=" + config.go_executable
|
95
|
248 return tool_name, tool_path, tool_pipe
|
|
249
|
|
250
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
251 for pattern in [r"\bbugpoint\b(?!-)",
|
77
|
252 NOJUNK + r"\bllc\b",
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
253 r"\blli\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
254 r"\bllvm-ar\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
255 r"\bllvm-as\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
256 r"\bllvm-bcanalyzer\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
257 r"\bllvm-config\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
258 r"\bllvm-cov\b",
|
95
|
259 r"\bllvm-cxxdump\b",
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
260 r"\bllvm-diff\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
261 r"\bllvm-dis\b",
|
83
|
262 r"\bllvm-dsymutil\b",
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
263 r"\bllvm-dwarfdump\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
264 r"\bllvm-extract\b",
|
95
|
265 r"\bllvm-lib\b",
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
266 r"\bllvm-link\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
267 r"\bllvm-lto\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
268 r"\bllvm-mc\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
269 r"\bllvm-mcmarkup\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
270 r"\bllvm-nm\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
271 r"\bllvm-objdump\b",
|
77
|
272 r"\bllvm-profdata\b",
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
273 r"\bllvm-ranlib\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
274 r"\bllvm-readobj\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
275 r"\bllvm-rtdyld\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
276 r"\bllvm-size\b",
|
95
|
277 r"\bllvm-split\b",
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
278 r"\bllvm-tblgen\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
279 r"\bllvm-c-test\b",
|
100
|
280 NOJUNK + r"\bllvm-symbolizer\b",
|
77
|
281 NOJUNK + r"\bopt\b",
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
282 r"\bFileCheck\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
283 r"\bobj2yaml\b",
|
100
|
284 NOJUNK + r"\bsancov\b",
|
|
285 NOJUNK + r"\bsanstats\b",
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
286 r"\byaml2obj\b",
|
95
|
287 r"\byaml-bench\b",
|
77
|
288 r"\bverify-uselistorder\b",
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
289 # Handle these specially as they are strings searched
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
290 # for during testing.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
291 r"\| \bcount\b",
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
292 r"\| \bnot\b"]:
|
95
|
293 tool_name, tool_path, tool_pipe = find_tool_substitution(pattern)
|
77
|
294 if not tool_path:
|
|
295 # Warn, but still provide a substitution.
|
|
296 lit_config.note('Did not find ' + tool_name + ' in ' + llvm_tools_dir)
|
|
297 tool_path = llvm_tools_dir + '/' + tool_name
|
|
298 config.substitutions.append((pattern, tool_pipe + tool_path))
|
|
299
|
95
|
300 # For tools that are optional depending on the config, we won't warn
|
|
301 # if they're missing.
|
|
302 for pattern in [r"\bllvm-go\b",
|
|
303 r"\bKaleidoscope-Ch3\b",
|
|
304 r"\bKaleidoscope-Ch4\b",
|
|
305 r"\bKaleidoscope-Ch5\b",
|
|
306 r"\bKaleidoscope-Ch6\b",
|
|
307 r"\bKaleidoscope-Ch7\b",
|
|
308 r"\bKaleidoscope-Ch8\b"]:
|
|
309 tool_name, tool_path, tool_pipe = find_tool_substitution(pattern)
|
|
310 if not tool_path:
|
|
311 # Provide a substitution anyway, for the sake of consistent errors.
|
|
312 tool_path = llvm_tools_dir + '/' + tool_name
|
|
313 config.substitutions.append((pattern, tool_pipe + tool_path))
|
|
314
|
|
315
|
77
|
316 ### Targets
|
|
317
|
|
318 config.targets = frozenset(config.targets_to_build.split())
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
319
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
320 ### Features
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
321
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
322 # Shell execution
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
323 if execute_external:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
324 config.available_features.add('shell')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
325
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
326 # Others/can-execute.txt
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
327 if sys.platform not in ['win32']:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
328 config.available_features.add('can-execute')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
329
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
330 # Loadable module
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
331 # FIXME: This should be supplied by Makefile or autoconf.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
332 if sys.platform in ['win32', 'cygwin']:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
333 loadable_module = (config.enable_shared == 1)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
334 else:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
335 loadable_module = True
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
336
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
337 if loadable_module:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
338 config.available_features.add('loadable_module')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
339
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
340 # Sanitizers.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
341 if config.llvm_use_sanitizer == "Address":
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
342 config.available_features.add("asan")
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
343 if (config.llvm_use_sanitizer == "Memory" or
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
344 config.llvm_use_sanitizer == "MemoryWithOrigins"):
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
345 config.available_features.add("msan")
|
100
|
346 else:
|
|
347 config.available_features.add("not_msan")
|
83
|
348 if config.llvm_use_sanitizer == "Undefined":
|
|
349 config.available_features.add("ubsan")
|
|
350 else:
|
|
351 config.available_features.add("not_ubsan")
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
352
|
95
|
353 # Check if we should run long running tests.
|
|
354 if lit_config.params.get("run_long_tests", None) == "true":
|
|
355 config.available_features.add("long_tests")
|
|
356
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
357 # Direct object generation
|
100
|
358 if not 'hexagon' in config.target_triple:
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
359 config.available_features.add("object-emission")
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
360
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
361 if config.have_zlib == "1":
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
362 config.available_features.add("zlib")
|
77
|
363 else:
|
|
364 config.available_features.add("nozlib")
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
365
|
95
|
366 # LLVM can be configured with an empty default triple
|
|
367 # Some tests are "generic" and require a valid default triple
|
|
368 if config.target_triple:
|
|
369 config.available_features.add("default_triple")
|
100
|
370 if re.match(r'^x86_64.*-linux', config.target_triple):
|
|
371 config.available_features.add("x86_64-linux")
|
95
|
372
|
|
373 # Native compilation: host arch == default triple arch
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
374 # FIXME: Consider cases that target can be executed
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
375 # even if host_triple were different from target_triple.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
376 if config.host_triple == config.target_triple:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
377 config.available_features.add("native")
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
378
|
77
|
379 import subprocess
|
|
380
|
|
381 def have_ld_plugin_support():
|
|
382 if not os.path.exists(os.path.join(config.llvm_shlib_dir, 'LLVMgold.so')):
|
|
383 return False
|
|
384
|
95
|
385 ld_cmd = subprocess.Popen([config.gold_executable, '--help'], stdout = subprocess.PIPE, env={'LANG': 'C'})
|
83
|
386 ld_out = ld_cmd.stdout.read().decode()
|
77
|
387 ld_cmd.wait()
|
|
388
|
83
|
389 if not '-plugin' in ld_out:
|
|
390 return False
|
|
391
|
|
392 # check that the used emulations are supported.
|
|
393 emu_line = [l for l in ld_out.split('\n') if 'supported emulations' in l]
|
|
394 if len(emu_line) != 1:
|
|
395 return False
|
|
396 emu_line = emu_line[0]
|
|
397 fields = emu_line.split(':')
|
|
398 if len(fields) != 3:
|
|
399 return False
|
|
400 emulations = fields[2].split()
|
95
|
401 if 'elf_x86_64' not in emulations:
|
83
|
402 return False
|
95
|
403 if 'elf32ppc' in emulations:
|
|
404 config.available_features.add('ld_emu_elf32ppc')
|
83
|
405
|
95
|
406 ld_version = subprocess.Popen([config.gold_executable, '--version'], stdout = subprocess.PIPE, env={'LANG': 'C'})
|
83
|
407 if not 'GNU gold' in ld_version.stdout.read().decode():
|
77
|
408 return False
|
|
409 ld_version.wait()
|
|
410
|
|
411 return True
|
|
412
|
|
413 if have_ld_plugin_support():
|
|
414 config.available_features.add('ld_plugin')
|
|
415
|
95
|
416 def have_ld64_plugin_support():
|
|
417 if config.ld64_executable == '':
|
|
418 return False
|
|
419
|
|
420 ld_cmd = subprocess.Popen([config.ld64_executable, '-v'], stderr = subprocess.PIPE)
|
|
421 ld_out = ld_cmd.stderr.read().decode()
|
|
422 ld_cmd.wait()
|
|
423
|
|
424 if 'ld64' not in ld_out or 'LTO' not in ld_out:
|
|
425 return False
|
|
426
|
|
427 return True
|
|
428
|
|
429 if have_ld64_plugin_support():
|
|
430 config.available_features.add('ld64_plugin')
|
|
431
|
33
|
432 # Ask llvm-config about assertion mode.
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
433 try:
|
33
|
434 llvm_config_cmd = subprocess.Popen(
|
|
435 [os.path.join(llvm_tools_dir, 'llvm-config'), '--assertion-mode'],
|
83
|
436 stdout = subprocess.PIPE,
|
|
437 env=config.environment)
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
438 except OSError:
|
33
|
439 print("Could not find llvm-config in " + llvm_tools_dir)
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
440 exit(42)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
441
|
33
|
442 if re.search(r'ON', llvm_config_cmd.stdout.read().decode('ascii')):
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
443 config.available_features.add('asserts')
|
33
|
444 llvm_config_cmd.wait()
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
445
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
446 if 'darwin' == sys.platform:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
447 try:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
448 sysctl_cmd = subprocess.Popen(['sysctl', 'hw.optional.fma'],
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
449 stdout = subprocess.PIPE)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
450 except OSError:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
451 print("Could not exec sysctl")
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
452 result = sysctl_cmd.stdout.read().decode('ascii')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
453 if -1 != result.find("hw.optional.fma: 1"):
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
454 config.available_features.add('fma3')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
455 sysctl_cmd.wait()
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
456
|
95
|
457 if platform.system() in ['Windows'] and re.match(r'.*-win32$', config.target_triple):
|
|
458 # For tests that require Windows to run.
|
|
459 config.available_features.add('system-windows')
|
|
460
|
77
|
461 # .debug_frame is not emitted for targeting Windows x64.
|
83
|
462 if not re.match(r'^x86_64.*-(mingw32|windows-gnu|win32)', config.target_triple):
|
77
|
463 config.available_features.add('debug_frame')
|
|
464
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
465 # Check if we should use gmalloc.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
466 use_gmalloc_str = lit_config.params.get('use_gmalloc', None)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
467 if use_gmalloc_str is not None:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
468 if use_gmalloc_str.lower() in ('1', 'true'):
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
469 use_gmalloc = True
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
470 elif use_gmalloc_str.lower() in ('', '0', 'false'):
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
471 use_gmalloc = False
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
472 else:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
473 lit_config.fatal('user parameter use_gmalloc should be 0 or 1')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
474 else:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
475 # Default to not using gmalloc
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
476 use_gmalloc = False
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
477
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
478 # Allow use of an explicit path for gmalloc library.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
479 # Will default to '/usr/lib/libgmalloc.dylib' if not set.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
480 gmalloc_path_str = lit_config.params.get('gmalloc_path',
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
481 '/usr/lib/libgmalloc.dylib')
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
482
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
483 if use_gmalloc:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
484 config.environment.update({'DYLD_INSERT_LIBRARIES' : gmalloc_path_str})
|