HIT: maintain source hierarchy for generated test executables
Change-Id: I997650d10cf38f35edb6b88b130a62c3541a850c
Bu işleme şunda yer alıyor:
@@ -10,4 +10,4 @@ include(${HIP_SRC_PATH}/tests/hit/HIT.cmake)
|
||||
|
||||
# Add tests
|
||||
include_directories(${HIP_SRC_PATH}/tests/src)
|
||||
hit_add_directory_recursive(${HIP_SRC_PATH}/tests/src)
|
||||
hit_add_directory_recursive(${HIP_SRC_PATH}/tests/src "directed_tests")
|
||||
|
||||
+23
-15
@@ -118,20 +118,19 @@ endmacro()
|
||||
# Helper macro to create a test
|
||||
macro(MAKE_TEST exe)
|
||||
string(REPLACE " " "" smush_args ${ARGN})
|
||||
set(testname ${PROJECT_NAME}/${exe}${smush_args}.tst)
|
||||
set(testname ${exe}${smush_args}.tst)
|
||||
add_test(NAME ${testname} COMMAND ${PROJECT_BINARY_DIR}/${exe} ${ARGN})
|
||||
set_tests_properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "PASSED")
|
||||
endmacro()
|
||||
|
||||
macro(MAKE_NAMED_TEST exe _testname)
|
||||
set(testname ${PROJECT_NAME}/${_testname}.tst)
|
||||
macro(MAKE_NAMED_TEST exe testname)
|
||||
add_test(NAME ${testname} COMMAND ${PROJECT_BINARY_DIR}/${exe} ${ARGN})
|
||||
set_tests_properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "PASSED")
|
||||
endmacro()
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Macro: HIT_ADD_FILES used to scan+add multiple files for testing.
|
||||
macro(HIT_ADD_FILES _dir)
|
||||
macro(HIT_ADD_FILES _dir _label)
|
||||
foreach (file ${ARGN})
|
||||
# Build tests
|
||||
execute_process(COMMAND ${HIP_SRC_PATH}/tests/hit/parser --buildCMDs ${file}
|
||||
@@ -143,11 +142,13 @@ macro(HIT_ADD_FILES _dir)
|
||||
foreach(_cmd ${_contents})
|
||||
string(REGEX REPLACE " " ";" _cmd "${_cmd}")
|
||||
parse_build_command(_target _sources _hipcc_options _hcc_options _nvcc_options _exclude_platforms ${_dir} ${_cmd})
|
||||
insert_into_map("_exclude" "${_target}" "${_exclude_platforms}")
|
||||
string(REGEX REPLACE "/" "." target ${_label}/${_target})
|
||||
insert_into_map("_exclude" "${target}" "${_exclude_platforms}")
|
||||
if(_exclude_platforms STREQUAL "all" OR _exclude_platforms STREQUAL ${HIP_PLATFORM})
|
||||
else()
|
||||
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_add_executable(${target} ${_sources} HIPCC_OPTIONS ${_hipcc_options} HCC_OPTIONS ${_hcc_options} NVCC_OPTIONS ${_nvcc_options})
|
||||
set_target_properties(${target} PROPERTIES OUTPUT_NAME ${_target} RUNTIME_OUTPUT_DIRECTORY ${_label})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -161,11 +162,12 @@ macro(HIT_ADD_FILES _dir)
|
||||
foreach(_cmd ${_contents})
|
||||
string(REGEX REPLACE " " ";" _cmd "${_cmd}")
|
||||
parse_run_command(_target _arguments _exclude_platforms ${_cmd})
|
||||
read_from_map("_exclude" "${_target}" _exclude_platforms_from_build)
|
||||
string(REGEX REPLACE "/" "." target ${_label}/${_target})
|
||||
read_from_map("_exclude" "${target}" _exclude_platforms_from_build)
|
||||
if(_exclude_platforms STREQUAL "all" OR _exclude_platforms STREQUAL ${HIP_PLATFORM} OR
|
||||
_exclude_platforms_from_build STREQUAL "all" OR _exclude_platforms_from_build STREQUAL ${HIP_PLATFORM})
|
||||
else()
|
||||
make_test(${_target} ${_arguments})
|
||||
make_test(${_label}/${_target} ${_arguments})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -179,33 +181,39 @@ macro(HIT_ADD_FILES _dir)
|
||||
foreach(_cmd ${_contents})
|
||||
string(REGEX REPLACE " " ";" _cmd "${_cmd}")
|
||||
parse_run_named_command(_target _testname _arguments _exclude_platforms ${_cmd})
|
||||
read_from_map("_exclude" "${_target}" _exclude_platforms_from_build)
|
||||
string(REGEX REPLACE "/" "." target ${_label}/${_target})
|
||||
read_from_map("_exclude" "${target}" _exclude_platforms_from_build)
|
||||
if(_exclude_platforms STREQUAL "all" OR _exclude_platforms STREQUAL ${HIP_PLATFORM} OR
|
||||
_exclude_platforms_from_build STREQUAL "all" OR _exclude_platforms_from_build STREQUAL ${HIP_PLATFORM})
|
||||
else()
|
||||
make_named_test(${_target} ${_testname} ${_arguments})
|
||||
make_named_test(${_label}/${_target} ${_label}/${_testname}.tst ${_arguments})
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Macro: HIT_ADD_DIRECTORY to scan+add all files in a directory for testing
|
||||
macro(HIT_ADD_DIRECTORY _dir)
|
||||
macro(HIT_ADD_DIRECTORY _dir _label)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_label} WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
file(GLOB files "${_dir}/*.c*")
|
||||
hit_add_files(${_dir} ${files})
|
||||
hit_add_files(${_dir} ${_label} ${files})
|
||||
endmacro()
|
||||
|
||||
# Macro: HIT_ADD_DIRECTORY_RECURSIVE to scan+add all files in a directory+subdirectories for testing
|
||||
macro(HIT_ADD_DIRECTORY_RECURSIVE _dir)
|
||||
macro(HIT_ADD_DIRECTORY_RECURSIVE _dir _label)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_label} WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
file(GLOB children RELATIVE ${_dir} ${_dir}/*)
|
||||
set(dirlist "")
|
||||
foreach(child ${children})
|
||||
if(IS_DIRECTORY ${_dir}/${child})
|
||||
hit_add_directory_recursive(${_dir}/${child})
|
||||
list(APPEND dirlist ${child})
|
||||
else()
|
||||
hit_add_files(${_dir} ${child})
|
||||
hit_add_files(${_dir} ${_label} ${child})
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(child ${dirlist})
|
||||
hit_add_directory_recursive(${_dir}/${child} ${_label}/${child})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# vim: ts=4:sw=4:expandtab:smartindent
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle