Fix Polly
[polly-mirror.git] / test / lit.cfg
blob293b42673923353f342cdf88bbf5a4a6deac0162
1 # -*clang- Python -*-
3 import os
4 import platform
5 import re
6 import subprocess
8 import lit.formats
9 import lit.util
11 # Configuration file for the 'lit' test runner.
13 # name: The name of this test suite.
14 config.name = 'Polly'
16 # testFormat: The test format to use to interpret tests.
18 # For now we require '&&' between commands, until they get globally killed and
19 # the test runner updated.
20 execute_external = platform.system() != 'Windows'
21 config.test_format = lit.formats.ShTest(execute_external)
23 # suffixes: A list of file extensions to treat as test files.
24 config.suffixes = ['.ll']
26 # test_source_root: The root path where tests are located.
27 config.test_source_root = os.path.dirname(__file__)
29 # test_exec_root: The root path where tests should be run.
30 config.test_exec_root = os.path.join(config.polly_obj_root, 'test')
32 # Tweak the PATH to include the tools dir and the scripts dir.
33 base_paths = [config.llvm_tools_dir, config.environment['PATH']]
34 path = os.path.pathsep.join(base_paths + config.extra_paths)
35 config.environment['PATH'] = path
37 path = os.path.pathsep.join((config.llvm_libs_dir,
38                               config.environment.get('LD_LIBRARY_PATH','')))
39 config.environment['LD_LIBRARY_PATH'] = path
41 # opt knows whether it is compiled with -DNDEBUG.
42 import subprocess
43 try:
44     opt_cmd = subprocess.Popen([os.path.join(config.llvm_tools_dir, 'opt'), '-version'],
45                            stdout = subprocess.PIPE,
46                            env=config.environment)
47 except OSError:
48     print("Could not find opt in " + config.llvm_tools_dir)
49     exit(42)
51 if re.search(r'with assertions', opt_cmd.stdout.read().decode('ascii')):
52     config.available_features.add('asserts')
53 opt_cmd.wait()
55 try:
56     llvm_config_cmd = subprocess.Popen([os.path.join(
57                                         config.llvm_tools_dir,
58                                         'llvm-config'),
59                                         '--targets-built'],
60                                        stdout = subprocess.PIPE,
61                                        env=config.environment)
62 except OSError:
63     print("Could not find llvm-config in " + config.llvm_tools_dir)
64     exit(42)
66 if re.search(r'NVPTX', llvm_config_cmd.stdout.read().decode('ascii')):
67     config.available_features.add('nvptx-registered-target')
68 llvm_config_cmd.wait()