diff --git a/CMakeLists.txt b/CMakeLists.txt index 6db40118c491..cecb7e80624f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,9 @@ if(NOT WIN32) endif() if(TRITON_BUILD_UT) + # This is an aggregate target for all unit tests. + add_custom_target(TritonUnitTests) + set_target_properties(TritonUnitTests PROPERTIES FOLDER "Triton/Tests") include(AddTritonUnitTest) endif() @@ -340,4 +343,10 @@ add_subdirectory(test) if(TRITON_BUILD_UT) add_subdirectory(unittest) + # This target runs all the unit tests. + add_custom_target(check-triton-unit-tests + COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure + DEPENDS TritonUnitTests + USES_TERMINAL + ) endif() diff --git a/cmake/AddTritonUnitTest.cmake b/cmake/AddTritonUnitTest.cmake index 2eda7df3723e..a9efb9ad1ad8 100644 --- a/cmake/AddTritonUnitTest.cmake +++ b/cmake/AddTritonUnitTest.cmake @@ -36,4 +36,7 @@ function(add_triton_ut) # laptop. I think the issue may be that the very first time you run a program # it's a bit slow. gtest_discover_tests(${__NAME} DISCOVERY_TIMEOUT 60) + + # Add the unit test to the top-level unit test target. + add_dependencies(TritonUnitTests ${__NAME}) endfunction()