SWDEV-273235 - catch2 packaging for jenkins build (#2430)
Change-Id: I9686b3e26d4e8a24ce97ac1e1f31a4293678d577
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.16.8)
|
||||
project(hiptests)
|
||||
|
||||
# Check if platform and compiler are set
|
||||
if(HIP_PLATFORM STREQUAL "amd")
|
||||
@@ -34,11 +33,10 @@ else()
|
||||
cmake_path(SET CMAKE_C_COMPILER "${HIP_PATH}/bin/hipcc.bat")
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT UNIX)
|
||||
# In linux this reruns the cmake and fails with incorrect vars.
|
||||
# so the project command is used only for windows
|
||||
project(build_tests)
|
||||
project(hiptests)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CATCH2_PATH)
|
||||
|
||||
+7
-4
@@ -169,9 +169,12 @@ function(catch_discover_tests TARGET)
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
file(RELATIVE_PATH ctestincludepath ${CMAKE_CURRENT_BINARY_DIR} ${ctest_include_file})
|
||||
file(RELATIVE_PATH ctestfilepath ${CMAKE_CURRENT_BINARY_DIR} ${ctest_tests_file})
|
||||
|
||||
file(WRITE "${ctest_include_file}"
|
||||
"if(EXISTS \"${ctest_tests_file}\")\n"
|
||||
" include(\"${ctest_tests_file}\")\n"
|
||||
"if(EXISTS \"${ctestfilepath}\")\n"
|
||||
" include(\"${ctestfilepath}\")\n"
|
||||
"else()\n"
|
||||
" message(WARNING \"Test ${TARGET} not built yet.\")\n"
|
||||
"endif()\n"
|
||||
@@ -180,14 +183,14 @@ function(catch_discover_tests TARGET)
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
|
||||
# Add discovered tests to directory TEST_INCLUDE_FILES
|
||||
set_property(DIRECTORY
|
||||
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
|
||||
APPEND PROPERTY TEST_INCLUDE_FILES "${ctestincludepath}"
|
||||
)
|
||||
else()
|
||||
# Add discovered tests as directory TEST_INCLUDE_FILE if possible
|
||||
get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
|
||||
if (NOT ${test_include_file_set})
|
||||
set_property(DIRECTORY
|
||||
PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
|
||||
PROPERTY TEST_INCLUDE_FILE "${ctestincludepath}"
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
|
||||
@@ -107,12 +107,14 @@ foreach(line ${output})
|
||||
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}
|
||||
"${TEST_EXECUTABLE}"
|
||||
"${exe_path}"
|
||||
"${test_name}"
|
||||
${extra_args}
|
||||
"${reporter_arg}"
|
||||
@@ -121,7 +123,6 @@ foreach(line ${output})
|
||||
add_command(set_tests_properties
|
||||
"${prefix}${test}${suffix}"
|
||||
PROPERTIES
|
||||
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||
${properties}
|
||||
)
|
||||
list(APPEND tests "${prefix}${test}${suffix}")
|
||||
|
||||
@@ -28,4 +28,6 @@ add_subdirectory(rtc)
|
||||
add_subdirectory(printf)
|
||||
add_subdirectory(printfExe)
|
||||
add_subdirectory(texture)
|
||||
add_subdirectory(graph)
|
||||
if(UNIX)
|
||||
add_subdirectory(graph)
|
||||
endif()
|
||||
|
||||
@@ -61,7 +61,7 @@ static __global__ void reduceFinal(double* d_in, double* d_out) {
|
||||
static void init_input(float* a, size_t size) {
|
||||
unsigned int seed = time(nullptr);
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
a[i] = (rand_r(&seed) & 0xFF) / static_cast<float>(RAND_MAX);
|
||||
a[i] = (HipTest::RAND_R(&seed) & 0xFF) / static_cast<float>(RAND_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user