xref: /llvm-project/lldb/test/Unit/lit.cfg.py (revision 4d4024e1edf354113e8d0d11661d466ae5b0bee7)
1# -*- Python -*-
2
3# Configuration file for the 'lit' test runner.
4
5import os
6import sys
7
8import lit.formats
9from lit.llvm import llvm_config
10
11# name: The name of this test suite.
12config.name = "lldb-unit"
13
14# suffixes: A list of file extensions to treat as test files.
15config.suffixes = []
16
17# test_source_root: The root path where unit test binaries are located.
18# test_exec_root: The root path where tests should be run.
19config.test_source_root = os.path.join(config.lldb_obj_root, "unittests")
20config.test_exec_root = config.test_source_root
21
22# One of our unit tests dynamically links against python.dll, and on Windows
23# it needs to be able to find it at runtime.  This is fine if Python is on your
24# system PATH, but if it's not, then this unit test executable will fail to run.
25# We can solve this by forcing the Python directory onto the system path here.
26llvm_config.with_system_environment(
27    [
28        "HOME",
29        "PATH",
30        "TEMP",
31        "TMP",
32        "XDG_CACHE_HOME",
33    ]
34)
35llvm_config.with_environment("PATH", os.path.dirname(sys.executable), append_path=True)
36
37# Enable sanitizer runtime flags.
38if config.llvm_use_sanitizer:
39    config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
40    config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
41    config.environment["MallocNanoZone"] = "0"
42
43# testFormat: The test format to use to interpret tests.
44config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests")
45