Skip to content

Commit 01a7a21

Browse files
authored
[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.
1 parent 8063bd1 commit 01a7a21

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,7 @@ 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" "PARAMS;DEPENDS;ARGS" ${ARGN})
2195+
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "FOLDER;BINARY_DIR" "PARAMS;DEPENDS;ARGS" ${ARGN})
21962196

21972197
if (NOT ARG_FOLDER)
21982198
get_subproject_title(subproject_title)
@@ -2213,13 +2213,18 @@ function(add_lit_testsuites project directory)
22132213
endif()
22142214

22152215
# Create a check- target for the directory.
2216-
string(REPLACE ${directory} "" name_slash ${lit_suite})
2216+
string(REPLACE "${directory}/" "" name_slash ${lit_suite})
22172217
if (name_slash)
2218+
set(filter ${name_slash})
22182219
string(REPLACE "/" "-" name_slash ${name_slash})
22192220
string(REPLACE "\\" "-" name_dashes ${name_slash})
2220-
string(TOLOWER "${project}${name_dashes}" name_var)
2221+
string(TOLOWER "${project}-${name_dashes}" name_var)
2222+
set(lit_args ${lit_suite})
2223+
if (ARG_BINARY_DIR)
2224+
set(lit_args ${ARG_BINARY_DIR} --filter=${filter})
2225+
endif()
22212226
add_lit_target("check-${name_var}" "Running lit suite ${lit_suite}"
2222-
${lit_suite}
2227+
${lit_args}
22232228
${EXCLUDE_FROM_CHECK_ALL}
22242229
PARAMS ${ARG_PARAMS}
22252230
DEPENDS ${ARG_DEPENDS}

0 commit comments

Comments
 (0)