-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlit.cfg.in
119 lines (93 loc) · 4.06 KB
/
lit.cfg.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# -*- Python -*-
# Configuration file for the 'lit' test runner.
import errno
import lit
import mmap
import os
import platform
import sys
import tempfile
def can_mmap_path (path):
'''Returns true if the given path allows the use of memory-mapped files.'''
result = True
with tempfile.NamedTemporaryFile (mode = 'w+t', dir = path) as f:
# We need to put some data in the file: can't memory map it if the file is empty.
f.write ("Hello World")
f.flush ()
try:
mm = mmap.mmap (f.fileno (), 0)
mm.close ()
except EnvironmentError as ex:
if ex.errno == errno.EINVAL:
result = False
return result
def data_store_path ():
'''Returns the path to use for data stores. Since the data store relies on
being able to memory-map files, we need to find a local path that allows
this.
Normally one can safely use the test directory, however that may not
necessarily be supported. For example, if the test is in directory that's
been mapped from the host in a virtual machine, then an alternative may
have to be found.'''
if can_mmap_path (config.test_exec_root):
return config.test_exec_root
return tempfile.gettempdir ()
# name: The name of this test suite.
config.name = 'pstore'
# suffixes: A list of file extensions to treat as test files.
config.suffixes = [
'.cpp',
'.ll',
'.t',
'.test',
]
is_windows = sys.platform in ['win32']
# Choose between lit's internal shell pipeline runner and a real shell. If
# LIT_USE_INTERNAL_SHELL is in the environment, we use that as an override.
use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
if use_lit_shell:
# 0 is external, "" is default, and everything else is internal.
execute_external = (use_lit_shell == "0")
else:
# Otherwise we default to internal on Windows and external elsewhere, as
# bash on Windows is usually very slow.
execute_external = (not is_windows)
# testFormat: The test format to use to interpret tests.
config.test_format = lit.formats.ShTest (execute_external)
# test_source_root:
# The filesystem path to the test suite root. For out-of-dir builds, this is the
# directory that will be scanned for tests.
config.test_source_root = os.path.join ('@CMAKE_CURRENT_SOURCE_DIR@', 'system_tests')
# test_exec_root:
# For out-of-dir builds, the path to the test suite root inside the object
# directory. This is where tests will be run and temporary output files placed.
config.test_exec_root = os.path.join ('@LIT_CONFIG_DIR@', 'system_tests')
if not os.path.exists (config.test_exec_root):
os.mkdir (config.test_exec_root)
# target_triple: Used by ShTest format for XFAIL checks.
config.target_triple = 'foo'
# available_features: Used by ShTest format for REQUIRES checks.
# add 'serialize' if '--param examples' was specified on the command line.
if lit_config.params.get ('examples') is not None:
config.available_features.add ('examples')
# add 'broker' if '--param broker' was specified on the command line.
if lit_config.params.get ('broker') is not None:
config.available_features.add ('broker')
# Add 'is_inside_llvm' if '--param is_inside_llvm' was on the command line. This
# should happen to indicate that this build is happening inside the LLVM framework
# and hence LLVM tools are available.
if lit_config.params.get ('is_inside_llvm') is not None:
config.available_features.add ('is_inside_llvm')
if lit_config.params.get ('nodejs') is not None:
config.available_features.add ('nodejs')
config.substitutions.append (('%nodejs', lit_config.params['nodejs']))
if lit_config.params.get ('npm') is not None:
config.available_features.add ('npm')
config.substitutions.append (('%npm', lit_config.params['npm']))
config.substitutions.append (('%binaries', '@LIT_CONFIG_DIR@'))
config.substitutions.append (('%foo', 'this-is-foo'))
config.substitutions.append (('%stores', data_store_path ()))
config.substitutions.append (('%python', sys.executable))
if is_windows:
config.environment ['APPDATA'] = os.environ.get ('APPDATA')
#eof lit.cfg