1# -*- Python -*-
2
3# Configuration file for the 'lit' test runner.
4
5import os
6import subprocess
7
8import lit.formats
9
10# name: The name of this test suite.
11config.name = 'LLVM-Unit'
12
13# suffixes: A list of file extensions to treat as test files.
14config.suffixes = []
15
16# test_source_root: The root path where tests are located.
17# test_exec_root: The root path where tests should be run.
18config.test_exec_root = os.path.join(config.llvm_obj_root, 'unittests')
19config.test_source_root = config.test_exec_root
20
21# testFormat: The test format to use to interpret tests.
22config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests')
23
24# Propagate the temp directory. Windows requires this because it uses \Windows\
25# if none of these are present.
26if 'TMP' in os.environ:
27    config.environment['TMP'] = os.environ['TMP']
28if 'TEMP' in os.environ:
29    config.environment['TEMP'] = os.environ['TEMP']
30
31# Propagate HOME as it can be used to override incorrect homedir in passwd
32# that causes the tests to fail.
33if 'HOME' in os.environ:
34    config.environment['HOME'] = os.environ['HOME']
35
36# Propagate sanitizer options.
37for var in [
38    'ASAN_SYMBOLIZER_PATH',
39    'MSAN_SYMBOLIZER_PATH',
40    'TSAN_SYMBOLIZER_PATH',
41    'UBSAN_SYMBOLIZER_PATH',
42    'ASAN_OPTIONS',
43    'MSAN_OPTIONS',
44    'TSAN_OPTIONS',
45    'UBSAN_OPTIONS',
46]:
47    if var in os.environ:
48        config.environment[var] = os.environ[var]
49
50# Win32 seeks DLLs along %PATH%.
51if sys.platform in ['win32', 'cygwin'] and os.path.isdir(config.shlibdir):
52    config.environment['PATH'] = os.path.pathsep.join((
53            config.shlibdir, config.environment['PATH']))
54
55# Win32 may use %SYSTEMDRIVE% during file system shell operations, so propogate.
56if sys.platform == 'win32' and 'SYSTEMDRIVE' in os.environ:
57    config.environment['SYSTEMDRIVE'] = os.environ['SYSTEMDRIVE']
58