xref: /llvm-project/clang-tools-extra/test/Unit/lit.cfg.py (revision dd3c26a045c081620375a878159f536758baba6e)
1ef7b8423SNico Weber# -*- Python -*-
2ef7b8423SNico Weber
3ef7b8423SNico Weberimport platform
4ef7b8423SNico Weber
5ef7b8423SNico Weberimport lit.formats
6ef7b8423SNico Weber
7ef7b8423SNico Weberconfig.name = "Extra Tools Unit Tests"
8ef7b8423SNico Weberconfig.suffixes = []  # Seems not to matter for google tests?
9ef7b8423SNico Weber
10ef7b8423SNico Weber# Test Source and Exec root dirs both point to the same directory where google
11ef7b8423SNico Weber# test binaries are built.
12ef7b8423SNico Weber
13ef7b8423SNico Weberconfig.test_source_root = config.extra_tools_obj_dir
14ef7b8423SNico Weberconfig.test_exec_root = config.test_source_root
15ef7b8423SNico Weber
16ef7b8423SNico Weber# All GoogleTests are named to have 'Tests' as their suffix. The '.' option is
17ef7b8423SNico Weber# a special value for GoogleTest indicating that it should look through the
18ef7b8423SNico Weber# entire testsuite recursively for tests (alternatively, one could provide a
19ef7b8423SNico Weber# ;-separated list of subdirectories).
20*dd3c26a0STobias Hietaconfig.test_format = lit.formats.GoogleTest(".", "Tests")
21ef7b8423SNico Weber
22*dd3c26a0STobias Hietaif platform.system() == "Darwin":
23*dd3c26a0STobias Hieta    shlibpath_var = "DYLD_LIBRARY_PATH"
24*dd3c26a0STobias Hietaelif platform.system() == "Windows":
25*dd3c26a0STobias Hieta    shlibpath_var = "PATH"
26ef7b8423SNico Weberelse:
27*dd3c26a0STobias Hieta    shlibpath_var = "LD_LIBRARY_PATH"
28ef7b8423SNico Weber
29ef7b8423SNico Weber# Point the dynamic loader at dynamic libraries in 'lib'.
30*dd3c26a0STobias Hietashlibpath = os.path.pathsep.join(
31*dd3c26a0STobias Hieta    (config.shlibdir, config.llvm_libs_dir, config.environment.get(shlibpath_var, ""))
32*dd3c26a0STobias Hieta)
33ef7b8423SNico Weber
34ef7b8423SNico Weber# Win32 seeks DLLs along %PATH%.
35*dd3c26a0STobias Hietaif sys.platform in ["win32", "cygwin"] and os.path.isdir(config.shlibdir):
36ef7b8423SNico Weber    shlibpath = os.path.pathsep.join((config.shlibdir, shlibpath))
37ef7b8423SNico Weber
38ef7b8423SNico Weberconfig.environment[shlibpath_var] = shlibpath
3952ce6776SMichał Górny
4052ce6776SMichał Górny# It is not realistically possible to account for all options that could
4152ce6776SMichał Górny# possibly be present in system and user configuration files, so disable
4252ce6776SMichał Górny# default configs for the test runs.
4352ce6776SMichał Górnyconfig.environment["CLANG_NO_DEFAULT_CONFIG"] = "1"
44