[rocprofiler-systems] Implement GTest/GMock integration for unit testing (#1777)
* googletest project set up --------- Co-authored-by: Aleksandar Djordjevic <adjordje@amd.com> Co-authored-by: Milan Radosavljevic <milan.radosavljevic@amd.com>
Αυτή η υποβολή περιλαμβάνεται σε:
υποβλήθηκε από
GitHub
γονέας
0580e2053c
υποβολή
a5d554b85a
@@ -82,3 +82,6 @@
|
|||||||
[submodule "projects/rocprofiler-systems/examples/openmp/external/ompvv"]
|
[submodule "projects/rocprofiler-systems/examples/openmp/external/ompvv"]
|
||||||
path = projects/rocprofiler-systems/examples/openmp/external/ompvv
|
path = projects/rocprofiler-systems/examples/openmp/external/ompvv
|
||||||
url = https://github.com/OpenMP-Validation-and-Verification/OpenMP_VV.git
|
url = https://github.com/OpenMP-Validation-and-Verification/OpenMP_VV.git
|
||||||
|
[submodule "projects/rocprofiler-systems/external/googletest"]
|
||||||
|
path = projects/rocprofiler-systems/external/googletest
|
||||||
|
url = https://github.com/google/googletest.git
|
||||||
|
|||||||
@@ -239,6 +239,9 @@ rocprofiler_systems_add_option(ROCPROFSYS_INSTALL_PERFETTO_TOOLS
|
|||||||
rocprofiler_systems_add_option(ROCPROFILER_BUILD_SQLITE3
|
rocprofiler_systems_add_option(ROCPROFILER_BUILD_SQLITE3
|
||||||
"Enable building sqlite3 library internally" OFF
|
"Enable building sqlite3 library internally" OFF
|
||||||
)
|
)
|
||||||
|
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_GTEST
|
||||||
|
"Enable building googletest library internally" ON
|
||||||
|
)
|
||||||
|
|
||||||
if(ROCPROFSYS_USE_PAPI)
|
if(ROCPROFSYS_USE_PAPI)
|
||||||
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_PAPI "Build PAPI from submodule" ON)
|
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_PAPI "Build PAPI from submodule" ON)
|
||||||
|
|||||||
@@ -1,94 +1,95 @@
|
|||||||
{
|
{
|
||||||
"version": 3,
|
"configurePresets": [
|
||||||
"configurePresets": [
|
{
|
||||||
{
|
"binaryDir": "${sourceDir}/build/ci",
|
||||||
"name": "ci",
|
"cacheVariables": {
|
||||||
"displayName": "official CI build",
|
"CMAKE_BUILD_TYPE": "Release",
|
||||||
"description": "Official CI build parameters",
|
"CMAKE_CXX_COMPILER": "g++",
|
||||||
"generator": "Ninja",
|
"CMAKE_C_COMPILER": "gcc",
|
||||||
"binaryDir": "${sourceDir}/build/ci",
|
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||||
"cacheVariables": {
|
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||||
"CMAKE_BUILD_TYPE": "Release",
|
"ROCPROFSYS_BUILD_CI": "ON",
|
||||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||||
"CMAKE_C_COMPILER": "gcc",
|
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||||
"CMAKE_CXX_COMPILER": "g++",
|
"ROCPROFSYS_BUILD_GTEST": "ON",
|
||||||
"ROCPROFSYS_USE_ROCM": "ON",
|
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
||||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
"ROCPROFSYS_BUILD_TESTING": "ON",
|
||||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
"ROCPROFSYS_MAX_THREADS": "64",
|
||||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
"ROCPROFSYS_STRIP_LIBRARIES": "OFF",
|
||||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
"ROCPROFSYS_USE_ROCM": "ON"
|
||||||
"ROCPROFSYS_BUILD_TESTING": "ON",
|
},
|
||||||
"ROCPROFSYS_STRIP_LIBRARIES": "OFF",
|
"description": "Official CI build parameters",
|
||||||
"ROCPROFSYS_MAX_THREADS": "64",
|
"displayName": "official CI build",
|
||||||
"ROCPROFSYS_BUILD_CI": "ON"
|
"generator": "Ninja",
|
||||||
}
|
"name": "ci"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "debug",
|
"binaryDir": "${sourceDir}/build/debug",
|
||||||
"displayName": "official debug build",
|
"cacheVariables": {
|
||||||
"description": "Debug build parameters with tests",
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
"binaryDir": "${sourceDir}/build/debug",
|
"CMAKE_CXX_COMPILER": "g++",
|
||||||
"generator": "Ninja",
|
"CMAKE_C_COMPILER": "gcc",
|
||||||
"cacheVariables": {
|
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||||
"CMAKE_BUILD_TYPE": "Debug",
|
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
"ROCPROFSYS_BUILD_DEBUG": "ON",
|
||||||
"CMAKE_C_COMPILER": "gcc",
|
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||||
"CMAKE_CXX_COMPILER": "g++",
|
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||||
"ROCPROFSYS_USE_ROCM": "ON",
|
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
||||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
"ROCPROFSYS_BUILD_TESTING": "ON",
|
||||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
"ROCPROFSYS_STRIP_LIBRARIES": "OFF",
|
||||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
"ROCPROFSYS_USE_ROCM": "ON"
|
||||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
},
|
||||||
"ROCPROFSYS_BUILD_TESTING": "ON",
|
"description": "Debug build parameters with tests",
|
||||||
"ROCPROFSYS_STRIP_LIBRARIES": "OFF",
|
"displayName": "official debug build",
|
||||||
"ROCPROFSYS_BUILD_DEBUG": "ON"
|
"generator": "Ninja",
|
||||||
}
|
"name": "debug"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "debug-optimized",
|
"binaryDir": "${sourceDir}/build/debug-optimized",
|
||||||
"displayName": "release build with debug info",
|
"cacheVariables": {
|
||||||
"description": "Release build with debug info with tests",
|
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
||||||
"generator": "Ninja",
|
"CMAKE_CXX_COMPILER": "g++",
|
||||||
"binaryDir": "${sourceDir}/build/debug-optimized",
|
"CMAKE_C_COMPILER": "gcc",
|
||||||
"cacheVariables": {
|
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||||
"CMAKE_C_COMPILER": "gcc",
|
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||||
"CMAKE_CXX_COMPILER": "g++",
|
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
||||||
"ROCPROFSYS_USE_ROCM": "ON",
|
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
"ROCPROFSYS_BUILD_TESTING": "ON",
|
||||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
"ROCPROFSYS_STRIP_LIBRARIES": "OFF",
|
||||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
"ROCPROFSYS_USE_ROCM": "ON"
|
||||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
},
|
||||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
"description": "Release build with debug info with tests",
|
||||||
"ROCPROFSYS_BUILD_TESTING": "ON",
|
"displayName": "release build with debug info",
|
||||||
"ROCPROFSYS_STRIP_LIBRARIES": "OFF"
|
"generator": "Ninja",
|
||||||
}
|
"name": "debug-optimized"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "release",
|
"binaryDir": "${sourceDir}/build/release",
|
||||||
"displayName": "official release build",
|
"cacheVariables": {
|
||||||
"description": "Official release build",
|
"CMAKE_BUILD_TYPE": "Release",
|
||||||
"generator": "Ninja",
|
"CMAKE_CXX_COMPILER": "g++",
|
||||||
"binaryDir": "${sourceDir}/build/release",
|
"CMAKE_C_COMPILER": "gcc",
|
||||||
"cacheVariables": {
|
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||||
"CMAKE_BUILD_TYPE": "Release",
|
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||||
"CMAKE_C_COMPILER": "gcc",
|
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||||
"CMAKE_CXX_COMPILER": "g++",
|
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
||||||
"ROCPROFSYS_USE_ROCM": "ON",
|
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
"ROCPROFSYS_USE_ROCM": "ON"
|
||||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
},
|
||||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
"description": "Official release build",
|
||||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
"displayName": "official release build",
|
||||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON"
|
"generator": "Ninja",
|
||||||
}
|
"name": "release"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"version": 3
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
# THE SOFTWARE.
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
|
if(ROCPROFSYS_BUILD_GTEST)
|
||||||
|
message(STATUS "Setting up GoogleTest using FetchContent")
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
rocprofiler_systems_checkout_git_submodule(
|
||||||
|
RELATIVE_PATH external/googletest
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
TEST_FILE CMakeLists.txt
|
||||||
|
REPO_URL https://github.com/google/googletest.git
|
||||||
|
REPO_BRANCH "v1.17.0"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Configure GoogleTest options before adding it
|
||||||
|
set(BUILD_GMOCK ON CACHE BOOL "Build GMock" FORCE)
|
||||||
|
set(INSTALL_GTEST OFF CACHE BOOL "Disable GTest installation" FORCE)
|
||||||
|
set(gtest_force_shared_crt ON CACHE BOOL "Use shared CRT" FORCE)
|
||||||
|
|
||||||
|
# Declare GoogleTest from the submodule
|
||||||
|
FetchContent_Declare(googletest SOURCE_DIR ${PROJECT_SOURCE_DIR}/external/googletest)
|
||||||
|
|
||||||
|
# Make GoogleTest available
|
||||||
|
FetchContent_MakeAvailable(googletest)
|
||||||
|
|
||||||
|
# Create interface library that wraps GoogleTest targets
|
||||||
|
add_library(rocprofiler-systems-googletest-library INTERFACE)
|
||||||
|
|
||||||
|
target_link_libraries(
|
||||||
|
rocprofiler-systems-googletest-library
|
||||||
|
INTERFACE GTest::gtest GTest::gtest_main GTest::gmock
|
||||||
|
)
|
||||||
|
|
||||||
|
message(STATUS "GoogleTest configured successfully using FetchContent")
|
||||||
|
else()
|
||||||
|
message(STATUS "Using system GTest library")
|
||||||
|
find_package(GTest REQUIRED)
|
||||||
|
add_library(rocprofiler-systems-googletest-library INTERFACE)
|
||||||
|
|
||||||
|
# Link against system GTest targets
|
||||||
|
target_link_libraries(
|
||||||
|
rocprofiler-systems-googletest-library
|
||||||
|
INTERFACE GTest::gtest GTest::gtest_main
|
||||||
|
)
|
||||||
|
|
||||||
|
# Also link gmock if available
|
||||||
|
if(TARGET GTest::gmock)
|
||||||
|
target_link_libraries(
|
||||||
|
rocprofiler-systems-googletest-library
|
||||||
|
INTERFACE GTest::gmock
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
@@ -12,62 +12,62 @@ rocprofiler_systems_add_interface_library(
|
|||||||
"Provides minimal set of include flags to compile with rocprofiler-systems"
|
"Provides minimal set of include flags to compile with rocprofiler-systems"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-threading
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-threading
|
||||||
"Enables multithreading support"
|
"Enables multithreading support"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(
|
rocprofiler_systems_add_interface_library(
|
||||||
rocprofiler-systems-dyninst
|
rocprofiler-systems-dyninst
|
||||||
"Provides flags and libraries for Dyninst (dynamic instrumentation)"
|
"Provides flags and libraries for Dyninst (dynamic instrumentation)"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-boost
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-boost
|
||||||
"Boost interface library (for Dyninst)"
|
"Boost interface library (for Dyninst)"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-elfutils
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-elfutils
|
||||||
"ElfUtils interface library (for Dyninst)"
|
"ElfUtils interface library (for Dyninst)"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-libiberty
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-libiberty
|
||||||
"LibIberty interface library (for Dyninst)"
|
"LibIberty interface library (for Dyninst)"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(
|
rocprofiler_systems_add_interface_library(
|
||||||
rocprofiler-systems-tbb "Threading Building Blocks interface library (for Dyninst)"
|
rocprofiler-systems-tbb "Threading Building Blocks interface library (for Dyninst)"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-rocm
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-rocm
|
||||||
"Provides flags and libraries for ROCm"
|
"Provides flags and libraries for ROCm"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-mpi
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-mpi
|
||||||
"Provides MPI or MPI headers"
|
"Provides MPI or MPI headers"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-libva
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-libva
|
||||||
"Provides VA-API headers"
|
"Provides VA-API headers"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-bfd
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-bfd
|
||||||
"Provides Binary File Descriptor (BFD)"
|
"Provides Binary File Descriptor (BFD)"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-ptl
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-ptl
|
||||||
"Enables PTL support (tasking)"
|
"Enables PTL support (tasking)"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-papi "Enable PAPI support")
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-papi "Enable PAPI support")
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-ompt "Enable OMPT support")
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-ompt "Enable OMPT support")
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-python
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-python
|
||||||
"Enables Python support"
|
"Enables Python support"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-perfetto
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-perfetto
|
||||||
"Enables Perfetto support"
|
"Enables Perfetto support"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-sqlite3
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-sqlite3
|
||||||
"Use SQLite3 for rocpd data storage"
|
"Use SQLite3 for rocpd data storage"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-json
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-json
|
||||||
"Use nlohmann/json for json data handling"
|
"Use nlohmann/json for json data handling"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-timemory
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-timemory
|
||||||
"Provides timemory libraries"
|
"Provides timemory libraries"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(
|
rocprofiler_systems_add_interface_library(
|
||||||
rocprofiler-systems-timemory-config
|
rocprofiler-systems-timemory-config
|
||||||
"CMake interface library applied to all timemory targets"
|
"CMake interface library applied to all timemory targets"
|
||||||
)
|
)
|
||||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-compile-definitions
|
rocprofiler_systems_add_interface_library(rocprofiler-systems-compile-definitions
|
||||||
"Compile definitions"
|
"Compile definitions"
|
||||||
)
|
)
|
||||||
|
|
||||||
# libraries with relevant compile definitions
|
# libraries with relevant compile definitions
|
||||||
@@ -199,7 +199,7 @@ if(ROCPROFSYS_USE_ROCM)
|
|||||||
set(ROCPROFSYS_ROCM_VERSION ${ROCmVersion_TRIPLE_VERSION})
|
set(ROCPROFSYS_ROCM_VERSION ${ROCmVersion_TRIPLE_VERSION})
|
||||||
|
|
||||||
rocprofiler_systems_add_feature(ROCPROFSYS_ROCM_VERSION
|
rocprofiler_systems_add_feature(ROCPROFSYS_ROCM_VERSION
|
||||||
"ROCm version used by rocprofiler-systems"
|
"ROCm version used by rocprofiler-systems"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
set(ROCPROFSYS_ROCM_VERSION "0.0.0")
|
set(ROCPROFSYS_ROCM_VERSION "0.0.0")
|
||||||
@@ -218,7 +218,7 @@ if(ROCPROFSYS_USE_ROCM)
|
|||||||
# ROCProfiler SDK
|
# ROCProfiler SDK
|
||||||
find_package(rocprofiler-sdk ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
|
find_package(rocprofiler-sdk ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
|
||||||
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-rocm
|
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-rocm
|
||||||
INTERFACE ROCPROFSYS_USE_ROCM
|
INTERFACE ROCPROFSYS_USE_ROCM
|
||||||
)
|
)
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
rocprofiler-systems-rocm
|
rocprofiler-systems-rocm
|
||||||
@@ -374,12 +374,12 @@ if(ROCPROFSYS_USE_MPI)
|
|||||||
find_package(MPI ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
|
find_package(MPI ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
|
||||||
target_link_libraries(rocprofiler-systems-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX)
|
target_link_libraries(rocprofiler-systems-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX)
|
||||||
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-mpi
|
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-mpi
|
||||||
INTERFACE ROCPROFSYS_USE_MPI
|
INTERFACE ROCPROFSYS_USE_MPI
|
||||||
)
|
)
|
||||||
elseif(ROCPROFSYS_USE_MPI_HEADERS)
|
elseif(ROCPROFSYS_USE_MPI_HEADERS)
|
||||||
find_package(MPI-Headers ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
|
find_package(MPI-Headers ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
|
||||||
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-mpi
|
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-mpi
|
||||||
INTERFACE ROCPROFSYS_USE_MPI_HEADERS
|
INTERFACE ROCPROFSYS_USE_MPI_HEADERS
|
||||||
)
|
)
|
||||||
target_link_libraries(rocprofiler-systems-mpi INTERFACE MPI::MPI_HEADERS)
|
target_link_libraries(rocprofiler-systems-mpi INTERFACE MPI::MPI_HEADERS)
|
||||||
endif()
|
endif()
|
||||||
@@ -427,7 +427,7 @@ if(ROCPROFSYS_BUILD_DYNINST)
|
|||||||
|
|
||||||
rocprofiler_systems_save_variables(
|
rocprofiler_systems_save_variables(
|
||||||
PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH
|
PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH
|
||||||
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH
|
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH
|
||||||
)
|
)
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF)
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF)
|
||||||
@@ -450,7 +450,7 @@ if(ROCPROFSYS_BUILD_DYNINST)
|
|||||||
add_subdirectory(external/dyninst EXCLUDE_FROM_ALL)
|
add_subdirectory(external/dyninst EXCLUDE_FROM_ALL)
|
||||||
rocprofiler_systems_restore_variables(
|
rocprofiler_systems_restore_variables(
|
||||||
PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH
|
PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH
|
||||||
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH
|
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(Dyninst::Dyninst INTERFACE IMPORTED)
|
add_library(Dyninst::Dyninst INTERFACE IMPORTED)
|
||||||
@@ -617,7 +617,7 @@ else()
|
|||||||
INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${DYNINST_HEADER_DIR}
|
INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${DYNINST_HEADER_DIR}
|
||||||
)
|
)
|
||||||
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-dyninst
|
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-dyninst
|
||||||
INTERFACE ROCPROFSYS_USE_DYNINST
|
INTERFACE ROCPROFSYS_USE_DYNINST
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -683,6 +683,16 @@ include(SQLite3)
|
|||||||
|
|
||||||
include(NlohmannJson)
|
include(NlohmannJson)
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------------------#
|
||||||
|
#
|
||||||
|
# GTest
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------------------#
|
||||||
|
|
||||||
|
if(ROCPROFSYS_BUILD_TESTING)
|
||||||
|
include(GTest)
|
||||||
|
endif()
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------------#
|
# ----------------------------------------------------------------------------------------#
|
||||||
#
|
#
|
||||||
# ELFIO
|
# ELFIO
|
||||||
@@ -729,13 +739,13 @@ target_compile_definitions(
|
|||||||
|
|
||||||
if(ROCPROFSYS_BUILD_STACK_PROTECTOR)
|
if(ROCPROFSYS_BUILD_STACK_PROTECTOR)
|
||||||
add_target_flag_if_avail(rocprofiler-systems-timemory-config
|
add_target_flag_if_avail(rocprofiler-systems-timemory-config
|
||||||
"-fstack-protector-strong" "-Wstack-protector"
|
"-fstack-protector-strong" "-Wstack-protector"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ROCPROFSYS_BUILD_DEBUG)
|
if(ROCPROFSYS_BUILD_DEBUG)
|
||||||
add_target_flag_if_avail(rocprofiler-systems-timemory-config
|
add_target_flag_if_avail(rocprofiler-systems-timemory-config
|
||||||
"-fno-omit-frame-pointer" "-g3"
|
"-fno-omit-frame-pointer" "-g3"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -864,7 +874,7 @@ rocprofiler_systems_checkout_git_submodule(
|
|||||||
|
|
||||||
rocprofiler_systems_save_variables(
|
rocprofiler_systems_save_variables(
|
||||||
BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS
|
BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS
|
||||||
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH
|
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH
|
||||||
)
|
)
|
||||||
|
|
||||||
# ensure timemory builds PIC static libs so that we don't have to install timemory shared
|
# ensure timemory builds PIC static libs so that we don't have to install timemory shared
|
||||||
@@ -898,7 +908,7 @@ endif()
|
|||||||
|
|
||||||
rocprofiler_systems_restore_variables(
|
rocprofiler_systems_restore_variables(
|
||||||
BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS
|
BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS
|
||||||
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH
|
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH
|
||||||
)
|
)
|
||||||
|
|
||||||
if(TARGET rocprofiler-systems-papi-build)
|
if(TARGET rocprofiler-systems-papi-build)
|
||||||
@@ -936,7 +946,7 @@ target_link_libraries(
|
|||||||
|
|
||||||
if(ROCPROFSYS_USE_BFD)
|
if(ROCPROFSYS_USE_BFD)
|
||||||
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-bfd
|
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-bfd
|
||||||
INTERFACE ROCPROFSYS_USE_BFD
|
INTERFACE ROCPROFSYS_USE_BFD
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -972,8 +982,8 @@ if(NOT TARGET PTL::ptl-shared)
|
|||||||
rocprofiler_systems_save_variables(
|
rocprofiler_systems_save_variables(
|
||||||
BUILD_CONFIG
|
BUILD_CONFIG
|
||||||
VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS
|
VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS
|
||||||
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
|
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
|
||||||
CMAKE_VISIBILITY_INLINES_HIDDEN
|
CMAKE_VISIBILITY_INLINES_HIDDEN
|
||||||
)
|
)
|
||||||
|
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
@@ -988,8 +998,8 @@ if(NOT TARGET PTL::ptl-shared)
|
|||||||
rocprofiler_systems_restore_variables(
|
rocprofiler_systems_restore_variables(
|
||||||
BUILD_CONFIG
|
BUILD_CONFIG
|
||||||
VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS
|
VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS
|
||||||
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
|
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
|
||||||
CMAKE_VISIBILITY_INLINES_HIDDEN
|
CMAKE_VISIBILITY_INLINES_HIDDEN
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -1016,7 +1026,7 @@ include(Compilers)
|
|||||||
if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX)
|
if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX)
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
rocprofiler_systems_restore_variables(STATIC_LIBSTDCXX_CXX
|
rocprofiler_systems_restore_variables(STATIC_LIBSTDCXX_CXX
|
||||||
VARIABLES CMAKE_CXX_FLAGS
|
VARIABLES CMAKE_CXX_FLAGS
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
+1
Submodule projects/rocprofiler-systems/external/googletest added at 6ec14dfd8c
@@ -13,6 +13,10 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
|
|||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
add_subdirectory(bin)
|
add_subdirectory(bin)
|
||||||
|
|
||||||
|
if(ROCPROFSYS_BUILD_TESTING)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ROCPROFSYS_USE_PYTHON)
|
if(ROCPROFSYS_USE_PYTHON)
|
||||||
add_subdirectory(python)
|
add_subdirectory(python)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
# THE SOFTWARE.
|
||||||
|
|
||||||
|
add_executable(rocprof-sys-unit-tests dummy.cpp)
|
||||||
|
|
||||||
|
target_link_libraries(
|
||||||
|
rocprof-sys-unit-tests
|
||||||
|
PRIVATE rocprofiler-systems-googletest-library
|
||||||
|
)
|
||||||
|
|
||||||
|
include(GoogleTest)
|
||||||
|
gtest_discover_tests(rocprof-sys-unit-tests)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
TEST(first, test) { ASSERT_TRUE(true); }
|
||||||
@@ -28,6 +28,7 @@ include_guard(GLOBAL)
|
|||||||
include(${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-testing.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-testing.cmake)
|
||||||
|
|
||||||
# test groups
|
# test groups
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-unit-tests.cmake)
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-config-tests.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-config-tests.cmake)
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument-tests.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument-tests.cmake)
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-pthread-tests.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-pthread-tests.cmake)
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2025 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
|
add_test(
|
||||||
|
NAME rocprof-sys-unit-tests
|
||||||
|
COMMAND rocprof-sys-unit-tests
|
||||||
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
|
)
|
||||||
Αναφορά σε νέο ζήτημα
Block a user