xref: /llvm-project/polly/test/Unit/lit.cfg (revision 3f5f2905c48fb13275fd74048fb07c5676e86d94)
1# -*- Python -*-
2
3# Configuration file for the 'lit' test runner.
4
5import os
6import platform
7
8import lit.formats
9import lit.util
10
11# name: The name of this test suite.
12config.name = 'Polly-Unit'
13
14if not config.has_unittests:
15    raise SystemExit
16
17# suffixes: A list of file extensions to treat as test files.
18config.suffixes = []
19
20# test_source_root: The root path where tests are located.
21# test_exec_root: The root path where tests should be run.
22config.test_exec_root = os.path.join(config.polly_obj_root, 'unittests')
23config.test_source_root = config.test_exec_root
24
25# testFormat: The test format to use to interpret tests.
26config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests')
27
28# Propagate the temp directory. Windows requires this because it uses \Windows\
29# if none of these are present.
30if 'TMP' in os.environ:
31    config.environment['TMP'] = os.environ['TMP']
32if 'TEMP' in os.environ:
33    config.environment['TEMP'] = os.environ['TEMP']
34
35# Propagate sanitizer options.
36for var in [
37    'ASAN_SYMBOLIZER_PATH',
38    'HWASAN_SYMBOLIZER_PATH',
39    'MSAN_SYMBOLIZER_PATH',
40    'TSAN_SYMBOLIZER_PATH',
41    'UBSAN_SYMBOLIZER_PATH',
42    'ASAN_OPTIONS',
43    'HWASAN_OPTIONS',
44    'MSAN_OPTIONS',
45    'TSAN_OPTIONS',
46    'UBSAN_OPTIONS',
47]:
48    if var in os.environ:
49        config.environment[var] = os.environ[var]
50
51if platform.system() == 'Darwin':
52    shlibpath_var = 'DYLD_LIBRARY_PATH'
53elif platform.system() == 'Windows':
54    shlibpath_var = 'PATH'
55else:
56    shlibpath_var = 'LD_LIBRARY_PATH'
57
58# Point the dynamic loader at dynamic libraries in 'lib'.
59shlibpath = os.path.pathsep.join((config.llvm_libs_dir,
60                                 config.environment.get(shlibpath_var,'')))
61
62# Win32 seeks DLLs along %PATH%.
63if sys.platform in ['win32', 'cygwin'] and os.path.isdir(config.shlibdir):
64    shlibpath = os.path.pathsep.join((config.shlibdir, shlibpath))
65
66config.environment[shlibpath_var] = shlibpath
67