[llvm] 01a7a21 - [CMake] Add BINARY_DIR argument for add_lit_testsuites (#144431)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 17 10:04:08 PDT 2025
Author: Chris B
Date: 2025-06-17T12:04:04-05:00
New Revision: 01a7a21a4b8070a88e5dcc9753066e38d26faf85
URL: https://github.com/llvm/llvm-project/commit/01a7a21a4b8070a88e5dcc9753066e38d26faf85
DIFF: https://github.com/llvm/llvm-project/commit/01a7a21a4b8070a88e5dcc9753066e38d26faf85.diff
LOG: [CMake] Add BINARY_DIR argument for add_lit_testsuites (#144431)
We're doing some slightly odd things with LIT in the offload-test-suite.
Specifically we generate multiple binary directories to configure and
run tests with different configurations from the same source root.
In this configuration the subdirectory targets need to instead point to
the correct generated binary directory and use test filtering to get a
subset of tests.
Added:
Modified:
llvm/cmake/modules/AddLLVM.cmake
Removed:
################################################################################
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 7a7340ff8a456..8d8a94d1cddc4 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -2192,7 +2192,7 @@ endfunction()
function(add_lit_testsuites project directory)
if (NOT LLVM_ENABLE_IDE)
- cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "FOLDER" "PARAMS;DEPENDS;ARGS" ${ARGN})
+ cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "FOLDER;BINARY_DIR" "PARAMS;DEPENDS;ARGS" ${ARGN})
if (NOT ARG_FOLDER)
get_subproject_title(subproject_title)
@@ -2213,13 +2213,18 @@ function(add_lit_testsuites project directory)
endif()
# Create a check- target for the directory.
- string(REPLACE ${directory} "" name_slash ${lit_suite})
+ string(REPLACE "${directory}/" "" name_slash ${lit_suite})
if (name_slash)
+ set(filter ${name_slash})
string(REPLACE "/" "-" name_slash ${name_slash})
string(REPLACE "\\" "-" name_dashes ${name_slash})
- string(TOLOWER "${project}${name_dashes}" name_var)
+ string(TOLOWER "${project}-${name_dashes}" name_var)
+ set(lit_args ${lit_suite})
+ if (ARG_BINARY_DIR)
+ set(lit_args ${ARG_BINARY_DIR} --filter=${filter})
+ endif()
add_lit_target("check-${name_var}" "Running lit suite ${lit_suite}"
- ${lit_suite}
+ ${lit_args}
${EXCLUDE_FROM_CHECK_ALL}
PARAMS ${ARG_PARAMS}
DEPENDS ${ARG_DEPENDS}
More information about the llvm-commits
mailing list