Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 69 additions & 18 deletions llvm/cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2192,13 +2192,24 @@ endfunction()

function(add_lit_testsuites project directory)
if (NOT LLVM_ENABLE_IDE)
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "FOLDER;BINARY_DIR" "PARAMS;DEPENDS;ARGS" ${ARGN})
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL"
"FOLDER;BINARY_DIR;EXCLUDE_DIRS;INCLUDE_DIRS"
"PARAMS;DEPENDS;ARGS"
${ARGN})

if (NOT ARG_FOLDER)
get_subproject_title(subproject_title)
set(ARG_FOLDER "${subproject_title}/Tests/LIT Testsuites")
endif()

separate_arguments(ARG_EXCLUDE_DIRS)
separate_arguments(ARG_INCLUDE_DIRS)

if (ARG_EXCLUDE_DIRS AND ARG_INCLUDE_DIRS)
message(FATAL_ERROR, "Cannot specify both include and exclude directories")
endif()


# Search recursively for test directories by assuming anything not
# in a directory called Inputs contains tests.
file(GLOB_RECURSE to_process LIST_DIRECTORIES true ${directory}/*)
Expand All @@ -2214,24 +2225,64 @@ function(add_lit_testsuites project directory)

# Create a check- target for the directory.
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)
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_args}
${EXCLUDE_FROM_CHECK_ALL}
PARAMS ${ARG_PARAMS}
DEPENDS ${ARG_DEPENDS}
ARGS ${ARG_ARGS}
)
set_target_properties(check-${name_var} PROPERTIES FOLDER ${ARG_FOLDER})
if (NOT name_slash)
continue()
endif()

# Determine whether to skip this directory.
#
# If the exclude list is specified, any directory that begins with one of
# the excluded paths will be excluded, others will be included.
#
# If the include list is specified, any directory that begins with one of
# the included paths will be included, others will be excluded.
#
# If neither is specified, all directories will be included.
if (ARG_EXCLUDE_DIRS)
# Include by default, unless in the exclude list.
set(is_skipped false)
foreach (excluded_dir ${ARG_EXCLUDE_DIRS})
string(FIND "${name_slash}" "${excluded_dir}" exclude_index)
if (exclude_index EQUAL 0)
set(is_skipped true)
break()
endif()
endforeach()
elseif(ARG_INCLUDE_DIRS)
# Exclude by default, unless in the include list.
set(is_skipped true)
foreach (included_dir ${ARG_INCLUDE_DIRS})
string(FIND "${name_slash}" "${included_dir}" include_index)
if (include_index EQUAL 0)
set(is_skipped false)
break()
endif()
endforeach()
else()
# If neither include nor exclude list is specified, include all.
set(is_skipped false)
endif()

if (is_skipped)
continue()
endif()

set(filter ${name_slash})
string(REPLACE "/" "-" name_slash ${name_slash})
string(REPLACE "\\" "-" name_dashes ${name_slash})
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_args}
${EXCLUDE_FROM_CHECK_ALL}
PARAMS ${ARG_PARAMS}
DEPENDS ${ARG_DEPENDS}
ARGS ${ARG_ARGS}
)
set_target_properties(check-${name_var} PROPERTIES FOLDER ${ARG_FOLDER})
endforeach()
endif()
endfunction()
Expand Down
214 changes: 121 additions & 93 deletions llvm/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,100 +59,104 @@ configure_lit_site_cfg(

# Set the depends list as a variable so that it can grow conditionally.
# NOTE: Sync the substitutions in test/lit.cfg when adding to this list.

set(LLVM_TEST_DEPENDS_COMMON
FileCheck
count
llvm-config
not
)

set(LLVM_TEST_DEPENDS
BugpointPasses
FileCheck
LLVMWindowsDriver
UnitTests
bugpoint
count
llc
lli
lli-child-target
llvm-addr2line
llvm-ar
llvm-as
llvm-bcanalyzer
llvm-bitcode-strip
llvm-c-test
llvm-cat
llvm-cfi-verify
llvm-cgdata
llvm-config
llvm-cov
llvm-ctxprof-util
llvm-cvtres
llvm-cxxdump
llvm-cxxfilt
llvm-cxxmap
llvm-debuginfo-analyzer
llvm-debuginfod-find
llvm-diff
llvm-dis
llvm-dlltool
dsymutil
llvm-dwarfdump
llvm-dwarfutil
llvm-dwp
llvm-exegesis
llvm-extract
llvm-gsymutil
llvm-ir2vec
llvm-isel-fuzzer
llvm-ifs
llvm-install-name-tool
llvm-jitlink
llvm-lib
llvm-libtool-darwin
llvm-link
llvm-lipo
llvm-locstats
llvm-lto2
llvm-mc
llvm-mca
llvm-ml
llvm-ml64
llvm-modextract
llvm-nm
llvm-objcopy
llvm-objdump
llvm-opt-fuzzer
llvm-opt-report
llvm-offload-wrapper
llvm-otool
llvm-pdbutil
llvm-profdata
llvm-profgen
llvm-ranlib
llvm-rc
llvm-readobj
llvm-readelf
llvm-reduce
llvm-remarkutil
llvm-rtdyld
llvm-sim
llvm-size
llvm-split
llvm-stress
llvm-strings
llvm-strip
llvm-symbolizer
llvm-tblgen
llvm-readtapi
llvm-tli-checker
llvm-undname
llvm-windres
llvm-xray
not
obj2yaml
opt
sancov
sanstats
split-file
verify-uselistorder
yaml-bench
yaml2obj
)
BugpointPasses
LLVMWindowsDriver
UnitTests
bugpoint
llc
lli
lli-child-target
llvm-addr2line
llvm-ar
llvm-as
llvm-bcanalyzer
llvm-bitcode-strip
llvm-c-test
llvm-cat
llvm-cfi-verify
llvm-cgdata
llvm-cov
llvm-ctxprof-util
llvm-cvtres
llvm-cxxdump
llvm-cxxfilt
llvm-cxxmap
llvm-debuginfo-analyzer
llvm-debuginfod-find
llvm-diff
llvm-dis
llvm-dlltool
dsymutil
llvm-dwarfdump
llvm-dwarfutil
llvm-dwp
llvm-exegesis
llvm-extract
llvm-gsymutil
llvm-ir2vec
llvm-isel-fuzzer
llvm-ifs
llvm-install-name-tool
llvm-jitlink
llvm-lib
llvm-libtool-darwin
llvm-link
llvm-lipo
llvm-locstats
llvm-lto2
llvm-mc
llvm-mca
llvm-ml
llvm-ml64
llvm-modextract
llvm-nm
llvm-objcopy
llvm-objdump
llvm-opt-fuzzer
llvm-opt-report
llvm-offload-wrapper
llvm-otool
llvm-pdbutil
llvm-profdata
llvm-profgen
llvm-ranlib
llvm-rc
llvm-readobj
llvm-readelf
llvm-reduce
llvm-remarkutil
llvm-rtdyld
llvm-sim
llvm-size
llvm-split
llvm-stress
llvm-strings
llvm-strip
llvm-symbolizer
llvm-tblgen
llvm-readtapi
llvm-tli-checker
llvm-undname
llvm-windres
llvm-xray
obj2yaml
opt
sancov
sanstats
split-file
verify-uselistorder
yaml-bench
yaml2obj
)

if(TARGET llvm-lto)
set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-lto)
Expand Down Expand Up @@ -259,10 +263,34 @@ add_lit_testsuite(check-llvm "Running the LLVM regression tests"
)
set_target_properties(check-llvm PROPERTIES FOLDER "LLVM/Tests")

# Note, exclude TableGen and FileCheck directories as we define them with a
# reduced set of dependencies below.
add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
${exclude_from_check_all}
DEPENDS ${LLVM_TEST_DEPENDS_COMMON}
DEPENDS ${LLVM_TEST_DEPENDS}
FOLDER "Tests/Subdirectories"
EXCLUDE_DIRS "TableGen FileCheck"
)

# Subset of dependencies for TableGen lit test.
set(LLVM_TEST_TABLEGEN_DEPENDS
llvm-tblgen
)

add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
${exclude_from_check_all}
DEPENDS ${LLVM_TEST_DEPENDS_COMMON}
DEPENDS ${LLVM_TEST_TABLEGEN_DEPENDS}
FOLDER "Tests/Subdirectories"
INCLUDE_DIRS "TableGen"
)

add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
${exclude_from_check_all}
DEPENDS ${LLVM_TEST_DEPENDS_COMMON}
FOLDER "Tests/Subdirectories"
INCLUDE_DIRS "FileCheck"
)

# Setup an alias for 'check-all'.
Expand Down