From bd2d319f2132a5b5366698f338df6e9bd85a6c13 Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 23 Nov 2022 18:57:53 +0000 Subject: [PATCH] SWDEV-332251 - hip-tests: add catch commithash to the txt file Fix package name according to packaging standards Change-Id: Ic25cf94d32d7020a3e34d79309f25f243b032c68 --- catch/CMakeLists.txt | 11 +++++++++++ catch/packaging/hip-tests.txt | 17 ++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/catch/CMakeLists.txt b/catch/CMakeLists.txt index 3f6c99205..e9ee4a559 100644 --- a/catch/CMakeLists.txt +++ b/catch/CMakeLists.txt @@ -76,6 +76,16 @@ list(GET VERSION_LIST 2 HIP_VERSION_PATCH_GITHASH) string(REPLACE "-" ";" VERSION_LIST ${HIP_VERSION_PATCH_GITHASH}) list(GET VERSION_LIST 0 HIP_VERSION_PATCH) +# get catch commit short hash +execute_process(COMMAND git rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + RESULT_VARIABLE git_result + OUTPUT_VARIABLE git_output + OUTPUT_STRIP_TRAILING_WHITESPACE) +if(git_result EQUAL 0) + set(CATCH_GITHASH ${git_output}) +endif() + if(NOT DEFINED CATCH2_PATH) if(DEFINED ENV{CATCH2_PATH}) set(CATCH2_PATH $ENV{CATCH2_PATH} CACHE STRING "Catch2 Path") @@ -203,6 +213,7 @@ message(STATUS "Using offload arch string: ${OFFLOAD_ARCH_STR}") string(TIMESTAMP _timestamp UTC) set(_catchInfo "# Auto-generated by cmake on ${_timestamp} UTC\n") set(_catchInfo ${_catchInfo} "HIP_VERSION=${HIP_VERSION}\n") +set(_catchInfo ${_catchInfo} "CATCH_GITHASH=${CATCH_GITHASH}\n") set(_catchInfo ${_catchInfo} "HIP_PLATFORM=${HIP_PLATFORM}\n") set(_catchInfo ${_catchInfo} "ARCHS=${HIP_GPU_ARCH_LIST}\n") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CATCH_BUILD_DIR}/catchInfo.txt ${_catchInfo}) diff --git a/catch/packaging/hip-tests.txt b/catch/packaging/hip-tests.txt index 0c168e519..dd4f6612e 100644 --- a/catch/packaging/hip-tests.txt +++ b/catch/packaging/hip-tests.txt @@ -76,12 +76,27 @@ set(CPACK_PACKAGE_DESCRIPTION "HIP: Heterogenous-computing Interface for Portability [CATCH TESTS]") set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.") set(CPACK_PACKAGE_CONTACT "HIP Support ") -set(CPACK_PACKAGE_VERSION @HIP_VERSION_MAJOR@.@HIP_VERSION_MINOR@.@HIP_VERSION_PATCH_GITHASH@) +if (DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE}) + set(CPACK_DEBIAN_PACKAGE_RELEASE $ENV{CPACK_DEBIAN_PACKAGE_RELEASE}) +else() + set(CPACK_DEBIAN_PACKAGE_RELEASE "local") +endif() +if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE}) + set(CPACK_RPM_PACKAGE_RELEASE $ENV{CPACK_RPM_PACKAGE_RELEASE}) +else() + set(CPACK_RPM_PACKAGE_RELEASE "local") +endif() +set(ROCM_VERSION_FOR_PACKAGE "99999") +if(DEFINED ENV{ROCM_LIBPATCH_VERSION}) + set(ROCM_VERSION_FOR_PACKAGE $ENV{ROCM_LIBPATCH_VERSION}) +endif() # to remove hip-catch-* package during uninstallation of rocm set (CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-core") set (CPACK_RPM_PACKAGE_REQUIRES "rocm-core") +set(CPACK_PACKAGE_VERSION @HIP_VERSION_MAJOR@.@HIP_VERSION_MINOR@.@HIP_VERSION_PATCH@.${ROCM_VERSION_FOR_PACKAGE}) + if(NOT WIN32) set(CPACK_GENERATOR "TGZ;DEB;RPM" CACHE STRING "Linux package types for catch tests") set(CPACK_BINARY_DEB "ON")