[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>
This commit is contained in:
zatwierdzone przez
GitHub
rodzic
0580e2053c
commit
a5d554b85a
@@ -82,3 +82,6 @@
|
||||
[submodule "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
|
||||
[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
|
||||
"Enable building sqlite3 library internally" OFF
|
||||
)
|
||||
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_GTEST
|
||||
"Enable building googletest library internally" ON
|
||||
)
|
||||
|
||||
if(ROCPROFSYS_USE_PAPI)
|
||||
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_PAPI "Build PAPI from submodule" ON)
|
||||
|
||||
@@ -1,94 +1,95 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "ci",
|
||||
"displayName": "official CI build",
|
||||
"description": "Official CI build parameters",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/ci",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"CMAKE_CXX_COMPILER": "g++",
|
||||
"ROCPROFSYS_USE_ROCM": "ON",
|
||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
||||
"ROCPROFSYS_BUILD_TESTING": "ON",
|
||||
"ROCPROFSYS_STRIP_LIBRARIES": "OFF",
|
||||
"ROCPROFSYS_MAX_THREADS": "64",
|
||||
"ROCPROFSYS_BUILD_CI": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"displayName": "official debug build",
|
||||
"description": "Debug build parameters with tests",
|
||||
"binaryDir": "${sourceDir}/build/debug",
|
||||
"generator": "Ninja",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"CMAKE_CXX_COMPILER": "g++",
|
||||
"ROCPROFSYS_USE_ROCM": "ON",
|
||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
||||
"ROCPROFSYS_BUILD_TESTING": "ON",
|
||||
"ROCPROFSYS_STRIP_LIBRARIES": "OFF",
|
||||
"ROCPROFSYS_BUILD_DEBUG": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug-optimized",
|
||||
"displayName": "release build with debug info",
|
||||
"description": "Release build with debug info with tests",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/debug-optimized",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"CMAKE_CXX_COMPILER": "g++",
|
||||
"ROCPROFSYS_USE_ROCM": "ON",
|
||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
||||
"ROCPROFSYS_BUILD_TESTING": "ON",
|
||||
"ROCPROFSYS_STRIP_LIBRARIES": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"displayName": "official release build",
|
||||
"description": "Official release build",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"CMAKE_CXX_COMPILER": "g++",
|
||||
"ROCPROFSYS_USE_ROCM": "ON",
|
||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON"
|
||||
}
|
||||
}
|
||||
]
|
||||
"configurePresets": [
|
||||
{
|
||||
"binaryDir": "${sourceDir}/build/ci",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_CXX_COMPILER": "g++",
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||
"ROCPROFSYS_BUILD_CI": "ON",
|
||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||
"ROCPROFSYS_BUILD_GTEST": "ON",
|
||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||
"ROCPROFSYS_BUILD_TESTING": "ON",
|
||||
"ROCPROFSYS_MAX_THREADS": "64",
|
||||
"ROCPROFSYS_STRIP_LIBRARIES": "OFF",
|
||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||
"ROCPROFSYS_USE_ROCM": "ON"
|
||||
},
|
||||
"description": "Official CI build parameters",
|
||||
"displayName": "official CI build",
|
||||
"generator": "Ninja",
|
||||
"name": "ci"
|
||||
},
|
||||
{
|
||||
"binaryDir": "${sourceDir}/build/debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_CXX_COMPILER": "g++",
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||
"ROCPROFSYS_BUILD_DEBUG": "ON",
|
||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||
"ROCPROFSYS_BUILD_TESTING": "ON",
|
||||
"ROCPROFSYS_STRIP_LIBRARIES": "OFF",
|
||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||
"ROCPROFSYS_USE_ROCM": "ON"
|
||||
},
|
||||
"description": "Debug build parameters with tests",
|
||||
"displayName": "official debug build",
|
||||
"generator": "Ninja",
|
||||
"name": "debug"
|
||||
},
|
||||
{
|
||||
"binaryDir": "${sourceDir}/build/debug-optimized",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
||||
"CMAKE_CXX_COMPILER": "g++",
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||
"ROCPROFSYS_BUILD_TESTING": "ON",
|
||||
"ROCPROFSYS_STRIP_LIBRARIES": "OFF",
|
||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||
"ROCPROFSYS_USE_ROCM": "ON"
|
||||
},
|
||||
"description": "Release build with debug info with tests",
|
||||
"displayName": "release build with debug info",
|
||||
"generator": "Ninja",
|
||||
"name": "debug-optimized"
|
||||
},
|
||||
{
|
||||
"binaryDir": "${sourceDir}/build/release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_CXX_COMPILER": "g++",
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"CMAKE_INSTALL_PREFIX": "/opt/rocprofiler-systems",
|
||||
"ROCPROFSYS_BUILD_BOOST": "ON",
|
||||
"ROCPROFSYS_BUILD_DYNINST": "ON",
|
||||
"ROCPROFSYS_BUILD_ELFUTILS": "ON",
|
||||
"ROCPROFSYS_BUILD_LIBIBERTY": "ON",
|
||||
"ROCPROFSYS_BUILD_TBB": "ON",
|
||||
"ROCPROFSYS_USE_PYTHON": "ON",
|
||||
"ROCPROFSYS_USE_ROCM": "ON"
|
||||
},
|
||||
"description": "Official release build",
|
||||
"displayName": "official release build",
|
||||
"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"
|
||||
)
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-threading
|
||||
"Enables multithreading support"
|
||||
"Enables multithreading support"
|
||||
)
|
||||
rocprofiler_systems_add_interface_library(
|
||||
rocprofiler-systems-dyninst
|
||||
"Provides flags and libraries for Dyninst (dynamic instrumentation)"
|
||||
)
|
||||
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
|
||||
"ElfUtils interface library (for Dyninst)"
|
||||
"ElfUtils interface library (for Dyninst)"
|
||||
)
|
||||
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-tbb "Threading Building Blocks interface library (for Dyninst)"
|
||||
)
|
||||
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
|
||||
"Provides MPI or MPI headers"
|
||||
"Provides MPI or MPI headers"
|
||||
)
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-libva
|
||||
"Provides VA-API headers"
|
||||
"Provides VA-API headers"
|
||||
)
|
||||
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
|
||||
"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-ompt "Enable OMPT support")
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-python
|
||||
"Enables Python support"
|
||||
"Enables Python support"
|
||||
)
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-perfetto
|
||||
"Enables Perfetto support"
|
||||
"Enables Perfetto support"
|
||||
)
|
||||
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
|
||||
"Use nlohmann/json for json data handling"
|
||||
"Use nlohmann/json for json data handling"
|
||||
)
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-timemory
|
||||
"Provides timemory libraries"
|
||||
"Provides timemory libraries"
|
||||
)
|
||||
rocprofiler_systems_add_interface_library(
|
||||
rocprofiler-systems-timemory-config
|
||||
"CMake interface library applied to all timemory targets"
|
||||
)
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-compile-definitions
|
||||
"Compile definitions"
|
||||
"Compile definitions"
|
||||
)
|
||||
|
||||
# libraries with relevant compile definitions
|
||||
@@ -199,7 +199,7 @@ if(ROCPROFSYS_USE_ROCM)
|
||||
set(ROCPROFSYS_ROCM_VERSION ${ROCmVersion_TRIPLE_VERSION})
|
||||
|
||||
rocprofiler_systems_add_feature(ROCPROFSYS_ROCM_VERSION
|
||||
"ROCm version used by rocprofiler-systems"
|
||||
"ROCm version used by rocprofiler-systems"
|
||||
)
|
||||
else()
|
||||
set(ROCPROFSYS_ROCM_VERSION "0.0.0")
|
||||
@@ -218,7 +218,7 @@ if(ROCPROFSYS_USE_ROCM)
|
||||
# ROCProfiler SDK
|
||||
find_package(rocprofiler-sdk ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
|
||||
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-rocm
|
||||
INTERFACE ROCPROFSYS_USE_ROCM
|
||||
INTERFACE ROCPROFSYS_USE_ROCM
|
||||
)
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-rocm
|
||||
@@ -374,12 +374,12 @@ if(ROCPROFSYS_USE_MPI)
|
||||
find_package(MPI ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
|
||||
target_link_libraries(rocprofiler-systems-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX)
|
||||
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-mpi
|
||||
INTERFACE ROCPROFSYS_USE_MPI
|
||||
INTERFACE ROCPROFSYS_USE_MPI
|
||||
)
|
||||
elseif(ROCPROFSYS_USE_MPI_HEADERS)
|
||||
find_package(MPI-Headers ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
|
||||
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)
|
||||
endif()
|
||||
@@ -427,7 +427,7 @@ if(ROCPROFSYS_BUILD_DYNINST)
|
||||
|
||||
rocprofiler_systems_save_variables(
|
||||
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_INSTALL_RPATH_USE_LINK_PATH OFF)
|
||||
@@ -450,7 +450,7 @@ if(ROCPROFSYS_BUILD_DYNINST)
|
||||
add_subdirectory(external/dyninst EXCLUDE_FROM_ALL)
|
||||
rocprofiler_systems_restore_variables(
|
||||
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)
|
||||
@@ -617,7 +617,7 @@ else()
|
||||
INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${DYNINST_HEADER_DIR}
|
||||
)
|
||||
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-dyninst
|
||||
INTERFACE ROCPROFSYS_USE_DYNINST
|
||||
INTERFACE ROCPROFSYS_USE_DYNINST
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -683,6 +683,16 @@ include(SQLite3)
|
||||
|
||||
include(NlohmannJson)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# GTest
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
if(ROCPROFSYS_BUILD_TESTING)
|
||||
include(GTest)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# ELFIO
|
||||
@@ -729,13 +739,13 @@ target_compile_definitions(
|
||||
|
||||
if(ROCPROFSYS_BUILD_STACK_PROTECTOR)
|
||||
add_target_flag_if_avail(rocprofiler-systems-timemory-config
|
||||
"-fstack-protector-strong" "-Wstack-protector"
|
||||
"-fstack-protector-strong" "-Wstack-protector"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ROCPROFSYS_BUILD_DEBUG)
|
||||
add_target_flag_if_avail(rocprofiler-systems-timemory-config
|
||||
"-fno-omit-frame-pointer" "-g3"
|
||||
"-fno-omit-frame-pointer" "-g3"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -864,7 +874,7 @@ rocprofiler_systems_checkout_git_submodule(
|
||||
|
||||
rocprofiler_systems_save_variables(
|
||||
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
|
||||
@@ -898,7 +908,7 @@ endif()
|
||||
|
||||
rocprofiler_systems_restore_variables(
|
||||
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)
|
||||
@@ -936,7 +946,7 @@ target_link_libraries(
|
||||
|
||||
if(ROCPROFSYS_USE_BFD)
|
||||
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-bfd
|
||||
INTERFACE ROCPROFSYS_USE_BFD
|
||||
INTERFACE ROCPROFSYS_USE_BFD
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -972,8 +982,8 @@ if(NOT TARGET PTL::ptl-shared)
|
||||
rocprofiler_systems_save_variables(
|
||||
BUILD_CONFIG
|
||||
VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS
|
||||
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
|
||||
CMAKE_VISIBILITY_INLINES_HIDDEN
|
||||
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
|
||||
CMAKE_VISIBILITY_INLINES_HIDDEN
|
||||
)
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
@@ -988,8 +998,8 @@ if(NOT TARGET PTL::ptl-shared)
|
||||
rocprofiler_systems_restore_variables(
|
||||
BUILD_CONFIG
|
||||
VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS
|
||||
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
|
||||
CMAKE_VISIBILITY_INLINES_HIDDEN
|
||||
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
|
||||
CMAKE_VISIBILITY_INLINES_HIDDEN
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -1016,7 +1026,7 @@ include(Compilers)
|
||||
if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
rocprofiler_systems_restore_variables(STATIC_LIBSTDCXX_CXX
|
||||
VARIABLES CMAKE_CXX_FLAGS
|
||||
VARIABLES CMAKE_CXX_FLAGS
|
||||
)
|
||||
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(bin)
|
||||
|
||||
if(ROCPROFSYS_BUILD_TESTING)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
if(ROCPROFSYS_USE_PYTHON)
|
||||
add_subdirectory(python)
|
||||
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)
|
||||
|
||||
# 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-instrument-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}
|
||||
)
|
||||
Reference in New Issue
Block a user