Skip to content

Commit

Permalink
[tests] Include Python binding tests in CMake rules
Browse files Browse the repository at this point in the history
Add a new CMake rule check-clang-python to run the Python bindings'
test suite, and include it in check-all.

Differential Revision: https://reviews.llvm.org/D52840

llvm-svn: 344258
  • Loading branch information
mgorny committed Oct 11, 2018
1 parent 3910c7b commit 61adf8a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clang/CMakeLists.txt
Expand Up @@ -485,6 +485,7 @@ if( CLANG_INCLUDE_TESTS )
)
endif()
add_subdirectory(test)
add_subdirectory(bindings/python/tests)

if(CLANG_BUILT_STANDALONE)
# Add a global check rule now that all subdirectories have been traversed
Expand All @@ -493,11 +494,13 @@ if( CLANG_INCLUDE_TESTS )
get_property(LLVM_LIT_PARAMS GLOBAL PROPERTY LLVM_LIT_PARAMS)
get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
get_property(LLVM_LIT_EXTRA_ARGS GLOBAL PROPERTY LLVM_LIT_EXTRA_ARGS)
get_property(LLVM_ADDITIONAL_TEST_TARGETS
GLOBAL PROPERTY LLVM_ADDITIONAL_TEST_TARGETS)
add_lit_target(check-all
"Running all regression tests"
${LLVM_LIT_TESTSUITES}
PARAMS ${LLVM_LIT_PARAMS}
DEPENDS ${LLVM_LIT_DEPENDS}
DEPENDS ${LLVM_LIT_DEPENDS} ${LLVM_ADDITIONAL_TEST_TARGETS}
ARGS ${LLVM_LIT_EXTRA_ARGS}
)
endif()
Expand Down
8 changes: 8 additions & 0 deletions clang/bindings/python/tests/CMakeLists.txt
@@ -0,0 +1,8 @@
# Test target to run Python test suite from main build.

add_custom_target(check-clang-python
COMMAND CLANG_LIBRARY_PATH=$<TARGET_FILE_DIR:libclang> ${PYTHON_EXECUTABLE} -m unittest discover
DEPENDS libclang
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)

set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-clang-python)

0 comments on commit 61adf8a

Please sign in to comment.