llvm.org GIT mirror llvm / 27c35d9
[tests] Update to use lit_config and lit package, as appropriate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188076 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 6 years ago
4 changed file(s) with 35 addition(s) and 32 deletion(s). Raw diff Collapse all Expand all
22 # Configuration file for the 'lit' test runner.
33
44 import os
5
6 import lit.formats
57
68 # name: The name of this test suite.
79 config.name = 'LLVM-Unit'
4244 # out-of-tree build situation).
4345
4446 # Check for 'llvm_unit_site_config' user parameter, and use that if available.
45 site_cfg = lit.params.get('llvm_unit_site_config', None)
47 site_cfg = lit_config.params.get('llvm_unit_site_config', None)
4648 if site_cfg and os.path.exists(site_cfg):
47 lit.load_config(config, site_cfg)
49 lit_config.load_config(config, site_cfg)
4850 raise SystemExit
4951
5052 # Try to detect the situation where we are using an out-of-tree build by
5759
5860 llvm_config = lit.util.which('llvm-config', config.environment['PATH'])
5961 if not llvm_config:
60 lit.fatal('No site specific configuration available!')
62 lit_config.fatal('No site specific configuration available!')
6163
6264 # Get the source and object roots.
6365 llvm_src_root = lit.util.capture(['llvm-config', '--src-root']).strip()
6668 # Validate that we got a tree which points to here.
6769 this_src_root = os.path.join(os.path.dirname(__file__),'..','..')
6870 if os.path.realpath(llvm_src_root) != os.path.realpath(this_src_root):
69 lit.fatal('No site specific configuration available!')
71 lit_config.fatal('No site specific configuration available!')
7072
7173 # Check that the site specific configuration exists.
7274 site_cfg = os.path.join(llvm_obj_root, 'test', 'Unit', 'lit.site.cfg')
7375 if not os.path.exists(site_cfg):
74 lit.fatal('No site specific configuration available!')
76 lit_config.fatal('No site specific configuration available!')
7577
7678 # Okay, that worked. Notify the user of the automagic, and reconfigure.
77 lit.note('using out-of-tree build at %r' % llvm_obj_root)
78 lit.load_config(config, site_cfg)
79 lit_config.note('using out-of-tree build at %r' % llvm_obj_root)
80 lit_config.load_config(config, site_cfg)
7981 raise SystemExit
8082
8183 # If necessary, point the dynamic loader at libLLVM.so.
1212 # Support substitution of the tools_dir and build_mode with user parameters.
1313 # This is used when we can't determine the tool dir at configuration time.
1414 try:
15 config.llvm_tools_dir = config.llvm_tools_dir % lit.params
16 config.llvm_build_mode = config.llvm_build_mode % lit.params
15 config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
16 config.llvm_build_mode = config.llvm_build_mode % lit_config.params
1717 except KeyError:
1818 e = sys.exc_info()[1]
1919 key, = e.args
20 lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
20 lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
2121
2222 # Let the main config do the real work.
23 lit.load_config(config, "@LLVM_SOURCE_DIR@/test/Unit/lit.cfg")
23 lit_config.load_config(config, "@LLVM_SOURCE_DIR@/test/Unit/lit.cfg")
66 import re
77 import platform
88
9 import lit.util
10 import lit.formats
11
912 # name: The name of this test suite.
1013 config.name = 'LLVM'
1114
1316 if sys.platform in ['win32']:
1417 # Seek sane tools in directories and set to $PATH.
1518 path = getattr(config, 'lit_tools_dir', None)
16 path = lit.getToolsPath(path,
17 config.environment['PATH'],
18 ['cmp.exe', 'grep.exe', 'sed.exe'])
19 path = lit_config.getToolsPath(path,
20 config.environment['PATH'],
21 ['cmp.exe', 'grep.exe', 'sed.exe'])
1922 if path is not None:
2023 path = os.path.pathsep.join((path,
2124 config.environment['PATH']))
3538 # testFormat: The test format to use to interpret tests.
3639 config.test_format = lit.formats.ShTest(execute_external)
3740
38 # To ignore test output on stderr so it doesn't trigger failures uncomment this:
39 #config.test_format = lit.formats.TclTest(ignoreStdErr=True)
40
4141 # suffixes: A list of file extensions to treat as test files. This is overriden
4242 # by individual lit.local.cfg files in the test subdirectories.
4343 config.suffixes = []
5959 if llvm_obj_root is not None:
6060 llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
6161 if not llvm_tools_dir:
62 lit.fatal('No LLVM tools dir set!')
62 lit_config.fatal('No LLVM tools dir set!')
6363 path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
6464 config.environment['PATH'] = path
6565
106106 # out-of-tree build situation).
107107
108108 # Check for 'llvm_site_config' user parameter, and use that if available.
109 site_cfg = lit.params.get('llvm_site_config', None)
109 site_cfg = lit_config.params.get('llvm_site_config', None)
110110 if site_cfg and os.path.exists(site_cfg):
111 lit.load_config(config, site_cfg)
111 lit_config.load_config(config, site_cfg)
112112 raise SystemExit
113113
114114 # Try to detect the situation where we are using an out-of-tree build by
121121
122122 llvm_config = lit.util.which('llvm-config', config.environment['PATH'])
123123 if not llvm_config:
124 lit.fatal('No site specific configuration available!')
124 lit_config.fatal('No site specific configuration available!')
125125
126126 # Get the source and object roots.
127127 llvm_src_root = lit.util.capture(['llvm-config', '--src-root']).strip()
130130 # Validate that we got a tree which points to here.
131131 this_src_root = os.path.dirname(config.test_source_root)
132132 if os.path.realpath(llvm_src_root) != os.path.realpath(this_src_root):
133 lit.fatal('No site specific configuration available!')
133 lit_config.fatal('No site specific configuration available!')
134134
135135 # Check that the site specific configuration exists.
136136 site_cfg = os.path.join(llvm_obj_root, 'test', 'lit.site.cfg')
137137 if not os.path.exists(site_cfg):
138 lit.fatal('No site specific configuration available!')
138 lit_config.fatal('No site specific configuration available!')
139139
140140 # Okay, that worked. Notify the user of the automagic, and reconfigure.
141 lit.note('using out-of-tree build at %r' % llvm_obj_root)
142 lit.load_config(config, site_cfg)
141 lit_config.note('using out-of-tree build at %r' % llvm_obj_root)
142 lit_config.load_config(config, site_cfg)
143143 raise SystemExit
144144
145145 ###
168168 config.substitutions.append( ('%defaultjit', '-use-mcjit='+defaultIsMCJIT) )
169169
170170 # Process jit implementation option
171 jit_impl_cfg = lit.params.get('jit_impl', None)
171 jit_impl_cfg = lit_config.params.get('jit_impl', None)
172172 if jit_impl_cfg == 'mcjit':
173173 # When running with mcjit, mangle -mcjit into target triple
174174 # and add -use-mcjit flag to lli invocation
291291 llc_cmd.wait()
292292
293293 # Check if we should use gmalloc.
294 use_gmalloc_str = lit.params.get('use_gmalloc', None)
294 use_gmalloc_str = lit_config.params.get('use_gmalloc', None)
295295 if use_gmalloc_str is not None:
296296 if use_gmalloc_str.lower() in ('1', 'true'):
297297 use_gmalloc = True
298298 elif use_gmalloc_str.lower() in ('', '0', 'false'):
299299 use_gmalloc = False
300300 else:
301 lit.fatal('user parameter use_gmalloc should be 0 or 1')
301 lit_config.fatal('user parameter use_gmalloc should be 0 or 1')
302302 else:
303303 # Default to not using gmalloc
304304 use_gmalloc = False
305305
306306 # Allow use of an explicit path for gmalloc library.
307307 # Will default to '/usr/lib/libgmalloc.dylib' if not set.
308 gmalloc_path_str = lit.params.get('gmalloc_path', '/usr/lib/libgmalloc.dylib')
308 gmalloc_path_str = lit_config.params.get('gmalloc_path',
309 '/usr/lib/libgmalloc.dylib')
309310
310311 if use_gmalloc:
311312 config.environment.update({'DYLD_INSERT_LIBRARIES' : gmalloc_path_str})
2525 # Support substitution of the tools_dir with user parameters. This is
2626 # used when we can't determine the tool dir at configuration time.
2727 try:
28 config.llvm_tools_dir = config.llvm_tools_dir % lit.params
28 config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
2929 except KeyError:
3030 e = sys.exc_info()[1]
3131 key, = e.args
32 lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
32 lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
3333
3434 # Let the main config do the real work.
35 lit.load_config(config, "@LLVM_SOURCE_DIR@/test/lit.cfg")
35 lit_config.load_config(config, "@LLVM_SOURCE_DIR@/test/lit.cfg")