llvm-project

Форк
0
73 строки · 2.3 Кб
1
# -*clang- Python -*-
2

3
import os
4
import platform
5
import re
6
import subprocess
7

8
import lit.formats
9
import lit.util
10

11
from lit.llvm import llvm_config
12

13
# Configuration file for the 'lit' test runner.
14

15
# name: The name of this test suite.
16
config.name = 'Polly'
17

18
# testFormat: The test format to use to interpret tests.
19
#
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)
24

25
# suffixes: A list of file extensions to treat as test files.
26
config.suffixes = ['.ll']
27

28
# test_source_root: The root path where tests are located.
29
config.test_source_root = os.path.dirname(__file__)
30

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')
33

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
38

39
path = os.path.pathsep.join((config.llvm_libs_dir,
40
                              config.environment.get('LD_LIBRARY_PATH','')))
41
config.environment['LD_LIBRARY_PATH'] = path
42

43
llvm_config.use_default_substitutions()
44

45
tool_patterns = ['opt', 'polly-isl-test']
46
llvm_config.add_tool_substitutions(tool_patterns)
47

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)
57

58
if re.search(r'with assertions', opt_cmd.stdout.read().decode('ascii')):
59
    config.available_features.add('asserts')
60
opt_cmd.wait()
61

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)
72

73
llvm_config_cmd.wait()
74

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.