1import lit.formats 2import lit.util 3 4config.name = "Clangd Unit Tests" 5config.test_format = lit.formats.GoogleTest(".", "Tests") 6config.test_source_root = config.clangd_binary_dir + "/unittests" 7config.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. 11import platform 12 13# Clangd unittests uses ~4 threads per test. So make sure we don't over commit. 14core_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. 17lit_config.parallelism_groups["clangd"] = max(1, core_count // 4) 18config.parallelism_group = "clangd" 19 20if platform.system() == "Darwin": 21 shlibpath_var = "DYLD_LIBRARY_PATH" 22elif platform.system() == "Windows": 23 shlibpath_var = "PATH" 24else: 25 shlibpath_var = "LD_LIBRARY_PATH" 26config.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. 33config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1" 34