diff --git a/rapids-cmake/test/detail/generate_installed_CTestTestfile.cmake b/rapids-cmake/test/detail/generate_installed_CTestTestfile.cmake index 54a9a522..e3a2b39a 100644 --- a/rapids-cmake/test/detail/generate_installed_CTestTestfile.cmake +++ b/rapids-cmake/test/detail/generate_installed_CTestTestfile.cmake @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2023, NVIDIA CORPORATION. +# Copyright (c) 2023-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -234,7 +234,7 @@ set(test_file_content set(CTEST_SCRIPT_DIRECTORY \".\") set(CMAKE_INSTALL_PREFIX \"./${_RAPIDS_INSTALL_PREFIX}\") set(CTEST_RESOURCE_SPEC_FILE \"./${rapids_test_json_file_name}\") -execute_process(COMMAND ./${rapids_test_generate_exe_name} OUTPUT_FILE \"\${CTEST_RESOURCE_SPEC_FILE}\") +execute_process(COMMAND ./${rapids_test_generate_exe_name} OUTPUT_FILE \"\${CTEST_RESOURCE_SPEC_FILE}\" COMMAND_ERROR_IS_FATAL ANY) \n\n ") diff --git a/rapids-cmake/test/generate_resource_spec.cmake b/rapids-cmake/test/generate_resource_spec.cmake index e610fd4b..02609412 100644 --- a/rapids-cmake/test/generate_resource_spec.cmake +++ b/rapids-cmake/test/generate_resource_spec.cmake @@ -71,7 +71,9 @@ function(rapids_test_generate_resource_spec DESTINATION filepath) file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/rapids-cmake/") if(CUDAToolkit_FOUND) - set(compile_options "-I${CUDAToolkit_INCLUDE_DIRS}" "-DHAVE_CUDA") + set(cuda_include_options ${CUDAToolkit_INCLUDE_DIRS}) + list(TRANSFORM cuda_include_options PREPEND "-I") + set(compile_options ${cuda_include_options} "-DHAVE_CUDA") endif() set(link_options ${CUDA_cudart_LIBRARY} -lpthread -lrt -ldl) set(compiler "${CMAKE_CXX_COMPILER}") @@ -81,17 +83,14 @@ function(rapids_test_generate_resource_spec DESTINATION filepath) execute_process(COMMAND "${compiler}" "${eval_file}" ${compile_options} ${link_options} -o "${eval_exe}" OUTPUT_VARIABLE compile_output - ERROR_VARIABLE compile_output) - endif() + ERROR_VARIABLE compile_output RESULT_VARIABLE result) - if(NOT EXISTS "${eval_exe}") - message(STATUS "rapids_test_generate_resource_spec failed to build detection executable, presuming no GPUs." - ) - message(STATUS "rapids_test_generate_resource_spec compile[${compiler} ${compile_options} ${link_options}] failure details are ${compile_output}" - ) - file(WRITE "${filepath}" "${gpu_json_contents}") - else() - execute_process(COMMAND ${eval_exe} OUTPUT_FILE "${filepath}") + if(NOT result EQUAL 0) + string(REPLACE "\n" "\n " compile_output "${compile_output}") + message(FATAL_ERROR "rapids_test_generate_resource_spec failed to build detection executable.\nrapids_test_generate_resource_spec compile[${compiler} ${compile_options} ${link_options}] failure details are:\n ${compile_output}" + ) + endif() endif() + execute_process(COMMAND ${eval_exe} OUTPUT_FILE "${filepath}" COMMAND_ERROR_IS_FATAL ANY) endfunction() diff --git a/testing/test/install_relocatable-complex/tests/CMakeLists.txt b/testing/test/install_relocatable-complex/tests/CMakeLists.txt index 8ed76f13..8611d559 100644 --- a/testing/test/install_relocatable-complex/tests/CMakeLists.txt +++ b/testing/test/install_relocatable-complex/tests/CMakeLists.txt @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2023, NVIDIA CORPORATION. +# Copyright (c) 2023-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/verify_installed_CTestTestfile.cmake" [==[ file(READ "${installed_test_file}" contents) -set(execute_process_match_string [===[execute_process(COMMAND ./generate_ctest_json OUTPUT_FILE "${CTEST_RESOURCE_SPEC_FILE}")]===]) +set(execute_process_match_string [===[execute_process(COMMAND ./generate_ctest_json OUTPUT_FILE "${CTEST_RESOURCE_SPEC_FILE}" COMMAND_ERROR_IS_FATAL ANY)]===]) string(FIND "${contents}" ${execute_process_match_string} is_found) if(is_found EQUAL -1) message(FATAL_ERROR "Failed to generate a `execute_process` with escaped CTEST_RESOURCE_SPEC_FILE") diff --git a/testing/test/install_relocatable-include-in-all.cmake b/testing/test/install_relocatable-include-in-all.cmake index 06227a5e..7a696a66 100644 --- a/testing/test/install_relocatable-include-in-all.cmake +++ b/testing/test/install_relocatable-include-in-all.cmake @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/verify_installed_CTestTestfile.cmake" [=[ file(READ "${installed_test_file}" contents) -set(execute_process_match_string [===[execute_process(COMMAND ./generate_ctest_json OUTPUT_FILE "${CTEST_RESOURCE_SPEC_FILE}")]===]) +set(execute_process_match_string [===[execute_process(COMMAND ./generate_ctest_json OUTPUT_FILE "${CTEST_RESOURCE_SPEC_FILE}" COMMAND_ERROR_IS_FATAL ANY)]===]) string(FIND "${contents}" ${execute_process_match_string} is_found) if(is_found EQUAL -1) message(FATAL_ERROR "Failed to generate a `execute_process` with escaped CTEST_RESOURCE_SPEC_FILE") diff --git a/testing/test/install_relocatable-simple.cmake b/testing/test/install_relocatable-simple.cmake index 387ee13d..9330eadc 100644 --- a/testing/test/install_relocatable-simple.cmake +++ b/testing/test/install_relocatable-simple.cmake @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/verify_installed_CTestTestfile.cmake" [==[ file(READ "${installed_test_file}" contents) -set(execute_process_match_string [===[execute_process(COMMAND ./generate_ctest_json OUTPUT_FILE "${CTEST_RESOURCE_SPEC_FILE}")]===]) +set(execute_process_match_string [===[execute_process(COMMAND ./generate_ctest_json OUTPUT_FILE "${CTEST_RESOURCE_SPEC_FILE}" COMMAND_ERROR_IS_FATAL ANY)]===]) string(FIND "${contents}" ${execute_process_match_string} is_found) if(is_found EQUAL -1) message(FATAL_ERROR "Failed to generate a `execute_process` with escaped CTEST_RESOURCE_SPEC_FILE")