workflows/scorecard: Run this job once per day instead of for every push
[llvm-project.git] / polly / test / lit.cfg
blob0943507ebe502f69f24d59e06b321805fc6606f7
1 # -*clang- Python -*-
3 import os
4 import platform
5 import re
6 import subprocess
8 import lit.formats
9 import lit.util
11 from lit.llvm import llvm_config
13 # Configuration file for the 'lit' test runner.
15 # name: The name of this test suite.
16 config.name = 'Polly'
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.
49 import subprocess
50 try:
51     opt_cmd = subprocess.Popen([os.path.join(config.llvm_tools_dir, 'opt'), '-version'],
52                            stdout = subprocess.PIPE,
53                            env=config.environment)
54 except OSError:
55     print("Could not find opt in " + config.llvm_tools_dir)
56     exit(42)
58 if re.search(r'with assertions', opt_cmd.stdout.read().decode('ascii')):
59     config.available_features.add('asserts')
60 opt_cmd.wait()
62 try:
63     llvm_config_cmd = subprocess.Popen([os.path.join(
64                                         config.llvm_tools_dir,
65                                         'llvm-config'),
66                                         '--targets-built'],
67                                        stdout = subprocess.PIPE,
68                                        env=config.environment)
69 except OSError:
70     print("Could not find llvm-config in " + config.llvm_tools_dir)
71     exit(42)
73 llvm_config_cmd.wait()