diff --git a/projects/hip-tests/catch/CMakeLists.txt b/projects/hip-tests/catch/CMakeLists.txt index 8d8e3fee95..43c830c6c1 100644 --- a/projects/hip-tests/catch/CMakeLists.txt +++ b/projects/hip-tests/catch/CMakeLists.txt @@ -159,21 +159,20 @@ endif() add_definitions(-DKERNELS_PATH="${CMAKE_CURRENT_SOURCE_DIR}/kernels/") set(CATCH_BUILD_DIR catch_tests) -execute_process(COMMAND ${CMAKE_COMMAND} -E - make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/hipTestMain/config) +set(HIP_TEST_CONFIG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/config) +file(MAKE_DIRECTORY ${HIP_TEST_CONFIG_BINARY_DIR}) file(GLOB JSON_FILES "./hipTestMain/config/*.json") foreach(json IN LISTS JSON_FILES) file(COPY ${json} - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/hipTestMain/config/) + DESTINATION ${HIP_TEST_CONFIG_BINARY_DIR}) endforeach() +set(CATCH_SCRIPT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/script) file(COPY ./external/Catch2/cmake/Catch2/CatchAddTests.cmake - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/script) + DESTINATION ${CATCH_SCRIPT_BINARY_DIR}) file(COPY ./external/Catch2/cmake/Catch2/catch_include.cmake - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/script) -set(ADD_SCRIPT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/script/CatchAddTests.cmake) -set(CATCH_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/script/catch_include.cmake) - - + DESTINATION ${CATCH_SCRIPT_BINARY_DIR}) +set(ADD_SCRIPT_PATH ${CATCH_SCRIPT_BINARY_DIR}/CatchAddTests.cmake) +set(CATCH_INCLUDE_PATH ${CATCH_SCRIPT_BINARY_DIR}/catch_include.cmake) if (WIN32) configure_file(catchProp_in_rc.in ${CMAKE_CURRENT_BINARY_DIR}/catchProp.rc @ONLY) @@ -268,12 +267,10 @@ foreach(__offload_arch ${OFFLOAD_ARCH_LIST}) list(REMOVE_DUPLICATES hip_gpu_arch_list) endforeach() -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/hipTestMain/config) -set(config_gen_path ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/hipTestMain/config) if(WIN32) set(configToUse "config_amd_windows") set(config_file ${CMAKE_SOURCE_DIR}/hipTestMain/config/${configToUse}) - set(json_file ${config_gen_path}/${configToUse}.json) + set(json_file ${HIP_TEST_CONFIG_BINARY_DIR}/${configToUse}.json) set(CLANG_CPP "${HIP_PATH}/../lc/bin/clang-cpp.exe") set(cmd "${CLANG_CPP} -P -DGITHASH=\"${HIP_VERSION_GITHASH}\" ${config_file}>${json_file}") @@ -285,8 +282,7 @@ else() set(configToUse "config_amd_linux") foreach(arch ${hip_gpu_arch_list}) set(config_file ${CMAKE_SOURCE_DIR}/hipTestMain/config/${configToUse}) - set(config_gen_path ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/hipTestMain/config) - set(json_file ${config_gen_path}/${configToUse}_${arch}.json) + set(json_file ${HIP_TEST_CONFIG_BINARY_DIR}/${configToUse}_${arch}.json) set(cmd "${ROCM_PATH}/llvm/bin/clang-cpp -P -D${arch} -DGITHASH=\\\"${HIP_VERSION_GITHASH}\\\" ${config_file}>${json_file}") message(${cmd}) execute_process(COMMAND bash -c ${cmd} @@ -305,7 +301,6 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/catchInfo.txt ${_catch # allows user to run ctest from catch_tests level set(_subdirs ${_autogen} "subdirs(..)\n") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/CTestTestfile.cmake ${_subdirs}) - find_package(Python3 COMPONENTS Interpreter REQUIRED) # copy python script and headers to catch test package diff --git a/projects/hip-tests/catch/external/Catch2/cmake/Catch2/Catch.cmake b/projects/hip-tests/catch/external/Catch2/cmake/Catch2/Catch.cmake index c6c7471554..fe5a7b586d 100644 --- a/projects/hip-tests/catch/external/Catch2/cmake/Catch2/Catch.cmake +++ b/projects/hip-tests/catch/external/Catch2/cmake/Catch2/Catch.cmake @@ -209,7 +209,7 @@ endfunction() #------------------------------------------------------------------------------ # current staging -function(catch_discover_tests TARGET_LIST TEST_SET) +function(catch_discover_tests TARGET) cmake_parse_arguments( "" "" @@ -217,29 +217,53 @@ function(catch_discover_tests TARGET_LIST TEST_SET) "TEST_SPEC;EXTRA_ARGS;PROPERTIES" ${ARGN} ) + + if(NOT _WORKING_DIRECTORY) + set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + endif() + get_property(crosscompiling_emulator + TARGET ${TARGET} + PROPERTY CROSSCOMPILING_EMULATOR + ) ## Generate a unique name based on the extra arguments string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS} ${_REPORTER} ${_OUTPUT_DIR} ${_OUTPUT_PREFIX} ${_OUTPUT_SUFFIX}") string(SUBSTRING ${args_hash} 0 7 args_hash) # Define rule to generate test list for aforementioned test executable - set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TEST_SET}_include-${args_hash}.cmake") - set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TEST_SET}_tests-${args_hash}.cmake") - file(RELATIVE_PATH ctestincludepath ${CMAKE_CURRENT_BINARY_DIR} ${ctest_include_file}) - file(RELATIVE_PATH ctestfilepath ${CMAKE_CURRENT_BINARY_DIR} ${ctest_tests_file}) + set(ctest_include_file_build "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include_build-${args_hash}.cmake") + set(ctest_include_file_install "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include_install-${args_hash}.cmake") + set(ctest_tests_file_name "${TARGET}_tests-${args_hash}.cmake") + set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${ctest_tests_file_name}") + file(RELATIVE_PATH ctest_include_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${ctest_include_file_build}) + file(RELATIVE_PATH ctest_file_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${ctest_tests_file}) file(RELATIVE_PATH _CATCH_ADD_TEST_SCRIPT ${CMAKE_CURRENT_BINARY_DIR} ${ADD_SCRIPT_PATH}) file(RELATIVE_PATH CATCH_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR} ${CATCH_INCLUDE_PATH}) if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0") - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${ctestfilepath} "") - file(WRITE ${ctest_include_file} "set(exc_names ${TARGET_LIST})\n") - file(APPEND ${ctest_include_file} "set(TARGET ${TEST_SET})\n") - file(APPEND ${ctest_include_file} "set(_TEST_LIST ${TEST_SET}_TESTS)\n") - file(APPEND ${ctest_include_file} "set(ctestfilepath ${ctestfilepath})\n") - file(APPEND ${ctest_include_file} "set(_CATCH_ADD_TEST_SCRIPT ${_CATCH_ADD_TEST_SCRIPT})\n") - file(APPEND ${ctest_include_file} "set(crosscompiling_emulator ${crosscompiling_emulator})\n") - file(APPEND ${ctest_include_file} "set(_PROPERTIES ${_PROPERTIES})\n") - file(APPEND ${ctest_include_file} "include(${CATCH_INCLUDE_PATH})\n") + # write build time include file + file(WRITE ${ctest_include_file_build} "set(_TARGET_EXECUTABLE ${TARGET})\n") + file(APPEND ${ctest_include_file_build} "set(TARGET ${TARGET})\n") + file(APPEND ${ctest_include_file_build} "set(_TEST_LIST ${TARGET}_TESTS)\n") + file(APPEND ${ctest_include_file_build} "set(ctestfilepath ${ctest_file_rel_path})\n") + file(APPEND ${ctest_include_file_build} "set(_CATCH_ADD_TEST_SCRIPT ${_CATCH_ADD_TEST_SCRIPT})\n") + file(APPEND ${ctest_include_file_build} "set(crosscompiling_emulator ${crosscompiling_emulator})\n") + file(APPEND ${ctest_include_file_build} "set(_PROPERTIES ${_PROPERTIES})\n") + file(APPEND ${ctest_include_file_build} "include(${CATCH_INCLUDE_PATH})\n") # Add discovered tests to directory TEST_INCLUDE_FILES set_property(DIRECTORY - APPEND PROPERTY TEST_INCLUDE_FILES "${ctestincludepath}" + APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_rel_path}" + ) + + # write install time include file + file(WRITE ${ctest_include_file_install} "set(_TARGET_EXECUTABLE ${TARGET})\n") + file(APPEND ${ctest_include_file_install} "set(TARGET ${TARGET})\n") + file(APPEND ${ctest_include_file_install} "set(_TEST_LIST ${TARGET}_TESTS)\n") + file(APPEND ${ctest_include_file_install} "set(ctestfilepath script/${ctest_tests_file_name})\n") + file(APPEND ${ctest_include_file_install} "set(_CATCH_ADD_TEST_SCRIPT script/CatchAddTests.cmake)\n") + file(APPEND ${ctest_include_file_install} "set(crosscompiling_emulator ${crosscompiling_emulator})\n") + file(APPEND ${ctest_include_file_install} "set(_PROPERTIES ${_PROPERTIES})\n") + file(APPEND ${ctest_include_file_install} "include(script/catch_include.cmake)\n") + + set_property(GLOBAL + APPEND PROPERTY G_INSTALL_CTEST_INCLUDE_FILES "${ctest_include_file_install}" ) endif() @@ -400,17 +424,15 @@ function(hip_add_exe_to_target) foreach(arg IN LISTS _UNPARSED_ARGUMENTS) message(WARNING "Unparsed arguments: ${arg}") endforeach() - get_property(crosscompiling_emulator - TARGET ${_EXE_NAME} - PROPERTY CROSSCOMPILING_EMULATOR - ) - set(_EXE_NAME_LIST ${_EXE_NAME_LIST} ${_EXE_NAME}) + # add binary to global list of binaries to install + set_property(GLOBAL APPEND PROPERTY G_INSTALL_EXE_TARGETS ${_EXE_NAME}) + catch_discover_tests("${_EXE_NAME}" PROPERTIES SKIP_REGULAR_EXPRESSION "HIP_SKIP_THIS_TEST") + if(NOT STANDALONE_TESTS EQUAL "1") break() endif() endforeach() - catch_discover_tests("${_EXE_NAME_LIST}" "${_NAME}" PROPERTIES SKIP_REGULAR_EXPRESSION "HIP_SKIP_THIS_TEST") endfunction() diff --git a/projects/hip-tests/catch/external/Catch2/cmake/Catch2/CatchAddTests.cmake b/projects/hip-tests/catch/external/Catch2/cmake/Catch2/CatchAddTests.cmake index 29a8e9aa12..52c7b5008f 100644 --- a/projects/hip-tests/catch/external/Catch2/cmake/Catch2/CatchAddTests.cmake +++ b/projects/hip-tests/catch/external/Catch2/cmake/Catch2/CatchAddTests.cmake @@ -30,115 +30,105 @@ function(add_command NAME) endfunction() -foreach(TEST_EXECUTABLE ${TEST_EXE_LIST}) - if(WIN32) - set(TEST_EXECUTABLE ${TEST_EXECUTABLE}.exe) - endif() - get_filename_component(TEST_EXECUTABLE ${TEST_EXECUTABLE} ABSOLUTE) +if(WIN32) + set(TEST_EXECUTABLE ${TEST_EXECUTABLE}.exe) +endif() +get_filename_component(TEST_EXECUTABLE ${TEST_EXECUTABLE} ABSOLUTE) - # Run test executable to get list of available tests - if(NOT EXISTS "${TEST_EXECUTABLE}") - # exe does not exist moving to the next executable - continue() - endif() - execute_process( - COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only - OUTPUT_VARIABLE output - RESULT_VARIABLE result - WORKING_DIRECTORY "${TEST_WORKING_DIR}" +execute_process( + COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only + OUTPUT_VARIABLE output + RESULT_VARIABLE result + WORKING_DIRECTORY "${TEST_WORKING_DIR}" +) +# Catch --list-test-names-only reports the number of tests, so 0 is... surprising +if(${result} EQUAL 0) + message(WARNING + "Test executable '${TEST_EXECUTABLE}' contains no tests!\n" ) - # Catch --list-test-names-only reports the number of tests, so 0 is... surprising - if(${result} EQUAL 0) - message(WARNING - "Test executable '${TEST_EXECUTABLE}' contains no tests!\n" - ) - elseif(${result} LESS 0) - message(FATAL_ERROR - "Error running test executable '${TEST_EXECUTABLE}':\n" - " Result: ${result}\n" - " Output: ${output}\n" - ) - endif() - - string(REPLACE "\n" ";" output "${output}") - - # Run test executable to get list of available reporters - execute_process( - COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-reporters - OUTPUT_VARIABLE reporters_output - RESULT_VARIABLE reporters_result - WORKING_DIRECTORY "${TEST_WORKING_DIR}" +elseif(${result} LESS 0) + message(FATAL_ERROR + "Error running test executable '${TEST_EXECUTABLE}':\n" + " Result: ${result}\n" + " Output: ${output}\n" ) - if(${reporters_result} EQUAL 0) - message(WARNING - "Test executable '${TEST_EXECUTABLE}' contains no reporters!\n" - ) - elseif(${reporters_result} LESS 0) - message(FATAL_ERROR - "Error running test executable '${TEST_EXECUTABLE}':\n" - " Result: ${reporters_result}\n" - " Output: ${reporters_output}\n" - ) +endif() + +string(REPLACE "\n" ";" output "${output}") + +# Run test executable to get list of available reporters +execute_process( + COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-reporters + OUTPUT_VARIABLE reporters_output + RESULT_VARIABLE reporters_result + WORKING_DIRECTORY "${TEST_WORKING_DIR}" +) +if(${reporters_result} EQUAL 0) + message(WARNING + "Test executable '${TEST_EXECUTABLE}' contains no reporters!\n" + ) +elseif(${reporters_result} LESS 0) + message(FATAL_ERROR + "Error running test executable '${TEST_EXECUTABLE}':\n" + " Result: ${reporters_result}\n" + " Output: ${reporters_output}\n" + ) +endif() +string(FIND "${reporters_output}" "${reporter}" reporter_is_valid) +if(reporter AND ${reporter_is_valid} EQUAL -1) + message(FATAL_ERROR + "\"${reporter}\" is not a valid reporter!\n" + ) +endif() + +# Prepare reporter +if(reporter) + set(reporter_arg "--reporter ${reporter}") +endif() + +# Prepare output dir +if(output_dir AND NOT IS_ABSOLUTE ${output_dir}) + set(output_dir "${TEST_WORKING_DIR}/${output_dir}") + if(NOT EXISTS ${output_dir}) + file(MAKE_DIRECTORY ${output_dir}) endif() - string(FIND "${reporters_output}" "${reporter}" reporter_is_valid) - if(reporter AND ${reporter_is_valid} EQUAL -1) - message(FATAL_ERROR - "\"${reporter}\" is not a valid reporter!\n" - ) +endif() + +# Parse output +foreach(line ${output}) + set(test ${line}) + # Escape characters in test case names that would be parsed by Catch2 + set(test_name ${test}) + foreach(char , [ ]) + string(REPLACE ${char} "\\${char}" test_name ${test_name}) + endforeach(char) + # ...add output dir + if(output_dir) + string(REGEX REPLACE "[^A-Za-z0-9_]" "_" test_name_clean ${test_name}) + set(output_dir_arg "--out ${output_dir}/${output_prefix}${test_name_clean}${output_suffix}") endif() - # Prepare reporter - if(reporter) - set(reporter_arg "--reporter ${reporter}") - endif() - - # Prepare output dir - if(output_dir AND NOT IS_ABSOLUTE ${output_dir}) - set(output_dir "${TEST_WORKING_DIR}/${output_dir}") - if(NOT EXISTS ${output_dir}) - file(MAKE_DIRECTORY ${output_dir}) - endif() - endif() - - # Parse output - foreach(line ${output}) - set(test ${line}) - # Escape characters in test case names that would be parsed by Catch2 - set(test_name ${test}) - foreach(char , [ ]) - string(REPLACE ${char} "\\${char}" test_name ${test_name}) - endforeach(char) - # ...add output dir - if(output_dir) - string(REGEX REPLACE "[^A-Za-z0-9_]" "_" test_name_clean ${test_name}) - set(output_dir_arg "--out ${output_dir}/${output_prefix}${test_name_clean}${output_suffix}") - endif() - - file(RELATIVE_PATH exe_path ${CMAKE_CURRENT_BINARY_DIR} ${TEST_EXECUTABLE}) - - # ...and add to script - add_command(add_test - "${prefix}${test}${suffix}" - ${TEST_EXECUTOR} - "${exe_path}" - "${test_name}" - ${extra_args} - "${reporter_arg}" - "${output_dir_arg}" - ) - add_command(set_tests_properties - "${prefix}${test}${suffix}" - PROPERTIES - ${properties} - ) - list(APPEND tests "${prefix}${test}${suffix}") - endforeach() - - # Create a list of all discovered tests, which users may use to e.g. set - # properties on the tests - add_command(set ${TEST_LIST} ${tests}) - + # ...and add to script + add_command(add_test + "${prefix}${test}${suffix}" + ${TEST_EXECUTOR} + "${TEST_EXECUTABLE}" + "${test_name}" + ${extra_args} + "${reporter_arg}" + "${output_dir_arg}" + ) + add_command(set_tests_properties + "${prefix}${test}${suffix}" + PROPERTIES + ${properties} + ) + list(APPEND tests "${prefix}${test}${suffix}") endforeach() +# Create a list of all discovered tests, which users may use to e.g. set +# properties on the tests +add_command(set ${TEST_LIST} ${tests}) + # Write CTest script file(WRITE "${CTEST_FILE}" "${script}") diff --git a/projects/hip-tests/catch/external/Catch2/cmake/Catch2/catch_include.cmake b/projects/hip-tests/catch/external/Catch2/cmake/Catch2/catch_include.cmake index 2c9efa030d..383d230f44 100644 --- a/projects/hip-tests/catch/external/Catch2/cmake/Catch2/catch_include.cmake +++ b/projects/hip-tests/catch/external/Catch2/cmake/Catch2/catch_include.cmake @@ -5,9 +5,9 @@ get_filename_component(_cmake_path cmake ABSOLUTE) execute_process( COMMAND "${_cmake_path}" -D "TEST_TARGET=${TARGET}" - -D "TEST_EXE_LIST=${exc_names}" + -D "TEST_EXECUTABLE=${_TARGET_EXECUTABLE}" -D "TEST_EXECUTOR=${crosscompiling_emulator}" - -D "TEST_WORKING_DIR=${_workdir}" + -D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}" -D "TEST_SPEC=${_TEST_SPEC}" -D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}" -D "TEST_PROPERTIES=${_PROPERTIES}" diff --git a/projects/hip-tests/catch/hipTestMain/hip_test_context.cc b/projects/hip-tests/catch/hipTestMain/hip_test_context.cc index 05d71fb1a6..520ce9b09a 100644 --- a/projects/hip-tests/catch/hipTestMain/hip_test_context.cc +++ b/projects/hip-tests/catch/hipTestMain/hip_test_context.cc @@ -139,7 +139,6 @@ std::string& TestContext::getCommonJsonFile() { // check a max of 5 levels down the executable path while (levels < 5) { fs::path temp_path = config_dir; - temp_path /= "hipTestMain"; temp_path /= "config"; if (fs::exists(temp_path)) { config_dir = fs::absolute(temp_path); diff --git a/projects/hip-tests/catch/multiproc/CMakeLists.txt b/projects/hip-tests/catch/multiproc/CMakeLists.txt index 448c5bf569..3890bc0bda 100644 --- a/projects/hip-tests/catch/multiproc/CMakeLists.txt +++ b/projects/hip-tests/catch/multiproc/CMakeLists.txt @@ -18,7 +18,13 @@ set(TEST_SRC ) if(UNIX) - add_custom_target(dummy_kernel.code COMMAND ${CMAKE_CXX_COMPILER} --genco ${CMAKE_CURRENT_SOURCE_DIR}/dummy_kernel.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/../multiproc/dummy_kernel.code -I${HIP_PATH}/include/ -I${CMAKE_CURRENT_SOURCE_DIR}/../../include) + add_custom_target(dummy_kernel.code + COMMAND ${CMAKE_CXX_COMPILER} + --genco ${CMAKE_CURRENT_SOURCE_DIR}/dummy_kernel.cpp + -o ${CMAKE_CURRENT_BINARY_DIR}/../multiproc/dummy_kernel.code + -I${HIP_PATH}/include/ -I${CMAKE_CURRENT_SOURCE_DIR}/../../include) + set_property(GLOBAL APPEND PROPERTY + G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/dummy_kernel.code) endif() # the last argument linker libraries is required for this test but optional to the function diff --git a/projects/hip-tests/catch/packaging/CMakeLists.txt b/projects/hip-tests/catch/packaging/CMakeLists.txt index 67515613ce..f516ddfd8e 100644 --- a/projects/hip-tests/catch/packaging/CMakeLists.txt +++ b/projects/hip-tests/catch/packaging/CMakeLists.txt @@ -60,12 +60,24 @@ else() set (CPACK_RPM_PACKAGE_REQUIRES "rocm-core, hip-static-devel") endif() -if(NOT WIN32) -install(DIRECTORY ${PROJECT_BINARY_DIR}/${CATCH_BUILD_DIR} - DESTINATION ${CMAKE_INSTALL_DATADIR}/hip - USE_SOURCE_PERMISSIONS) -install(FILES ${PROJECT_BINARY_DIR}/CTestTestfile.cmake DESTINATION ${CMAKE_INSTALL_DATADIR}/hip) +# Get all the files that needs to be installed in the global property +get_property(INSTALL_CTEST_INCLUDE_FILES GLOBAL PROPERTY G_INSTALL_CTEST_INCLUDE_FILES) +get_property(INSTALL_EXE_TARGETS GLOBAL PROPERTY G_INSTALL_EXE_TARGETS) +get_property(INSTALL_CUSTOM_TARGETS GLOBAL PROPERTY G_INSTALL_CUSTOM_TARGETS) +get_property(INSTALL_SRC_FILES GLOBAL PROPERTY G_INSTALL_SRC_FILES) +get_property(INSTALL_HEADER_FILES GLOBAL PROPERTY G_INSTALL_HEADER_FILES) +# Create top level CTestTestfile.cmake +file(WRITE ${PROJECT_BINARY_DIR}/${CATCH_BUILD_DIR}/script/CTestTestfile.cmake ${_autogen}) +foreach(CTEST_INCLUDE_FILE ${INSTALL_CTEST_INCLUDE_FILES}) + get_filename_component(INCLUDE_FILE_NAME ${CTEST_INCLUDE_FILE} NAME) + file(APPEND ${PROJECT_BINARY_DIR}/${CATCH_BUILD_DIR}/script/CTestTestfile.cmake + "include(script/${INCLUDE_FILE_NAME})\n") +endforeach() +file(WRITE ${PROJECT_BINARY_DIR}/${CATCH_BUILD_DIR}/script/windows/CTestTestfile.cmake + "${_autogen}\nsubdirs(${CATCH_BUILD_DIR})") +if(NOT WIN32) +set(INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/hip) set(CPACK_GENERATOR "TGZ;DEB;RPM" CACHE STRING "Linux package types for catch tests") set(CPACK_BINARY_DEB "ON") set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") @@ -104,20 +116,60 @@ set(CPACK_SOURCE_GENERATOR "TGZ") # Install license file set ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/../LICENSE.txt" ) -install(FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION ${CMAKE_INSTALL_DATADIR}/hip) +install(FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION ${INSTALL_DIR}) set(CPACK_RPM_PACKAGE_LICENSE "MIT") else() # windows packaging +set(INSTALL_DIR .) set(CPACK_INSTALL_PREFIX "") -install(DIRECTORY ${PROJECT_BINARY_DIR}/${CATCH_BUILD_DIR} - DESTINATION . - USE_SOURCE_PERMISSIONS) -install(FILES ${PROJECT_BINARY_DIR}/CTestTestfile.cmake DESTINATION .) set(CPACK_SYSTEM_NAME "") set(CPACK_GENERATOR "ZIP" CACHE STRING "Windows package types for catch tests") set(CPACK_TEST_ZIP "ON") set(CPACK_ZIP_TEST_PACKAGE_NAME "catch") endif() +set(INSTALL_DIR_TESTS ${INSTALL_DIR}/${CATCH_BUILD_DIR}) +set(INSTALL_DIR_SCRIPT ${INSTALL_DIR}/${CATCH_BUILD_DIR}/script) +set(INSTALL_DIR_SRC ${INSTALL_DIR}/${CATCH_BUILD_DIR}/src) +set(INSTALL_DIR_HEADERS ${INSTALL_DIR}/${CATCH_BUILD_DIR}/headers) +# install catch scripts +install(FILES + ${ADD_SCRIPT_PATH} + ${CATCH_INCLUDE_PATH} + DESTINATION ${INSTALL_DIR_SCRIPT}) +# install cmake include files +foreach(CTEST_INCLUDE_FILE ${INSTALL_CTEST_INCLUDE_FILES}) + install(FILES ${CTEST_INCLUDE_FILE} DESTINATION ${INSTALL_DIR_SCRIPT}) +endforeach() +# install source files +foreach(SRC_FILE ${INSTALL_SRC_FILES}) + install(FILES ${SRC_FILE} DESTINATION ${INSTALL_DIR_SRC}) +endforeach() +# install header files +foreach(HEADER_FILES ${INSTALL_HEADER_FILES}) + install(FILES ${HEADER_FILES} DESTINATION ${INSTALL_DIR_HEADERS}) +endforeach() +# install executables +foreach(EXE_TARGET ${INSTALL_EXE_TARGETS}) + install(TARGETS ${EXE_TARGET} + RUNTIME DESTINATION ${INSTALL_DIR_TESTS} OPTIONAL) +endforeach() +# install custom targets +foreach(CUSTOM_TARGET ${INSTALL_CUSTOM_TARGETS}) + install(FILES ${CUSTOM_TARGET} DESTINATION ${INSTALL_DIR_TESTS}) +endforeach() +# install ctest file +install(FILES + ${PROJECT_BINARY_DIR}/${CATCH_BUILD_DIR}/script/CTestTestfile.cmake + DESTINATION ${INSTALL_DIR_TESTS}) +install(FILES + ${PROJECT_BINARY_DIR}/${CATCH_BUILD_DIR}/script/windows/CTestTestfile.cmake + DESTINATION ${INSTALL_DIR}) +# install catchinfo +install(FILES ${PROJECT_BINARY_DIR}/${CATCH_BUILD_DIR}/catchInfo.txt DESTINATION ${INSTALL_DIR}) +# install hip test config +install(DIRECTORY + ${HIP_TEST_CONFIG_BINARY_DIR} + DESTINATION ${INSTALL_DIR_TESTS}) include(CPack) diff --git a/projects/hip-tests/catch/unit/assertion/CMakeLists.txt b/projects/hip-tests/catch/unit/assertion/CMakeLists.txt index 361e6b867e..38cc88ff5d 100644 --- a/projects/hip-tests/catch/unit/assertion/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/assertion/CMakeLists.txt @@ -43,6 +43,7 @@ file(GLOB NEGATIVE_TEST_SRC "static_assert_kernels_negative.cc") file(COPY ${NEGATIVE_TEST_SRC} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_SRC_FILES ${NEGATIVE_TEST_SRC}) #add_test(NAME Unit_StaticAssert_Positive_Basic # COMMAND ${Python3_EXECUTABLE} ../compileAndCaptureOutput.py diff --git a/projects/hip-tests/catch/unit/atomics/CMakeLists.txt b/projects/hip-tests/catch/unit/atomics/CMakeLists.txt index 066b78277e..b19d4d2acc 100644 --- a/projects/hip-tests/catch/unit/atomics/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/atomics/CMakeLists.txt @@ -115,7 +115,7 @@ if(UNIX) "atomicExch_system_negative_kernels.cc") file(COPY ${NEGATIVE_TEST_SRC} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src) - + set_property(GLOBAL APPEND PROPERTY G_INSTALL_SRC_FILES ${NEGATIVE_TEST_SRC}) # add_test(NAME Unit_atomicAnd_Negative_Parameters # COMMAND ${Python3_EXECUTABLE} ../compileAndCaptureOutput.py # ./src ${HIP_PLATFORM} ${HIP_PATH} diff --git a/projects/hip-tests/catch/unit/callback/CMakeLists.txt b/projects/hip-tests/catch/unit/callback/CMakeLists.txt index 204d5bc32c..efb35fc796 100644 --- a/projects/hip-tests/catch/unit/callback/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/callback/CMakeLists.txt @@ -33,6 +33,7 @@ if(UNIX) ${CMAKE_CURRENT_SOURCE_DIR}/SimpleKernel.cc -o ${CMAKE_CURRENT_BINARY_DIR}/../../unit/callback/SimpleKernel.code -I${HIP_PATH}/include -I${CMAKE_CURRENT_SOURCE_DIR}/../../include) + set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/SimpleKernel.code) endif() hip_add_exe_to_target(NAME CallbackTest diff --git a/projects/hip-tests/catch/unit/complex/CMakeLists.txt b/projects/hip-tests/catch/unit/complex/CMakeLists.txt index 57d9e7f2dd..d5ca4629ea 100644 --- a/projects/hip-tests/catch/unit/complex/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/complex/CMakeLists.txt @@ -47,6 +47,7 @@ file(GLOB NEGATIVE_TEST_SRC ) file(COPY ${NEGATIVE_TEST_SRC} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_SRC_FILES ${NEGATIVE_TEST_SRC}) #add_test(NAME Unit_Device_Complex_make_Negative # COMMAND ${Python3_EXECUTABLE} ../compileAndCaptureOutput.py diff --git a/projects/hip-tests/catch/unit/device/CMakeLists.txt b/projects/hip-tests/catch/unit/device/CMakeLists.txt index ed3fc0813e..2e2c09d55f 100644 --- a/projects/hip-tests/catch/unit/device/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/device/CMakeLists.txt @@ -48,6 +48,7 @@ set_source_files_properties(hipGetDeviceCount.cc PROPERTIES COMPILE_FLAGS -std=c set_source_files_properties(hipDeviceGetUuid.cc PROPERTIES COMPILE_FLAGS -std=c++17) add_executable(getDeviceCount EXCLUDE_FROM_ALL getDeviceCount_exe.cc) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_EXE_TARGETS getDeviceCount) hip_add_exe_to_target(NAME DeviceTest TEST_SRC ${TEST_SRC} diff --git a/projects/hip-tests/catch/unit/deviceLib/CMakeLists.txt b/projects/hip-tests/catch/unit/deviceLib/CMakeLists.txt index 16deb9dde4..b43bf7c6d8 100644 --- a/projects/hip-tests/catch/unit/deviceLib/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/deviceLib/CMakeLists.txt @@ -145,6 +145,11 @@ add_custom_target(kerDevAllocSingleKer.code -I${HIP_PATH}/include/ -I${CMAKE_CURRENT_SOURCE_DIR}/../../include --rocm-path=${ROCM_PATH}) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/kerDevAllocSingleKer.code) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/kerDevFreeMultCO.code) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/kerDevWriteMultCO.code) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/kerDevAllocMultCO.code) + # Accepted archs to compile this cmake file set(ACCEPTED_OFFLOAD_ARCHS gfx90a gfx940 gfx941 gfx942) set(ACCEPTED_GFX940_ARCH gfx940 gfx941 gfx942) diff --git a/projects/hip-tests/catch/unit/device_memory/CMakeLists.txt b/projects/hip-tests/catch/unit/device_memory/CMakeLists.txt index e0a6adc27f..526d46376f 100644 --- a/projects/hip-tests/catch/unit/device_memory/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/device_memory/CMakeLists.txt @@ -52,6 +52,7 @@ file(GLOB NEGATIVE_TEST_SRC ) file(COPY ${NEGATIVE_TEST_SRC} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_SRC_FILES ${NEGATIVE_TEST_SRC}) #add_test(NAME Unit_Device_memcpy_Negative # COMMAND ${Python3_EXECUTABLE} ../compileAndCaptureOutput.py diff --git a/projects/hip-tests/catch/unit/dynamicLoading/CMakeLists.txt b/projects/hip-tests/catch/unit/dynamicLoading/CMakeLists.txt index e16da4d177..df12d2e05e 100644 --- a/projects/hip-tests/catch/unit/dynamicLoading/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/dynamicLoading/CMakeLists.txt @@ -40,6 +40,11 @@ endif() add_custom_target(bit_extract_kernel.code COMMAND ${CMAKE_CXX_COMPILER} --genco ${OFFLOAD_ARCH_STR} ${CMAKE_CURRENT_SOURCE_DIR}/bit_extract_kernel.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/../dynamicLoading/bit_extract_kernel.code -I${HIP_PATH}/include/ -I${CMAKE_CURRENT_SOURCE_DIR}/../../include -L${HIP_PATH}/${CMAKE_INSTALL_LIBDIR}) add_custom_target(vecadd.cc COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/vecadd.cc ${CMAKE_CURRENT_BINARY_DIR}/../dynamicLoading/) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS + ${CMAKE_CURRENT_BINARY_DIR}/vecadd.cc + ${CMAKE_CURRENT_BINARY_DIR}/libLazyLoad.so + ${CMAKE_CURRENT_BINARY_DIR}/bit_extract_kernel.code +) if(HIP_PLATFORM MATCHES "amd") hip_add_exe_to_target(NAME Dynamic diff --git a/projects/hip-tests/catch/unit/graph/CMakeLists.txt b/projects/hip-tests/catch/unit/graph/CMakeLists.txt index ab80a93cbf..3258efdd65 100644 --- a/projects/hip-tests/catch/unit/graph/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/graph/CMakeLists.txt @@ -173,6 +173,8 @@ if(HIP_PLATFORM MATCHES "amd") endif() add_custom_target(add_Kernel.code COMMAND ${CMAKE_CXX_COMPILER} --genco ${OFFLOAD_ARCH_STR} ${CMAKE_CURRENT_SOURCE_DIR}/add_Kernel.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/../graph/add_Kernel.code -I${HIP_PATH}/include/ -I${CMAKE_CURRENT_SOURCE_DIR}/../../include --rocm-path=${ROCM_PATH}) +set_property(GLOBAL APPEND PROPERTY + G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/add_Kernel.code) hip_add_exe_to_target(NAME GraphsTest2 TEST_SRC ${TEST_SRC} @@ -181,6 +183,8 @@ hip_add_exe_to_target(NAME GraphsTest2 if(HIP_PLATFORM MATCHES "amd") add_custom_target(hipMatMul COMMAND ${CMAKE_CXX_COMPILER} --genco ${OFFLOAD_ARCH_STR} ${CMAKE_CURRENT_SOURCE_DIR}/hipMatMul.cc -o ${CMAKE_CURRENT_BINARY_DIR}/../../unit/graph/hipMatMul.code -I${CMAKE_CURRENT_SOURCE_DIR}/../../../../include/ -I${CMAKE_CURRENT_SOURCE_DIR}/../../include --rocm-path=${ROCM_PATH}) add_dependencies(build_tests hipMatMul) + set_property(GLOBAL APPEND PROPERTY + G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/hipMatMul.code) endif() add_dependencies(build_tests add_Kernel.code) diff --git a/projects/hip-tests/catch/unit/hip_specific/CMakeLists.txt b/projects/hip-tests/catch/unit/hip_specific/CMakeLists.txt index 28dbf42a97..27de54f205 100644 --- a/projects/hip-tests/catch/unit/hip_specific/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/hip_specific/CMakeLists.txt @@ -33,6 +33,7 @@ file(GLOB NEGATIVE_TEST_SRC "hip_hc_8pk_negative_kernels.cc" ) file(COPY ${NEGATIVE_TEST_SRC} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_SRC_FILES ${NEGATIVE_TEST_SRC}) #add_test(NAME Unit_Device__hip_hc_8pk_Negative # COMMAND ${Python3_EXECUTABLE} ../compileAndCaptureOutput.py diff --git a/projects/hip-tests/catch/unit/launchBounds/CMakeLists.txt b/projects/hip-tests/catch/unit/launchBounds/CMakeLists.txt index e34cfe2e84..eb3d9589d8 100644 --- a/projects/hip-tests/catch/unit/launchBounds/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/launchBounds/CMakeLists.txt @@ -36,10 +36,11 @@ endif() if(UNIX) file(GLOB NEGATIVE_TEST_SRC - "launch_bounds_compiler_error_kernels.cc" - "launch_bounds_parse_error_kernels.cc") + "launch_bounds_compiler_error_kernels.cc" + "launch_bounds_parse_error_kernels.cc") file(COPY ${NEGATIVE_TEST_SRC} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_SRC_FILES ${NEGATIVE_TEST_SRC}) #if(HIP_PLATFORM MATCHES "nvidia") # set(EXPECTED_ERRORS 2) diff --git a/projects/hip-tests/catch/unit/math/CMakeLists.txt b/projects/hip-tests/catch/unit/math/CMakeLists.txt index cb05be3aee..ed0a798224 100644 --- a/projects/hip-tests/catch/unit/math/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/math/CMakeLists.txt @@ -89,6 +89,7 @@ file(GLOB NEGATIVE_TEST_SRC ) file(COPY ${NEGATIVE_TEST_SRC} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_SRC_FILES ${NEGATIVE_TEST_SRC}) #if(HIP_PLATFORM MATCHES "nvidia") # set(ERRORS_1 81) diff --git a/projects/hip-tests/catch/unit/memory/CMakeLists.txt b/projects/hip-tests/catch/unit/memory/CMakeLists.txt index 77347a5f02..c095b7ca98 100644 --- a/projects/hip-tests/catch/unit/memory/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/memory/CMakeLists.txt @@ -124,9 +124,11 @@ if(HIP_PLATFORM MATCHES "amd") set_source_files_properties(hipHostRegister.cc PROPERTIES COMPILE_FLAGS -std=c++17) add_executable(hipHostRegisterPerf EXCLUDE_FROM_ALL hipHostRegister_exe.cc) add_dependencies(build_tests hipHostRegisterPerf) + set_property(GLOBAL APPEND PROPERTY G_INSTALL_EXE_TARGETS hipHostRegisterPerf) if(UNIX) add_executable(hipMemAdviseTstAlignedAllocMem EXCLUDE_FROM_ALL hipMemAdvise_AlignedAllocMem_Exe.cc) add_dependencies(MemoryTest1 hipMemAdviseTstAlignedAllocMem) + set_property(GLOBAL APPEND PROPERTY G_INSTALL_EXE_TARGETS hipMemAdviseTstAlignedAllocMem) endif() endif() diff --git a/projects/hip-tests/catch/unit/module/CMakeLists.txt b/projects/hip-tests/catch/unit/module/CMakeLists.txt index afd4136a5d..89bd3091db 100644 --- a/projects/hip-tests/catch/unit/module/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/module/CMakeLists.txt @@ -63,6 +63,12 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/get_tex_ref_module.code DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/get_tex_ref_module.cc) add_custom_target(get_tex_ref_module ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/get_tex_ref_module.code) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS + ${CMAKE_CURRENT_BINARY_DIR}/get_function_module.code + ${CMAKE_CURRENT_BINARY_DIR}/launch_kernel_module.code + ${CMAKE_CURRENT_BINARY_DIR}/get_global_test_module.code + ${CMAKE_CURRENT_BINARY_DIR}/get_tex_ref_module.code +) # Note to pass arch use format like -DOFFLOAD_ARCH_STR="--offload-arch=gfx900 --offload-arch=gfx906" # having space at the start/end of OFFLOAD_ARCH_STR can cause build failures @@ -100,6 +106,12 @@ add_custom_target(addKernel.code -I${HIP_PATH}/include/ --rocm-path=${ROCM_PATH} -I${CMAKE_CURRENT_SOURCE_DIR}/../../include --rocm-path=${ROCM_PATH}) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS + ${CMAKE_CURRENT_BINARY_DIR}/empty_module.code + ${CMAKE_CURRENT_BINARY_DIR}/copyKernel.code + ${CMAKE_CURRENT_BINARY_DIR}/copyKernel.s + ${CMAKE_CURRENT_BINARY_DIR}/addKernel.code +) if(UNIX) set(TEST_SRC ${TEST_SRC} @@ -159,6 +171,15 @@ add_custom_target(copiousArgKernel17.code -o ${CMAKE_CURRENT_BINARY_DIR}/../../unit/module/copiousArgKernel17.code -I${HIP_PATH}/include/ --rocm-path=${ROCM_PATH} -I${CMAKE_CURRENT_SOURCE_DIR}/../../include --rocm-path=${ROCM_PATH}) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS + ${CMAKE_CURRENT_BINARY_DIR}/copiousArgKernel.code + ${CMAKE_CURRENT_BINARY_DIR}/copiousArgKernel0.code + ${CMAKE_CURRENT_BINARY_DIR}/copiousArgKernel1.code + ${CMAKE_CURRENT_BINARY_DIR}/copiousArgKernel2.code + ${CMAKE_CURRENT_BINARY_DIR}/copiousArgKernel3.code + ${CMAKE_CURRENT_BINARY_DIR}/copiousArgKernel16.code + ${CMAKE_CURRENT_BINARY_DIR}/copiousArgKernel17.code +) endif() endif() @@ -191,6 +212,8 @@ endif() add_executable(hipGetFuncBySymbol_exe EXCLUDE_FROM_ALL hipGetFuncBySymbol_exe.cc) add_dependencies(build_tests hipGetFuncBySymbol_exe) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_EXE_TARGETS hipGetFuncBySymbol_exe) + # Common Tests - Test independent of all platforms set(TEST_SRC hipFuncSetAttribute.cc @@ -235,8 +258,14 @@ hip_add_exe_to_target(NAME matmul LINKER_LIBS ${CMAKE_DL_LIBS}) add_custom_target(kernel_composite_test.code COMMAND ${CMAKE_CXX_COMPILER} --genco ${OFFLOAD_ARCH_STR} ${CMAKE_CURRENT_SOURCE_DIR}/kernel_composite_test.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/../module/kernel_composite_test.code -I${HIP_PATH}/include -I${CMAKE_CURRENT_SOURCE_DIR}/../../include --rocm-path=${ROCM_PATH}) - +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS + ${CMAKE_CURRENT_BINARY_DIR}/kernel_composite_test.code + ${CMAKE_CURRENT_BINARY_DIR}/matmul.code + ${CMAKE_CURRENT_BINARY_DIR}/vcpy_kernel.code + ${CMAKE_CURRENT_BINARY_DIR}/managed_kernel.code +) add_executable(testhipModuleLoadUnloadFunc_exe EXCLUDE_FROM_ALL testhipModuleLoadUnloadFunc_exe.cc) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_EXE_TARGETS testhipModuleLoadUnloadFunc_exe) hip_add_exe_to_target(NAME compositeKernel TEST_SRC ${LINUX_TEST_SRC} diff --git a/projects/hip-tests/catch/unit/occupancy/CMakeLists.txt b/projects/hip-tests/catch/unit/occupancy/CMakeLists.txt index 4484139d1d..28c3862855 100644 --- a/projects/hip-tests/catch/unit/occupancy/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/occupancy/CMakeLists.txt @@ -20,7 +20,7 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/simple_kernel.code DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/simple_kernel.cc) add_custom_target(simple_kernel ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/simple_kernel.code) - +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/simple_kernel.code) hip_add_exe_to_target(NAME OccupancyTest TEST_SRC ${TEST_SRC} TEST_TARGET_NAME build_tests) diff --git a/projects/hip-tests/catch/unit/p2p/CMakeLists.txt b/projects/hip-tests/catch/unit/p2p/CMakeLists.txt index 7170294cb8..e9cc0b716b 100644 --- a/projects/hip-tests/catch/unit/p2p/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/p2p/CMakeLists.txt @@ -16,6 +16,7 @@ endif() set_source_files_properties(hipDeviceGetP2PAttribute.cc PROPERTIES COMPILE_FLAGS -std=c++17) add_executable(hipDeviceGetP2PAttribute_exe EXCLUDE_FROM_ALL hipDeviceGetP2PAttribute_exe.cc) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_EXE_TARGETS hipDeviceGetP2PAttribute_exe) hip_add_exe_to_target(NAME p2pTests TEST_SRC ${TEST_SRC} diff --git a/projects/hip-tests/catch/unit/printf/CMakeLists.txt b/projects/hip-tests/catch/unit/printf/CMakeLists.txt index a1466664f0..c3b501caf3 100644 --- a/projects/hip-tests/catch/unit/printf/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/printf/CMakeLists.txt @@ -53,6 +53,7 @@ file(GLOB NEGATIVE_TEST_SRC printf_negative_kernels.cc) file(COPY ${NEGATIVE_TEST_SRC} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_SRC_FILES ${NEGATIVE_TEST_SRC}) #add_test(NAME Unit_Printf_Negative # COMMAND ${Python3_EXECUTABLE} ../compileAndCaptureOutput.py @@ -66,6 +67,12 @@ add_executable(printfLength_exe EXCLUDE_FROM_ALL printfLength_exe.cc) add_executable(printfSpecifiers_exe EXCLUDE_FROM_ALL printfSpecifiers_exe.cc) add_executable(printfFlagsNonHost_exe EXCLUDE_FROM_ALL printfFlagsNonHost_exe.cc) add_executable(printfSpecifiersNonHost_exe EXCLUDE_FROM_ALL printfSpecifiersNonHost_exe.cc) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_EXE_TARGETS + printfFlags_exe + printfLength_exe + printfSpecifiers_exe + printfFlagsNonHost_exe + printfSpecifiersNonHost_exe) add_dependencies(build_tests printfFlags_exe) add_dependencies(build_tests printfLength_exe) diff --git a/projects/hip-tests/catch/unit/rtc/CMakeLists.txt b/projects/hip-tests/catch/unit/rtc/CMakeLists.txt index c68652ba39..c7d6cd022e 100644 --- a/projects/hip-tests/catch/unit/rtc/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/rtc/CMakeLists.txt @@ -36,6 +36,10 @@ add_custom_target(copyRtcHeaders ALL ${CMAKE_CURRENT_SOURCE_DIR}/headers ${CMAKE_CURRENT_BINARY_DIR}/headers) +file(GLOB INSTALL_HEADER_FILES "./headers/*") +set_property(GLOBAL APPEND PROPERTY G_INSTALL_HEADER_FILES ${INSTALL_HEADER_FILES}) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/saxpy.h) + if(UNIX) set(AMD_TEST_SRC ${AMD_TEST_SRC} RtcFunctions.cpp @@ -57,6 +61,8 @@ elseif(HIP_PLATFORM MATCHES "amd") endif() add_executable(ChkPtrdiff_t_Exe EXCLUDE_FROM_ALL ChkPtrdiff_t_Exe.cc) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_EXE_TARGETS ChkPtrdiff_t_Exe) + if(HIP_PLATFORM MATCHES "nvidia") target_link_libraries(ChkPtrdiff_t_Exe nvrtc) elseif(HIP_PLATFORM MATCHES "amd") diff --git a/projects/hip-tests/catch/unit/synchronization/CMakeLists.txt b/projects/hip-tests/catch/unit/synchronization/CMakeLists.txt index 6d6b55e0ef..61d2dcd22f 100644 --- a/projects/hip-tests/catch/unit/synchronization/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/synchronization/CMakeLists.txt @@ -8,6 +8,7 @@ add_custom_target(memcpyInt.hsaco COMMAND ${CMAKE_CXX_COMPILER} --genco ${OFFLOA ${HIP_PATH}/include -I ${CMAKE_CURRENT_SOURCE_DIR}/../../include -L ${HIP_PATH}/${CMAKE_INSTALL_LIBDIR}/../../include --rocm-path=${ROCM_PATH}) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/memcpyInt.hsaco) # only for AMD if(HIP_PLATFORM MATCHES "amd") # There are problems in Windows: __hip_atomicsXXX() won't work as expected diff --git a/projects/hip-tests/catch/unit/syncthreads/CMakeLists.txt b/projects/hip-tests/catch/unit/syncthreads/CMakeLists.txt index 778dc11095..8a2a8531b0 100644 --- a/projects/hip-tests/catch/unit/syncthreads/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/syncthreads/CMakeLists.txt @@ -46,6 +46,7 @@ file(GLOB NEGATIVE_TEST_SRC ) file(COPY ${NEGATIVE_TEST_SRC} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_SRC_FILES ${NEGATIVE_TEST_SRC}) #add_test(NAME Unit___syncthreads_count_Negative_Parameters # COMMAND ${Python3_EXECUTABLE} ../compileAndCaptureOutput.py diff --git a/projects/hip-tests/catch/unit/texture/CMakeLists.txt b/projects/hip-tests/catch/unit/texture/CMakeLists.txt index 7671fed636..c05a3001a7 100644 --- a/projects/hip-tests/catch/unit/texture/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/texture/CMakeLists.txt @@ -97,6 +97,7 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tex_ref_get_module.code -I${HIP_PATH}/include/ --rocm-path=${ROCM_PATH} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tex_ref_get_module.cc) add_custom_target(tex_ref_get_module ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tex_ref_get_module.code) +set_property(GLOBAL APPEND PROPERTY G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/tex_ref_get_module.code) if(HIP_PLATFORM MATCHES "amd") if (DEFINED OFFLOAD_ARCH_STR) diff --git a/projects/hip-tests/catch/unit/vector_types/CMakeLists.txt b/projects/hip-tests/catch/unit/vector_types/CMakeLists.txt index 72a9d9505a..ba325f0c46 100644 --- a/projects/hip-tests/catch/unit/vector_types/CMakeLists.txt +++ b/projects/hip-tests/catch/unit/vector_types/CMakeLists.txt @@ -55,6 +55,7 @@ if(HIP_PLATFORM MATCHES "amd") "negative_macros_common.hh" ) file(COPY ${NEGATIVE_TEST_SRC} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src) + set_property(GLOBAL APPEND PROPERTY G_INSTALL_SRC_FILES ${NEGATIVE_TEST_SRC}) #add_test(NAME Unit_NegateUnsigned_Negative_Parameters # COMMAND ${Python3_EXECUTABLE} ../compileAndCaptureOutput.py