xref: /llvm-project/lldb/test/Unit/lit.cfg.py (revision 4d4024e1edf354113e8d0d11661d466ae5b0bee7)
187aa9c9eSJonas Devlieghere# -*- Python -*-
287aa9c9eSJonas Devlieghere
387aa9c9eSJonas Devlieghere# Configuration file for the 'lit' test runner.
487aa9c9eSJonas Devlieghere
587aa9c9eSJonas Devlieghereimport os
687aa9c9eSJonas Devlieghereimport sys
787aa9c9eSJonas Devlieghere
887aa9c9eSJonas Devlieghereimport lit.formats
987aa9c9eSJonas Devliegherefrom lit.llvm import llvm_config
1087aa9c9eSJonas Devlieghere
1187aa9c9eSJonas Devlieghere# name: The name of this test suite.
122238dcc3SJonas Devlieghereconfig.name = "lldb-unit"
1387aa9c9eSJonas Devlieghere
1487aa9c9eSJonas Devlieghere# suffixes: A list of file extensions to treat as test files.
1587aa9c9eSJonas Devlieghereconfig.suffixes = []
1687aa9c9eSJonas Devlieghere
1787aa9c9eSJonas Devlieghere# test_source_root: The root path where unit test binaries are located.
1887aa9c9eSJonas Devlieghere# test_exec_root: The root path where tests should be run.
192238dcc3SJonas Devlieghereconfig.test_source_root = os.path.join(config.lldb_obj_root, "unittests")
2087aa9c9eSJonas Devlieghereconfig.test_exec_root = config.test_source_root
2187aa9c9eSJonas Devlieghere
2287aa9c9eSJonas Devlieghere# One of our unit tests dynamically links against python.dll, and on Windows
2387aa9c9eSJonas Devlieghere# it needs to be able to find it at runtime.  This is fine if Python is on your
2487aa9c9eSJonas Devlieghere# system PATH, but if it's not, then this unit test executable will fail to run.
2587aa9c9eSJonas Devlieghere# We can solve this by forcing the Python directory onto the system path here.
262238dcc3SJonas Devliegherellvm_config.with_system_environment(
272238dcc3SJonas Devlieghere    [
282238dcc3SJonas Devlieghere        "HOME",
292238dcc3SJonas Devlieghere        "PATH",
302238dcc3SJonas Devlieghere        "TEMP",
312238dcc3SJonas Devlieghere        "TMP",
322238dcc3SJonas Devlieghere        "XDG_CACHE_HOME",
332238dcc3SJonas Devlieghere    ]
342238dcc3SJonas Devlieghere)
352238dcc3SJonas Devliegherellvm_config.with_environment("PATH", os.path.dirname(sys.executable), append_path=True)
3687aa9c9eSJonas Devlieghere
3717226c97SJonas Devlieghere# Enable sanitizer runtime flags.
38*4d4024e1SJonas Devlieghereif config.llvm_use_sanitizer:
3917226c97SJonas Devlieghere    config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
4017226c97SJonas Devlieghere    config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
41*4d4024e1SJonas Devlieghere    config.environment["MallocNanoZone"] = "0"
4217226c97SJonas Devlieghere
4387aa9c9eSJonas Devlieghere# testFormat: The test format to use to interpret tests.
442238dcc3SJonas Devlieghereconfig.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests")
45