Skip to content

Commit c0269c4

Browse files
authored
[CMake] add SKIP to add_lit_testsuites (llvm#157176)
This PR adds `SKIP` to `add_lit_testsuites`. The purpose is to let people filter the currently exhaustive inclusion of subdirectories which might not all depend on the same `DEPENDS`. The immediate use case is MLIR where we have a collection of Python tests that currently trigger rebuilds of various tools (like `mlir-opt`) which they do not depend on. That collection of tests is updated here too.
1 parent bbbba4e commit c0269c4

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,12 @@ endfunction()
21922192

21932193
function(add_lit_testsuites project directory)
21942194
if (NOT LLVM_ENABLE_IDE)
2195-
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "FOLDER;BINARY_DIR" "PARAMS;DEPENDS;ARGS" ${ARGN})
2195+
cmake_parse_arguments(ARG
2196+
"EXCLUDE_FROM_CHECK_ALL"
2197+
"FOLDER;BINARY_DIR"
2198+
"PARAMS;DEPENDS;ARGS;SKIP"
2199+
${ARGN}
2200+
)
21962201

21972202
if (NOT ARG_FOLDER)
21982203
get_subproject_title(subproject_title)
@@ -2214,6 +2219,16 @@ function(add_lit_testsuites project directory)
22142219

22152220
# Create a check- target for the directory.
22162221
string(REPLACE "${directory}/" "" name_slash ${lit_suite})
2222+
set(_should_skip FALSE)
2223+
foreach(skip IN LISTS ARG_SKIP)
2224+
if(name_slash MATCHES "${skip}")
2225+
set(_should_skip TRUE)
2226+
break()
2227+
endif()
2228+
endforeach()
2229+
if (_should_skip)
2230+
continue()
2231+
endif()
22172232
if (name_slash)
22182233
set(filter ${name_slash})
22192234
string(REPLACE "/" "-" name_slash ${name_slash})

mlir/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,5 @@ add_lit_testsuite(check-mlir "Running the MLIR regression tests"
247247

248248
add_lit_testsuites(MLIR ${CMAKE_CURRENT_SOURCE_DIR}
249249
DEPENDS ${MLIR_TEST_DEPENDS}
250+
SKIP "^python*"
250251
)

mlir/test/python/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,12 @@ mlir_tablegen(lib/PythonTestTypes.cpp.inc -gen-typedef-defs)
1010
add_public_tablegen_target(MLIRPythonTestIncGen)
1111

1212
add_subdirectory(lib)
13+
14+
set(MLIR_PYTHON_TEST_DEPENDS MLIRPythonModules)
15+
if(NOT MLIR_STANDALONE_BUILD)
16+
list(APPEND MLIR_PYTHON_TEST_DEPENDS FileCheck count)
17+
endif()
18+
add_lit_testsuite(check-mlir-python "Running the MLIR Python regression tests"
19+
${CMAKE_CURRENT_BINARY_DIR}
20+
DEPENDS ${MLIR_PYTHON_TEST_DEPENDS}
21+
)

0 commit comments

Comments
 (0)