Debian Codegraph @

clang-tools-extra/clangd/unittests/lit.cfg.py

raw
1 import lit.formats
2 import lit.util
3
4 config.name = "Clangd Unit Tests"
5 config.test_format = lit.formats.GoogleTest(".", "Tests")
6 config.test_source_root = config.clangd_binary_dir + "/unittests"
7 config.test_exec_root = config.clangd_binary_dir + "/unittests"
8
9 # Point the dynamic loader at dynamic libraries in 'lib'.
10 # FIXME: it seems every project has a copy of this logic. Move it somewhere.
11 import platform
12
13 # Clangd unittests uses ~4 threads per test. So make sure we don't over commit.
14 core_count = lit.util.usable_core_count()
15 # FIXME: Split unittests into groups that use threads, and groups that do not,
16 # and only limit multi-threaded tests.
17 lit_config.parallelism_groups["clangd"] = max(1, core_count // 4)
18 config.parallelism_group = "clangd"
19
20 if platform.system() == "Darwin":
21 shlibpath_var = "DYLD_LIBRARY_PATH"
22 elif platform.system() == "Windows":
23 shlibpath_var = "PATH"
24 else:
25 shlibpath_var = "LD_LIBRARY_PATH"
26 config.environment[shlibpath_var] = os.path.pathsep.join(
27 ("@SHLIBDIR@", "@LLVM_LIBS_DIR@", config.environment.get(shlibpath_var, ""))
28 )
29
30 # It is not realistically possible to account for all options that could
31 # possibly be present in system and user configuration files, so disable
32 # default configs for the test runs.
33 config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1"