cmake: L0 black_box_tests refactor

Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:
Artur Harasimiuk
2021-11-03 17:21:13 +00:00
committed by Compute-Runtime-Automation
parent 5f798441ef
commit 3b47a9766a
3 changed files with 82 additions and 85 deletions

View File

@@ -4,67 +4,65 @@
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# #
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set(L0_BLACK_BOX_TEST_PROJECT_FOLDER "ze_intel_gpu/black_box_tests")
set(L0_BLACK_BOX_TEST_PROJECT_FOLDER "ze_intel_gpu/black_box_tests") set(TEST_TARGETS
set(TEST_TARGETS zello_timestamp
zello_timestamp zello_world_gpu
zello_world_gpu zello_world_jitc_ocloc
zello_world_jitc_ocloc zello_ipc_copy_dma_buf
zello_ipc_copy_dma_buf zello_ipc_copy_dma_buf_p2p
zello_ipc_copy_dma_buf_p2p zello_copy
zello_copy zello_copy_only
zello_copy_only zello_copy_fence
zello_copy_fence zello_copy_image
zello_copy_image zello_world_usm
zello_world_usm zello_world_global_work_offset
zello_world_global_work_offset zello_scratch
zello_scratch zello_fence
zello_fence zello_printf
zello_printf zello_image
zello_image zello_image_view
zello_image_view zello_dynamic_link
zello_dynamic_link )
include_directories(common)
foreach(TEST_NAME ${TEST_TARGETS})
if(MSVC)
if(${TEST_NAME} STREQUAL "zello_ipc_copy_dma_buf")
continue()
endif()
if(${TEST_NAME} STREQUAL "zello_ipc_copy_dma_buf_p2p")
continue()
endif()
if(${TEST_NAME} STREQUAL "zello_world_global_work_offset")
continue()
endif()
endif()
add_executable(${TEST_NAME} ${TEST_NAME}.cpp)
set_target_properties(${TEST_NAME}
PROPERTIES
VS_DEBUGGER_COMMAND "$(TargetPath)"
VS_DEBUGGER_COMMAND_ARGUMENTS ""
VS_DEBUGGER_WORKING_DIRECTORY "${TargetDir}"
) )
include_directories(common) add_dependencies(${TEST_NAME} ${TARGET_NAME_L0})
target_link_libraries(${TEST_NAME} PUBLIC ${TARGET_NAME_L0})
foreach(TEST_NAME ${TEST_TARGETS}) set_target_properties(${TEST_NAME} PROPERTIES FOLDER ${L0_BLACK_BOX_TEST_PROJECT_FOLDER})
if(MSVC) endforeach()
if(${TEST_NAME} STREQUAL "zello_ipc_copy_dma_buf")
continue()
endif()
if(${TEST_NAME} STREQUAL "zello_ipc_copy_dma_buf_p2p")
continue()
endif()
if(${TEST_NAME} STREQUAL "zello_world_global_work_offset")
continue()
endif()
endif()
add_executable(${TEST_NAME} ${TEST_NAME}.cpp) target_link_libraries(zello_world_jitc_ocloc PUBLIC ocloc_lib)
target_link_libraries(zello_scratch PUBLIC ocloc_lib)
set_target_properties(${TEST_NAME} target_link_libraries(zello_fence PUBLIC ocloc_lib)
PROPERTIES target_link_libraries(zello_printf PUBLIC ocloc_lib)
VS_DEBUGGER_COMMAND "$(TargetPath)" target_link_libraries(zello_image_view PUBLIC ocloc_lib)
VS_DEBUGGER_COMMAND_ARGUMENTS "" target_link_libraries(zello_dynamic_link PUBLIC ocloc_lib)
VS_DEBUGGER_WORKING_DIRECTORY "${TargetDir}" if(UNIX)
) target_link_libraries(zello_world_global_work_offset PUBLIC ocloc_lib)
add_dependencies(${TEST_NAME} ${TARGET_NAME_L0})
target_link_libraries(${TEST_NAME} PUBLIC ${TARGET_NAME_L0})
set_target_properties(${TEST_NAME} PROPERTIES FOLDER ${L0_BLACK_BOX_TEST_PROJECT_FOLDER})
endforeach()
target_link_libraries(zello_world_jitc_ocloc PUBLIC ocloc_lib)
target_link_libraries(zello_scratch PUBLIC ocloc_lib)
target_link_libraries(zello_fence PUBLIC ocloc_lib)
target_link_libraries(zello_printf PUBLIC ocloc_lib)
target_link_libraries(zello_image_view PUBLIC ocloc_lib)
target_link_libraries(zello_dynamic_link PUBLIC ocloc_lib)
if(UNIX)
target_link_libraries(zello_world_global_work_offset PUBLIC ocloc_lib)
endif()
endif() endif()
add_subdirectories() add_subdirectories()

View File

@@ -6,6 +6,7 @@
*/ */
#include "shared/offline_compiler/source/ocloc_api.h" #include "shared/offline_compiler/source/ocloc_api.h"
#include "shared/source/helpers/string.h"
#include "level_zero/api/extensions/public/ze_exp_ext.h" #include "level_zero/api/extensions/public/ze_exp_ext.h"
@@ -258,11 +259,11 @@ int main(int argc, char *argv[]) {
bool outputValidationSuccessful; bool outputValidationSuccessful;
const char *defaultPath = "/usr/local/lib/"; const char *defaultPath = "/usr/local/lib/";
char userPath[256]; char userPath[256]{};
if (argc == 2) { if (argc == 2) {
strncpy(userPath, argv[1], 256); strncpy_s(userPath, sizeof(userPath), argv[1], 256);
} else { } else {
strncpy(userPath, defaultPath, 256); strncpy_s(userPath, sizeof(userPath), defaultPath, strlen(defaultPath));
} }
uint32_t extensionsCount = 0; uint32_t extensionsCount = 0;

View File

@@ -4,33 +4,31 @@
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# #
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") if(UNIX)
if(UNIX) set(L0_BLACK_BOX_TEST_PROJECT_FOLDER "ze_intel_gpu/black_box_tests")
set(L0_BLACK_BOX_TEST_PROJECT_FOLDER "ze_intel_gpu/black_box_tests") set(TEST_TARGETS
set(TEST_TARGETS zello_sysman
zello_sysman zello_metrics
zello_metrics )
foreach(TEST_NAME ${TEST_TARGETS})
add_executable(${TEST_NAME} ${TEST_NAME}.cpp)
set_target_properties(${TEST_NAME}
PROPERTIES
VS_DEBUGGER_COMMAND "$(TargetPath)"
VS_DEBUGGER_COMMAND_ARGUMENTS ""
VS_DEBUGGER_WORKING_DIRECTORY "$(OutputPath)"
) )
foreach(TEST_NAME ${TEST_TARGETS}) if(BUILD_LEVEL_ZERO_LOADER)
add_executable(${TEST_NAME} ${TEST_NAME}.cpp) add_dependencies(${TEST_NAME} ze_loader)
target_link_libraries(${TEST_NAME} ${NEO_BINARY_DIR}/lib/libze_loader.so)
set_target_properties(${TEST_NAME} else()
PROPERTIES target_link_libraries(${TEST_NAME} PUBLIC ${TARGET_NAME_L0})
VS_DEBUGGER_COMMAND "$(TargetPath)" endif()
VS_DEBUGGER_COMMAND_ARGUMENTS "" set_target_properties(${TEST_NAME} PROPERTIES FOLDER ${L0_BLACK_BOX_TEST_PROJECT_FOLDER})
VS_DEBUGGER_WORKING_DIRECTORY "$(OutputPath)" endforeach()
)
if(BUILD_LEVEL_ZERO_LOADER)
add_dependencies(${TEST_NAME} ze_loader)
target_link_libraries(${TEST_NAME} ${NEO_BINARY_DIR}/lib/libze_loader.so)
else()
target_link_libraries(${TEST_NAME} PUBLIC ${TARGET_NAME_L0})
endif()
set_target_properties(${TEST_NAME} PROPERTIES FOLDER ${L0_BLACK_BOX_TEST_PROJECT_FOLDER})
endforeach()
endif()
endif() endif()
add_subdirectories() add_subdirectories()