Skip to content

Commit

Permalink
Create an aggregate check-triton-unit target (#5150)
Browse files Browse the repository at this point in the history
This adds a CMake target `check-triton-unit` that builds an runs all
Triton unittests written in gtest. This makes it more conveninent to
rebuild and run all unittests at once with finer granularity (instead of
`ninja; ctest`).
  • Loading branch information
Mogball authored Nov 27, 2024
1 parent 678e492 commit 8b29bb7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
3 changes: 3 additions & 0 deletions cmake/AddTritonUnitTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 8b29bb7

Please sign in to comment.