xref: /aosp_15_r20/external/pytorch/c10/cuda/test/CMakeLists.txt (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1# ---[ Test binaries.
2
3set(C10_CUDA_ALL_TEST_FILES
4    impl/CUDAAssertionsTest_1_var_test.cu
5    impl/CUDAAssertionsTest_catches_stream.cu
6    impl/CUDAAssertionsTest_catches_thread_and_block_and_device.cu
7    impl/CUDAAssertionsTest_from_2_processes.cu
8    impl/CUDAAssertionsTest_multiple_writes_from_blocks_and_threads.cu
9    impl/CUDAAssertionsTest_multiple_writes_from_multiple_blocks.cu
10    impl/CUDAAssertionsTest_multiple_writes_from_same_block.cu
11    impl/CUDATest.cpp
12)
13if(BUILD_TEST)
14  foreach(test_src ${C10_CUDA_ALL_TEST_FILES})
15    get_filename_component(test_file_name ${test_src} NAME_WE)
16    set(test_name "c10_cuda_${test_file_name}")
17    add_executable(${test_name} "${test_src}")
18    target_link_libraries(${test_name} ${C10_CUDA_LIB} ${C10_LIB} gtest_main)
19    add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
20    if(INSTALL_TEST)
21      install(TARGETS ${test_name} DESTINATION test)
22    endif()
23  endforeach()
24endif()
25