annotate polly/test/lit.cfg @ 252:1f2b6ac9f198 llvm-original

LLVM16-1
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 18 Aug 2023 09:04:13 +0900
parents c4bab56944e8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 # -*clang- Python -*-
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 import os
anatofuz
parents:
diff changeset
4 import platform
anatofuz
parents:
diff changeset
5 import re
anatofuz
parents:
diff changeset
6 import subprocess
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 import lit.formats
anatofuz
parents:
diff changeset
9 import lit.util
anatofuz
parents:
diff changeset
10
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
11 from lit.llvm import llvm_config
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
12
150
anatofuz
parents:
diff changeset
13 # Configuration file for the 'lit' test runner.
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 # name: The name of this test suite.
anatofuz
parents:
diff changeset
16 config.name = 'Polly'
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 # testFormat: The test format to use to interpret tests.
anatofuz
parents:
diff changeset
19 #
anatofuz
parents:
diff changeset
20 # For now we require '&&' between commands, until they get globally killed and
anatofuz
parents:
diff changeset
21 # the test runner updated.
anatofuz
parents:
diff changeset
22 execute_external = platform.system() != 'Windows'
anatofuz
parents:
diff changeset
23 config.test_format = lit.formats.ShTest(execute_external)
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 # suffixes: A list of file extensions to treat as test files.
anatofuz
parents:
diff changeset
26 config.suffixes = ['.ll']
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 # test_source_root: The root path where tests are located.
anatofuz
parents:
diff changeset
29 config.test_source_root = os.path.dirname(__file__)
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 # test_exec_root: The root path where tests should be run.
anatofuz
parents:
diff changeset
32 config.test_exec_root = os.path.join(config.polly_obj_root, 'test')
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 # Tweak the PATH to include the tools dir and the scripts dir.
anatofuz
parents:
diff changeset
35 base_paths = [config.llvm_tools_dir, config.environment['PATH']]
anatofuz
parents:
diff changeset
36 path = os.path.pathsep.join(base_paths + config.extra_paths)
anatofuz
parents:
diff changeset
37 config.environment['PATH'] = path
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 path = os.path.pathsep.join((config.llvm_libs_dir,
anatofuz
parents:
diff changeset
40 config.environment.get('LD_LIBRARY_PATH','')))
anatofuz
parents:
diff changeset
41 config.environment['LD_LIBRARY_PATH'] = path
anatofuz
parents:
diff changeset
42
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
43 llvm_config.use_default_substitutions()
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
44
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
45 tool_patterns = ['opt', 'polly-isl-test']
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
46 llvm_config.add_tool_substitutions(tool_patterns)
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
47
150
anatofuz
parents:
diff changeset
48 # opt knows whether it is compiled with -DNDEBUG.
anatofuz
parents:
diff changeset
49 import subprocess
anatofuz
parents:
diff changeset
50 try:
anatofuz
parents:
diff changeset
51 opt_cmd = subprocess.Popen([os.path.join(config.llvm_tools_dir, 'opt'), '-version'],
anatofuz
parents:
diff changeset
52 stdout = subprocess.PIPE,
anatofuz
parents:
diff changeset
53 env=config.environment)
anatofuz
parents:
diff changeset
54 except OSError:
anatofuz
parents:
diff changeset
55 print("Could not find opt in " + config.llvm_tools_dir)
anatofuz
parents:
diff changeset
56 exit(42)
anatofuz
parents:
diff changeset
57
anatofuz
parents:
diff changeset
58 if re.search(r'with assertions', opt_cmd.stdout.read().decode('ascii')):
anatofuz
parents:
diff changeset
59 config.available_features.add('asserts')
anatofuz
parents:
diff changeset
60 opt_cmd.wait()
anatofuz
parents:
diff changeset
61
anatofuz
parents:
diff changeset
62 try:
anatofuz
parents:
diff changeset
63 llvm_config_cmd = subprocess.Popen([os.path.join(
anatofuz
parents:
diff changeset
64 config.llvm_tools_dir,
anatofuz
parents:
diff changeset
65 'llvm-config'),
anatofuz
parents:
diff changeset
66 '--targets-built'],
anatofuz
parents:
diff changeset
67 stdout = subprocess.PIPE,
anatofuz
parents:
diff changeset
68 env=config.environment)
anatofuz
parents:
diff changeset
69 except OSError:
anatofuz
parents:
diff changeset
70 print("Could not find llvm-config in " + config.llvm_tools_dir)
anatofuz
parents:
diff changeset
71 exit(42)
anatofuz
parents:
diff changeset
72
anatofuz
parents:
diff changeset
73 llvm_config_cmd.wait()