Files
llvm-project/libc/test/lit.site.cfg.py.in
Jeff Bailey 65e766dfda [libc] Honour LIBC_GPU_TEST_JOBS in lit test runs (#193797)
Under CTest, LIBC_GPU_TEST_JOBS controlled a ninja job pool that limited
concurrent GPU test processes. The AMD GPU buildbot sets this to 4 to
avoid overloading the GPU driver.

When running tests via lit, this constraint was lost because lit uses
its own -j flag (defaulting to nproc, or set to 64 on the AMD bot via
LLVM_LIT_ARGS). All GPU loader processes launched simultaneously,
leading to hangs from GPU resource exhaustion.

Propagated LIBC_GPU_TEST_JOBS into the lit site config as a parallelism
group so lit throttles GPU test concurrency independently of the global
-j setting.
2026-04-24 08:20:03 +01:00

48 lines
1.9 KiB
Python

@LIT_SITE_CFG_IN_HEADER@
import os
import site
# Configuration values from CMake
config.llvm_tools_dir = lit_config.substitute(path(r"@LLVM_TOOLS_DIR@"))
config.libc_src_root = path(r"@LIBC_SOURCE_DIR@")
config.libc_obj_root = path(r"@LIBC_BUILD_DIR@")
config.libc_test_cmd = "@LIBC_TEST_CMD@"
config.libc_crosscompiling_emulator = path(r"@CMAKE_CROSSCOMPILING_EMULATOR@")
# If no explicit test command is set, use the cross-compiling emulator.
if not config.libc_test_cmd and config.libc_crosscompiling_emulator:
config.libc_test_cmd = config.libc_crosscompiling_emulator
# Add libc's utils directory to the path so we can import the test format.
site.addsitedir(os.path.join(config.libc_src_root, "utils"))
import libctest
# name: The name of this test suite.
config.name = "libc"
# testFormat: Use libc's custom test format that discovers pre-built
# test executables (Libc*Tests) in the build directory.
config.test_format = libctest.LibcTest()
# excludes: A list of directories to exclude from the testsuite.
config.excludes = ["Inputs", "CMakeLists.txt", "README.txt", "LICENSE.txt"]
# test_source_root: The root path where tests are located.
# test_exec_root: The root path where test executables are built.
# Set both to the build directory so ExecutableTest finds executables correctly.
config.test_exec_root = os.path.join(config.libc_obj_root, "test")
config.test_source_root = config.test_exec_root
# Add tool directories to PATH (in case we add FileCheck tests later).
if hasattr(config, "llvm_tools_dir") and config.llvm_tools_dir:
config.environment["PATH"] = os.path.pathsep.join(
[config.llvm_tools_dir, config.environment.get("PATH", "")]
)
# Limit concurrent GPU tests to avoid overloading the GPU driver.
libc_gpu_test_jobs = "@LIBC_GPU_TEST_JOBS@"
if libc_gpu_test_jobs:
lit_config.parallelism_groups["libc-gpu"] = int(libc_gpu_test_jobs)
config.parallelism_group = "libc-gpu"