11 from lit.llvm import llvm_config
13 # Configuration file for the 'lit' test runner.
15 # name: The name of this test suite.
18 # testFormat: The test format to use to interpret tests.
20 # For now we require '&&' between commands, until they get globally killed and
21 # the test runner updated.
22 execute_external = platform.system() != 'Windows'
23 config.test_format = lit.formats.ShTest(execute_external)
25 # suffixes: A list of file extensions to treat as test files.
26 config.suffixes = ['.ll']
28 # test_source_root: The root path where tests are located.
29 config.test_source_root = os.path.dirname(__file__)
31 # test_exec_root: The root path where tests should be run.
32 config.test_exec_root = os.path.join(config.polly_obj_root, 'test')
34 # Tweak the PATH to include the tools dir and the scripts dir.
35 base_paths = [config.llvm_tools_dir, config.environment['PATH']]
36 path = os.path.pathsep.join(base_paths + config.extra_paths)
37 config.environment['PATH'] = path
39 path = os.path.pathsep.join((config.llvm_libs_dir,
40 config.environment.get('LD_LIBRARY_PATH','')))
41 config.environment['LD_LIBRARY_PATH'] = path
43 llvm_config.use_default_substitutions()
45 tool_patterns = ['opt', 'polly-isl-test']
46 llvm_config.add_tool_substitutions(tool_patterns)
48 # opt knows whether it is compiled with -DNDEBUG.
51 opt_cmd = subprocess.Popen([os.path.join(config.llvm_tools_dir, 'opt'), '-version'],
52 stdout = subprocess.PIPE,
53 env=config.environment)
55 print("Could not find opt in " + config.llvm_tools_dir)
58 if re.search(r'with assertions', opt_cmd.stdout.read().decode('ascii')):
59 config.available_features.add('asserts')
63 llvm_config_cmd = subprocess.Popen([os.path.join(
64 config.llvm_tools_dir,
67 stdout = subprocess.PIPE,
68 env=config.environment)
70 print("Could not find llvm-config in " + config.llvm_tools_dir)
73 llvm_config_cmd.wait()