파일
rocm-systems/tests/common/CMakeLists.txt
T
Madsen, Jonathan 640ca55ac0 [CI] Testing stability (#486)
* [CI] Testing Stability

- CMake option ROCPROFILER_DISABLE_UNSTABLE_CTESTS
  - used for tests which periodically fail around 1 out of every 10 runs
  - set to ON while instability remains, this needs to set to OFF in ROCm 7.1 or, ideally, ROCm 7.0.1
- Use FIXTURES_SETUP and FIXTURES_REQUIRED for some tests
- replace "threw an exception" with "${ROCPROFILER_DEFAULT_FAIL_REGEX}" for misc FAIL_REGULAR_EXPRESSIONS

* Remove contents of all EXCLUDE_{TESTS,LABEL}_REGEX from CI workflow

* Disable patch git step in code-coverage run

* Tweak spin time of reproducible runtime

* Removed patch git step in code-coverage run

* Update ROCPROFILER_DEFAULT_FAIL_REGEX

* Mark test-counter-collection tests as unstable

- add fixtures setup/required

* Remove ATTACHED_FILES_ON_FAIL

- CDash doesn't store enable downloading these properly anyway

* Relax collection-period fuzzing window

* Disable unstable collection-period test

- too unstable

* formatting

* Disable unstable device_counting_service_test.async_counters

* Suppress perfetto internal data race errors

* Switch code-coverage CI jobs to mi300 runner

* Timeout increases

* rocprofv3-test-rocpd updates

- add fixtures
- switch executable
- redefine input/output paths

* Revert code-coverage job to mi300a runner

* Update rocprofv3-test-rocpd-execute-multiproc

- reduce problem size

* disable multiproc rocpd

* Split code-coverage into separate workflow

- network issues cause this job to fail frequently
- when in a separate workflow, it can be restarted easily

* Fixtures for rocprofv3-test-trace-hip-in-libraries

* Disable unstable device_counting_service_test.sync_counters

* Potential fix for code scanning alert no. 171: Workflow does not contain permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Switch code-coverage to run on rocprof-azure

- mi300a EMU runner set is unstable (network issues)

* tests/rocprofv3/pc-sampling SKIP_REGULAR_EXPRESSION

* Update rocprofv3-test-list-avail-trace-execute

- reduce log level and increase timeout

* rocprofv3: Prevent recursive call to rocprofv3_error_signal_handler + log chaining

* rocprofv3: Use ROCP_ERROR + std::exit instead of ROCP_FATAL

- should help with SKIP_REGULAR_EXPRESSION

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-06-30 15:07:37 -05:00

183 라인
6.5 KiB
CMake

#
# common utilities for tests
#
include(FetchContent)
include(CMakeParseArguments)
set(FETCHCONTENT_BASE_DIR ${PROJECT_BINARY_DIR}/external)
# default FAIL_REGULAR_EXPRESSION for tests
set(ROCPROFILER_DEFAULT_FAIL_REGEX
"threw an exception|Permission denied|Could not create logging file|failed with error code|Subprocess aborted"
CACHE INTERNAL "Default FAIL_REGULAR_EXPRESSION for tests")
set(DEFAULT_GPU_TARGETS
"gfx900"
"gfx906"
"gfx908"
"gfx90a"
"gfx942"
"gfx950"
"gfx1030"
"gfx1010"
"gfx1100"
"gfx1101"
"gfx1102")
set(GPU_TARGETS
"${DEFAULT_GPU_TARGETS}"
CACHE STRING "GPU targets to compile for")
set(AMDGPU_TARGETS
"${GPU_TARGETS}"
CACHE STRING
"GPU targets to compile for AMDGPUs (update GPU_TARGETS, not this variable)"
FORCE)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
cmake_policy(SET CMP0135 NEW)
endif()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.30)
cmake_policy(SET CMP0167 NEW)
cmake_policy(SET CMP0169 OLD)
endif()
find_package(rocprofiler-sdk REQUIRED)
# rocprofiler-sdk provides a Findlibdw.cmake
find_package(libdw REQUIRED)
# build flags
add_library(rocprofiler-sdk-tests-build-flags INTERFACE)
add_library(rocprofiler-sdk::tests-build-flags ALIAS rocprofiler-sdk-tests-build-flags)
target_compile_options(rocprofiler-sdk-tests-build-flags INTERFACE -W -Wall -Wextra
-Wshadow)
target_compile_features(rocprofiler-sdk-tests-build-flags INTERFACE cxx_std_17)
if(ROCPROFILER_BUILD_CI OR ROCPROFILER_BUILD_WERROR)
target_compile_options(rocprofiler-sdk-tests-build-flags INTERFACE -Werror)
endif()
# serialization library
if(NOT TARGET rocprofiler-sdk::rocprofiler-sdk-cereal)
get_filename_component(ROCPROFILER_SOURCE_DIR "${PROJECT_SOURCE_DIR}/.." REALPATH)
add_library(rocprofiler-sdk-cereal INTERFACE)
add_library(rocprofiler-sdk::rocprofiler-sdk-cereal ALIAS rocprofiler-sdk-cereal)
target_compile_definitions(rocprofiler-sdk-cereal
INTERFACE $<BUILD_INTERFACE:CEREAL_THREAD_SAFE=1>)
if(EXISTS ${ROCPROFILER_SOURCE_DIR}/external AND COMMAND
rocprofiler_checkout_git_submodule)
rocprofiler_checkout_git_submodule(
RECURSIVE
RELATIVE_PATH external/cereal
WORKING_DIRECTORY ${ROCPROFILER_SOURCE_DIR}
REPO_URL https://github.com/jrmadsen/cereal.git
REPO_BRANCH "rocprofiler")
target_include_directories(
rocprofiler-sdk-cereal SYSTEM
INTERFACE $<BUILD_INTERFACE:${ROCPROFILER_SOURCE_DIR}/external/cereal/include>
)
else()
fetchcontent_declare(
cereal
GIT_REPOSITORY https://github.com/jrmadsen/cereal.git
GIT_TAG rocprofiler
SOURCE_DIR ${PROJECT_BINARY_DIR}/external/cereal BINARY_DIR
${PROJECT_BINARY_DIR}/external/build/cereal-build SUBBUILD_DIR
${PROJECT_BINARY_DIR}/external/build/cereal-subdir)
fetchcontent_getproperties(cereal)
if(NOT cereal_POPULATED)
fetchcontent_populate(cereal)
endif()
target_include_directories(
rocprofiler-sdk-cereal SYSTEM
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/cereal/include>)
endif()
endif()
if(NOT TARGET rocprofiler-sdk::rocprofiler-sdk-perfetto)
# perfetto
fetchcontent_declare(
perfetto
GIT_REPOSITORY https://github.com/google/perfetto
GIT_TAG v44.0
SOURCE_DIR ${PROJECT_BINARY_DIR}/external/perfetto BINARY_DIR
${PROJECT_BINARY_DIR}/external/build/perfetto-build SUBBUILD_DIR
${PROJECT_BINARY_DIR}/external/build/perfetto-subdir)
fetchcontent_getproperties(perfetto)
if(NOT perfetto_POPULATED)
fetchcontent_populate(perfetto)
endif()
add_library(rocprofiler-sdk-tests-perfetto STATIC)
add_library(rocprofiler-sdk::tests-perfetto ALIAS rocprofiler-sdk-tests-perfetto)
target_sources(
rocprofiler-sdk-tests-perfetto
PRIVATE ${PROJECT_BINARY_DIR}/external/perfetto/sdk/perfetto.h
${PROJECT_BINARY_DIR}/external/perfetto/sdk/perfetto.cc)
target_include_directories(
rocprofiler-sdk-tests-perfetto SYSTEM
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/perfetto/sdk>)
set_target_properties(rocprofiler-sdk-tests-perfetto
PROPERTIES POSITION_INDEPENDENT_CODE ON)
else()
add_library(rocprofiler-sdk-tests-perfetto INTERFACE)
add_library(rocprofiler-sdk::tests-perfetto ALIAS rocprofiler-sdk-tests-perfetto)
target_link_libraries(rocprofiler-sdk-tests-perfetto
INTERFACE rocprofiler-sdk::rocprofiler-sdk-perfetto)
endif()
# common utilities
cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH COMMON_LIBRARY_INCLUDE_DIR)
add_library(rocprofiler-sdk-tests-common-library INTERFACE)
add_library(rocprofiler-sdk::tests-common-library ALIAS
rocprofiler-sdk-tests-common-library)
target_link_libraries(
rocprofiler-sdk-tests-common-library
INTERFACE rocprofiler-sdk::tests-build-flags rocprofiler-sdk::rocprofiler-sdk-cereal
libdw::libdw)
target_compile_features(rocprofiler-sdk-tests-common-library INTERFACE cxx_std_17)
target_include_directories(rocprofiler-sdk-tests-common-library
INTERFACE ${COMMON_LIBRARY_INCLUDE_DIR})
set(EXTERNAL_SUBMODULE_DIR "${PROJECT_SOURCE_DIR}/../external")
cmake_path(ABSOLUTE_PATH EXTERNAL_SUBMODULE_DIR NORMALIZE)
if(EXISTS ${EXTERNAL_SUBMODULE_DIR}/filesystem/include/ghc/filesystem.hpp)
target_compile_definitions(
rocprofiler-sdk-tests-common-library
INTERFACE $<BUILD_INTERFACE:ROCPROFILER_SAMPLES_HAS_GHC_LIB_FILESYSTEM=1>)
target_include_directories(
rocprofiler-sdk-tests-common-library SYSTEM
INTERFACE $<BUILD_INTERFACE:${EXTERNAL_SUBMODULE_DIR}/filesystem/include>)
endif()
function(rocprofiler_configure_pytest_files)
cmake_parse_arguments(RCPF "" "OUTPUT_DIRECTORY" "COPY;CONFIG" ${ARGN})
if(NOT RCPF_OUTPUT_DIRECTORY)
set(RCPF_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
foreach(FILENAME ${RCPF_COPY})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}
${RCPF_OUTPUT_DIRECTORY}/${FILENAME} COPYONLY)
endforeach()
foreach(FILENAME ${RCPF_CONFIG})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}
${RCPF_OUTPUT_DIRECTORY}/${FILENAME} @ONLY)
endforeach()
endfunction()