directed tests no longer run in an subdirectory
- target "make test" will no longer build and run tests. It will only run the tests.
- added new target "make check" which will build and run the tests.
- target "make check" will build tests serially. Use -j<N> to build tests in parallel.
Change-Id: I24c7932bf9798364a59f44631fbabcf9a5da5e17
[ROCm/clr commit: fe01dd74a2]
This commit is contained in:
@@ -367,22 +367,21 @@ endif()
|
|||||||
# Testing steps
|
# Testing steps
|
||||||
#############################
|
#############################
|
||||||
# Target: test
|
# Target: test
|
||||||
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/hip_tests)
|
set(HIP_PATH ${CMAKE_INSTALL_PREFIX})
|
||||||
configure_file(tests/hip_tests.txt ${BUILD_DIR}/CMakeLists.txt @ONLY)
|
set(HIP_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
if(POLICY CMP0037)
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/cmake" "${HIP_PATH}/cmake")
|
||||||
cmake_policy(PUSH)
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/bin" "${HIP_PATH}/bin")
|
||||||
cmake_policy(SET CMP0037 OLD)
|
set(CMAKE_MODULE_PATH "${HIP_PATH}/cmake" ${CMAKE_MODULE_PATH})
|
||||||
endif()
|
include(${HIP_SRC_PATH}/tests/hit/HIT.cmake)
|
||||||
add_custom_target(install_for_test COMMAND "${CMAKE_COMMAND}" --build . --target install
|
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
# Add tests
|
||||||
execute_process(COMMAND getconf _NPROCESSORS_ONLN OUTPUT_VARIABLE DASH_JAY OUTPUT_STRIP_TRAILING_WHITESPACE)
|
include_directories(${HIP_SRC_PATH}/tests/src)
|
||||||
add_custom_target(test COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} .
|
hit_add_directory_recursive(${HIP_SRC_PATH}/tests/src "directed_tests")
|
||||||
COMMAND make -j ${DASH_JAY}
|
|
||||||
COMMAND make test
|
# Add top-level tests to build_tests
|
||||||
WORKING_DIRECTORY ${BUILD_DIR}
|
add_custom_target(build_tests DEPENDS directed_tests)
|
||||||
DEPENDS install_for_test)
|
|
||||||
if(POLICY CMP0037)
|
# Add custom target: check
|
||||||
cmake_policy(POP)
|
add_custom_target(check COMMAND "${CMAKE_COMMAND}" --build . --target test DEPENDS build_tests)
|
||||||
endif()
|
|
||||||
|
|
||||||
# vim: ts=4:sw=4:expandtab:smartindent
|
# vim: ts=4:sw=4:expandtab:smartindent
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ endmacro()
|
|||||||
|
|
||||||
# Macro: HIT_ADD_FILES used to scan+add multiple files for testing.
|
# Macro: HIT_ADD_FILES used to scan+add multiple files for testing.
|
||||||
file(GLOB HIP_LIB_FILES ${HIP_PATH}/lib/*)
|
file(GLOB HIP_LIB_FILES ${HIP_PATH}/lib/*)
|
||||||
macro(HIT_ADD_FILES _dir _label)
|
macro(HIT_ADD_FILES _dir _label _parent)
|
||||||
foreach (file ${ARGN})
|
foreach (file ${ARGN})
|
||||||
# Build tests
|
# Build tests
|
||||||
execute_process(COMMAND ${HIP_SRC_PATH}/tests/hit/parser --buildCMDs ${file}
|
execute_process(COMMAND ${HIP_SRC_PATH}/tests/hit/parser --buildCMDs ${file}
|
||||||
@@ -148,8 +148,10 @@ macro(HIT_ADD_FILES _dir _label)
|
|||||||
if(_exclude_platforms STREQUAL "all" OR _exclude_platforms STREQUAL ${HIP_PLATFORM})
|
if(_exclude_platforms STREQUAL "all" OR _exclude_platforms STREQUAL ${HIP_PLATFORM})
|
||||||
else()
|
else()
|
||||||
set_source_files_properties(${_sources} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
|
set_source_files_properties(${_sources} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
|
||||||
hip_add_executable(${target} ${_sources} HIPCC_OPTIONS ${_hipcc_options} HCC_OPTIONS ${_hcc_options} NVCC_OPTIONS ${_nvcc_options})
|
hip_reset_flags()
|
||||||
|
hip_add_executable(${target} ${_sources} HIPCC_OPTIONS ${_hipcc_options} HCC_OPTIONS ${_hcc_options} NVCC_OPTIONS ${_nvcc_options} EXCLUDE_FROM_ALL)
|
||||||
set_target_properties(${target} PROPERTIES OUTPUT_NAME ${_target} RUNTIME_OUTPUT_DIRECTORY ${_label} LINK_DEPENDS "${HIP_LIB_FILES}")
|
set_target_properties(${target} PROPERTIES OUTPUT_NAME ${_target} RUNTIME_OUTPUT_DIRECTORY ${_label} LINK_DEPENDS "${HIP_LIB_FILES}")
|
||||||
|
add_dependencies(${_parent} ${target})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
@@ -196,24 +198,32 @@ endmacro()
|
|||||||
# Macro: HIT_ADD_DIRECTORY to scan+add all files in a directory for testing
|
# Macro: HIT_ADD_DIRECTORY to scan+add all files in a directory for testing
|
||||||
macro(HIT_ADD_DIRECTORY _dir _label)
|
macro(HIT_ADD_DIRECTORY _dir _label)
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_label} WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_label} WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||||
|
string(REGEX REPLACE "/" "." _parent ${_label})
|
||||||
|
add_custom_target(${_parent})
|
||||||
file(GLOB files "${_dir}/*.c*")
|
file(GLOB files "${_dir}/*.c*")
|
||||||
hit_add_files(${_dir} ${_label} ${files})
|
hit_add_files(${_dir} ${_label} ${parent} ${files})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Macro: HIT_ADD_DIRECTORY_RECURSIVE to scan+add all files in a directory+subdirectories for testing
|
# Macro: HIT_ADD_DIRECTORY_RECURSIVE to scan+add all files in a directory+subdirectories for testing
|
||||||
macro(HIT_ADD_DIRECTORY_RECURSIVE _dir _label)
|
macro(HIT_ADD_DIRECTORY_RECURSIVE _dir _label)
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_label} WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_label} WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||||
|
string(REGEX REPLACE "/" "." _parent ${_label})
|
||||||
|
add_custom_target(${_parent})
|
||||||
|
if(${ARGC} EQUAL 3)
|
||||||
|
add_dependencies(${ARGV2} ${_parent})
|
||||||
|
endif()
|
||||||
file(GLOB children RELATIVE ${_dir} ${_dir}/*)
|
file(GLOB children RELATIVE ${_dir} ${_dir}/*)
|
||||||
set(dirlist "")
|
set(dirlist "")
|
||||||
foreach(child ${children})
|
foreach(child ${children})
|
||||||
if(IS_DIRECTORY ${_dir}/${child})
|
if(IS_DIRECTORY ${_dir}/${child})
|
||||||
list(APPEND dirlist ${child})
|
list(APPEND dirlist ${child})
|
||||||
else()
|
else()
|
||||||
hit_add_files(${_dir} ${_label} ${child})
|
hit_add_files(${_dir} ${_label} ${_parent} ${child})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
foreach(child ${dirlist})
|
foreach(child ${dirlist})
|
||||||
hit_add_directory_recursive(${_dir}/${child} ${_label}/${child})
|
string(REGEX REPLACE "/" "." _parent ${_label})
|
||||||
|
hit_add_directory_recursive(${_dir}/${child} ${_label}/${child} ${_parent})
|
||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user