| @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" |