Author: Kadir Cetinkaya Date: 2023-09-06T10:53:18+02:00 New Revision: 9a26d2c6d35f574d7a4b06a5a22f8a1c063cb664
URL: https://github.com/llvm/llvm-project/commit/9a26d2c6d35f574d7a4b06a5a22f8a1c063cb664 DIFF: https://github.com/llvm/llvm-project/commit/9a26d2c6d35f574d7a4b06a5a22f8a1c063cb664.diff LOG: [clangd][unittests] Limit paralelism for clangd unittests We started seeing a lot of timeouts that align with the change in lit to execute gtests in shards. The logic there assumes tests are single-threaded, which is the case for most of the LLVM, hence they pick #shards ~ #cores (by slightly overshooting). There are enough unittests in clangd that rely on multi-threading, they can create arbitrarily many threads but we limit amount of meaningful work to ~4 thread per process. This change ensures that we're accounting for that paralelism when executing clangd tests and not overloading test executors. In theory the change overestimates the requirements, not all tests are multi-threaded, but it doesn't seem to be resulting in any regressions on my local runs. Fixes https://github.com/llvm/llvm-project/issues/64964. Fixes https://github.com/clangd/clangd/issues/1712. Added: Modified: clang-tools-extra/clangd/unittests/lit.cfg.py Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/unittests/lit.cfg.py b/clang-tools-extra/clangd/unittests/lit.cfg.py index 48ee5f5d5ab920..33aa9e61f4ce9d 100644 --- a/clang-tools-extra/clangd/unittests/lit.cfg.py +++ b/clang-tools-extra/clangd/unittests/lit.cfg.py @@ -1,4 +1,5 @@ import lit.formats +import lit.util config.name = "Clangd Unit Tests" config.test_format = lit.formats.GoogleTest(".", "Tests") @@ -9,6 +10,13 @@ # FIXME: it seems every project has a copy of this logic. Move it somewhere. import platform +# Clangd unittests uses ~4 threads per test. So make sure we don't over commit. +core_count = lit.util.usable_core_count() +# FIXME: Split unittests into groups that use threads, and groups that do not, +# and only limit multi-threaded tests. +lit_config.parallelism_groups["clangd"] = max(1, core_count // 4) +config.parallelism_group = "clangd" + if platform.system() == "Darwin": shlibpath_var = "DYLD_LIBRARY_PATH" elif platform.system() == "Windows": _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits