Skip to content

Commit

Permalink
Create a valid CTestTestfile for installation (ROCm#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
lawruble13 authored Sep 13, 2022
1 parent f9e0d85 commit d5c7068
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
# Copyright 2019-2021 Advanced Micro Devices, Inc.
# ########################################################################

set(INSTALL_TEST_FILE "${CMAKE_CURRENT_BINARY_DIR}/install_CTestTestfile.cmake")
file(WRITE "${INSTALL_TEST_FILE}"
[=[
# This is a test file generated by rocThrust for install time.
# It differs slightly from the default testfile, and you may encounter issues because of that.
]=]
)

if(NOT CMAKE_VERSION VERSION_LESS 3.12)
list(JOIN PRNG_SEEDS ", " PRNG_SEEDS_INITIALIZER)
else() # Workaround for not having string(JOIN) and list(JOIN)
Expand Down Expand Up @@ -36,6 +44,7 @@ function(add_relative_test test_name test_target)
endif()
file(RELATIVE_PATH rel_path "${CMAKE_CURRENT_BINARY_DIR}" "${EXE_PATH}/${EXE_NAME}")
add_test(NAME "${test_name}" COMMAND "./${rel_path}")
file(APPEND "${INSTALL_TEST_FILE}" "add_test(${test_name} \"../${EXE_NAME}\")\n")
endfunction()

function(add_rocthrust_test TEST)
Expand Down Expand Up @@ -215,3 +224,10 @@ add_rocthrust_test("zip_iterator_scan")
add_rocthrust_test("zip_iterator_sort")
add_rocthrust_test("zip_iterator_sort_by_key")
add_rocthrust_test("zip_iterator_reduce_by_key")

rocm_install(
FILES "${INSTALL_TEST_FILE}"
DESTINATION "${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}"
COMPONENT tests
RENAME "CTestTestfile.cmake"
)

0 comments on commit d5c7068

Please sign in to comment.