From a2288eb50bd805e5d6d7dfa98834972083e4356a Mon Sep 17 00:00:00 2001 From: "Jonathan R. Madsen" Date: Fri, 21 Nov 2025 08:06:56 -0600 Subject: [PATCH] [rocprofiler-sdk] Install unit tests and helper functions for integration tests (#921) * [rocprofiler-sdk] Install unit tests and helper functions for integration tests * Fix rocprofiler-sdk-tests-target export * Fix handling of cmake policy CMP0174 * Remove -vv from new pytest.ini files * add unit tests and integration tests. * add path to ci workflow. * misc. fixes. * pc sampling tests. * bug fixes. * pc sampling tests fix. * misc. * Update CMakeLists.txt * Update rocprofiler_config_install_tests.cmake, correct license name * fix units tests install issues. * fix counters_def file path. * fix bug, arg shifting. * vendor pytest-cmake. * cmake config fix. missing endfunction() * disable tests, 1.rocprofv3-trace-hip-libs. 2.kernel-tracing. 3.external_correlation 4.rocpd. * disable buffered-tracing test and remove pytest-cmake from requirements.txt. * disable hip-graph-tracing test. * fix building standalone tests to load rocprofiler-sdk cmake package first and then find rocprofiler_sdk_pytest module. * addressed comments: 1.add local bin path to code cov workflow. 2.add to cmake prefix path local bin. 3.use ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE 4.misc. fix * enabled back tests api_buffered, external_correlation_id, hip-graph, kernel-tracing, rocpd, tracing-hip-in-libraries. and misc fixes(formating, extra fixtures for agent-index tests.) * cpack to use llvm bin for .hsaco debug symbols. * psdb tests fixes. * EOL. * misc. fixes and Disable api_buffered_tracing, external_correlation_id, hip-graph-tracing, kernel-tracing, rocpd, summary, tracing-hip-libraries, tracing-plus-counter-collection. * fix incorrect cmakelists file. * strip smallkernel.bin * format. * revert disabled tests commit. * misc. fix in counter tests. * misc. * search codeobj unit test assets in curr bin and install bin. * refactor newly added rocpd tests. * modify tests for newly added hip-host-tracing. * add LD LIB path to units, psdb is failing due to libs not being found. --------- Co-authored-by: Venkateshwar Reddy Kandula Co-authored-by: Venkateshwar Reddy Kandula Co-authored-by: JeniferC99 <150404595+JeniferC99@users.noreply.github.com> --- .../rocprofiler-sdk-code_coverage.yml | 6 +- ...rocprofiler-sdk-continuous_integration.yml | 9 +- projects/rocprofiler-sdk/.cmake-format.yaml | 101 ++++ projects/rocprofiler-sdk/CMakeLists.txt | 2 + .../Modules/Findrocprofiler_sdk_pytest.cmake | 150 +++++ .../rocprofiler_sdk_PytestAddTests.cmake | 169 ++++++ .../rocprofiler-sdk-tests/config.cmake.in | 47 ++ .../cmake/Templates/unit-test.cmake.in | 55 ++ .../cmake/rocprofiler_config_install.cmake | 8 +- .../rocprofiler_config_install_tests.cmake | 71 +++ .../cmake/rocprofiler_config_interfaces.cmake | 2 + .../cmake/rocprofiler_config_packaging.cmake | 33 + .../cmake/rocprofiler_utilities.cmake | 139 +++++ .../lib/att-tool/waitcnt/tests/CMakeLists.txt | 20 +- .../rocprofiler-sdk/aql/tests/CMakeLists.txt | 22 +- .../lib/rocprofiler-sdk/counters/metrics.cpp | 34 +- .../counters/parser/tests/CMakeLists.txt | 18 +- .../counters/tests/CMakeLists.txt | 88 +-- .../rocprofiler-sdk/kfd/tests/CMakeLists.txt | 16 +- .../pc_sampling/parser/tests/CMakeLists.txt | 55 +- .../pc_sampling/tests/CMakeLists.txt | 18 +- .../lib/rocprofiler-sdk/tests/CMakeLists.txt | 33 +- .../thread_trace/tests/CMakeLists.txt | 17 +- .../source/lib/tests/buffering/CMakeLists.txt | 20 +- .../source/lib/tests/codeobj/CMakeLists.txt | 83 ++- .../tests/codeobj/codeobj_library_test.cpp | 30 +- .../source/lib/tests/common/CMakeLists.txt | 15 +- projects/rocprofiler-sdk/tests/CMakeLists.txt | 4 + .../tests/async-copy-tracing/CMakeLists.txt | 49 +- .../tests/async-copy-tracing/pytest.ini | 2 +- .../tests/c-tool/CMakeLists.txt | 66 +- .../tests/common/CMakeLists.txt | 367 +++++++++++ .../tests/counter-collection/CMakeLists.txt | 71 +-- .../tests/counter-collection/pytest.ini | 2 +- .../tests/hip-graph-tracing/CMakeLists.txt | 53 +- .../tests/hip-graph-tracing/pytest.ini | 2 +- .../tests/hip-host-tracing/CMakeLists.txt | 66 +- .../tests/hip-host-tracing/pytest.ini | 2 +- .../hsa-memory-allocation/CMakeLists.txt | 50 +- .../tests/hsa-memory-allocation/pytest.ini | 2 +- .../tests/kernel-tracing/CMakeLists.txt | 67 +- .../tests/kernel-tracing/pytest.ini | 2 +- .../tests/openmp-tools/CMakeLists.txt | 62 +- .../tests/openmp-tools/pytest.ini | 2 +- .../tests/pc_sampling/CMakeLists.txt | 26 +- .../tests/python-bindings/CMakeLists.txt | 63 +- .../tests/python-bindings/pytest.ini | 2 +- .../tests/rocdecode/CMakeLists.txt | 70 +-- .../tests/rocdecode/pytest.ini | 2 +- .../tests/rocjpeg/CMakeLists.txt | 62 +- .../rocprofiler-sdk/tests/rocjpeg/pytest.ini | 2 +- .../tests/rocpd/CMakeLists.txt | 28 +- .../tests/rocprofv3-avail/CMakeLists.txt | 111 ++-- .../tests/rocprofv3-avail/pytest.ini | 2 +- .../rocprofv3/aborted-app/CMakeLists.txt | 69 +-- .../tests/rocprofv3/aborted-app/pytest.ini | 2 +- .../advanced-thread-trace/CMakeLists.txt | 285 +++++---- .../advanced-thread-trace/pytest.ini | 2 +- .../rocprofv3/agent-index/CMakeLists.txt | 174 +++--- .../tests/rocprofv3/agent-index/pytest.ini | 2 +- .../att-consecutive-kernels/CMakeLists.txt | 43 +- .../att-consecutive-kernels/pytest.ini | 2 +- .../attachment/attach-once/CMakeLists.txt | 126 ++-- .../attachment/attach-once/pytest.ini | 2 +- .../attachment/attach-twice/CMakeLists.txt | 128 ++-- .../attachment/attach-twice/pytest.ini | 2 +- .../collection-period/CMakeLists.txt | 71 +-- .../rocprofv3/collection-period/pytest.ini | 2 +- .../conversion-script/CMakeLists.txt | 96 ++- .../rocprofv3/conversion-script/pytest.ini | 2 +- .../extra_counters/CMakeLists.txt | 53 +- .../extra_counters/pytest.ini | 2 +- .../counter-collection/input1/CMakeLists.txt | 50 +- .../counter-collection/input1/pytest.ini | 2 +- .../counter-collection/input2/CMakeLists.txt | 60 +- .../counter-collection/input2/pytest.ini | 2 +- .../counter-collection/input3/CMakeLists.txt | 110 ++-- .../counter-collection/input3/pytest.ini | 2 +- .../kernel_filtering/CMakeLists.txt | 189 +++--- .../kernel_filtering/pytest.ini | 2 +- .../list_metrics/CMakeLists.txt | 76 ++- .../list_metrics/pytest.ini | 2 +- .../multiplex/CMakeLists.txt | 120 ++-- .../counter-collection/multiplex/pytest.ini | 2 +- .../range_filtering/CMakeLists.txt | 59 +- .../range_filtering/pytest.ini | 2 +- .../hip-stream-display/CMakeLists.txt | 67 +- .../rocprofv3/hip-stream-display/pytest.ini | 2 +- .../hip-streams-per-thread/CMakeLists.txt | 66 +- .../hip-streams-per-thread/pytest.ini | 2 +- .../hsa-queue-dependency/CMakeLists.txt | 53 +- .../rocprofv3/hsa-queue-dependency/pytest.ini | 2 +- .../rocprofv3/kernel-rename/CMakeLists.txt | 96 ++- ...-rename.yml => input-kernel-rename.yml.in} | 0 .../tests/rocprofv3/kernel-rename/pytest.ini | 2 +- .../memory-allocation/CMakeLists.txt | 51 +- .../rocprofv3/memory-allocation/pytest.ini | 2 +- .../rocprofv3/minimum-bytes/CMakeLists.txt | 54 +- .../tests/rocprofv3/minimum-bytes/pytest.ini | 2 +- .../CMakeLists.txt | 54 +- ...t-negate-aggregate-tracing-options.yml.in} | 0 .../exec-mask-manipulation/CMakeLists.txt | 226 +++---- .../exec-mask-manipulation/conftest.py | 16 +- .../exec-mask-manipulation/pytest.ini | 2 +- .../transpose-multiple-agents/CMakeLists.txt | 238 +++----- .../transpose-multiple-agents/pytest.ini | 2 +- .../exec-mask-manipulation/CMakeLists.txt | 229 +++---- .../exec-mask-manipulation/conftest.py | 16 +- .../exec-mask-manipulation/pytest.ini | 2 +- .../transpose-multiple-agents/CMakeLists.txt | 254 ++++---- .../transpose-multiple-agents/conftest.py | 16 +- .../transpose-multiple-agents/pytest.ini | 2 +- .../rocprofv3/python-bindings/CMakeLists.txt | 69 +-- .../rocprofv3/python-bindings/pytest.ini | 2 +- .../rocprofv3/rocdecode-trace/CMakeLists.txt | 66 +- .../rocprofv3/rocdecode-trace/pytest.ini | 2 +- .../rocprofv3/rocjpeg-trace/CMakeLists.txt | 65 +- .../tests/rocprofv3/rocjpeg-trace/pytest.ini | 2 +- .../rocpd-kernel-rename/CMakeLists.txt | 159 ++--- .../rocprofv3/rocpd-kernel-rename/pytest.ini | 2 +- .../rocprofv3/rocpd-scratch/CMakeLists.txt | 90 +-- .../tests/rocprofv3/rocpd-scratch/pytest.ini | 2 +- .../tests/rocprofv3/rocpd/CMakeLists.txt | 572 +++++++----------- .../tests/rocprofv3/rocpd/pytest.ini | 2 +- .../rocprofv3/roctracer-roctx/CMakeLists.txt | 60 +- .../rocprofv3/roctracer-roctx/pytest.ini | 2 +- ...input.yml => roctracer-roctx-input.yml.in} | 0 .../rocprofv3/scratch-memory/CMakeLists.txt | 67 +- .../tests/rocprofv3/scratch-memory/pytest.ini | 2 +- .../tests/rocprofv3/summary/CMakeLists.txt | 107 ++-- ...nput-summary.yaml => input-summary.yml.in} | 0 .../tests/rocprofv3/summary/pytest.ini | 2 +- .../tracing-hip-in-libraries/CMakeLists.txt | 105 ++-- .../tracing-hip-in-libraries/pytest.ini | 2 +- .../CMakeLists.txt | 118 ++-- .../pytest.ini | 2 +- .../tests/rocprofv3/tracing/CMakeLists.txt | 298 +++++---- .../tests/rocprofv3/tracing/pytest.ini | 2 +- .../scratch-memory-tracing/CMakeLists.txt | 71 +-- .../tests/scratch-memory-tracing/pytest.ini | 2 +- .../tests/thread-trace/CMakeLists.txt | 104 +--- .../rocprofiler-sdk/tests/tools/json-tool.cpp | 11 +- .../tests/unit-tests/CMakeLists.txt | 15 + 143 files changed, 3964 insertions(+), 3734 deletions(-) create mode 100644 projects/rocprofiler-sdk/cmake/Modules/Findrocprofiler_sdk_pytest.cmake create mode 100644 projects/rocprofiler-sdk/cmake/Modules/rocprofiler_sdk_PytestAddTests.cmake create mode 100644 projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-tests/config.cmake.in create mode 100644 projects/rocprofiler-sdk/cmake/Templates/unit-test.cmake.in create mode 100644 projects/rocprofiler-sdk/cmake/rocprofiler_config_install_tests.cmake rename projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/{input-kernel-rename.yml => input-kernel-rename.yml.in} (100%) rename projects/rocprofiler-sdk/tests/rocprofv3/negate-aggregate-tracing-options/{input-negate-aggregate-tracing-options.yml => input-negate-aggregate-tracing-options.yml.in} (100%) rename projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/{roctracer-roctx-input.yml => roctracer-roctx-input.yml.in} (100%) rename projects/rocprofiler-sdk/tests/rocprofv3/summary/{input-summary.yaml => input-summary.yml.in} (100%) create mode 100644 projects/rocprofiler-sdk/tests/unit-tests/CMakeLists.txt diff --git a/.github/workflows/rocprofiler-sdk-code_coverage.yml b/.github/workflows/rocprofiler-sdk-code_coverage.yml index ca85674e13..a406e2e5fe 100644 --- a/.github/workflows/rocprofiler-sdk-code_coverage.yml +++ b/.github/workflows/rocprofiler-sdk-code_coverage.yml @@ -333,7 +333,7 @@ jobs: working-directory: projects/rocprofiler-sdk run: LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH - PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH + PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH python3 ./source/scripts/run-ci.py -B build --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov --build-jobs 16 @@ -357,7 +357,7 @@ jobs: run: find build -type f | egrep '\.gcda$' | xargs rm && LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH - PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH + PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH python3 ./source/scripts/run-ci.py -B build --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov-tests --build-jobs 16 @@ -381,7 +381,7 @@ jobs: run: find build -type f | egrep '\.gcda$' | xargs rm && LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH - PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH + PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH python3 ./source/scripts/run-ci.py -B build --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov-samples --build-jobs 16 diff --git a/.github/workflows/rocprofiler-sdk-continuous_integration.yml b/.github/workflows/rocprofiler-sdk-continuous_integration.yml index 24a3ac7a13..20b486ee02 100644 --- a/.github/workflows/rocprofiler-sdk-continuous_integration.yml +++ b/.github/workflows/rocprofiler-sdk-continuous_integration.yml @@ -312,7 +312,7 @@ jobs: working-directory: projects/rocprofiler-sdk run: | LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH \ - PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH \ + PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH \ python3 ./source/scripts/run-ci.py \ -B build \ --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-core \ @@ -359,7 +359,7 @@ jobs: working-directory: projects/rocprofiler-sdk run: | export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH - export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH + export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-samples samples CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-tests -DGPU_TARGETS="gfx942" tests export LD_LIBRARY_PATH=/opt/rocprofiler-sdk/lib:${LD_LIBRARY_PATH} @@ -375,7 +375,7 @@ jobs: working-directory: projects/rocprofiler-sdk run: | export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH - export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH + export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH export PATH=${PATH}:/usr/local/sbin:/usr/sbin:/sbin ls -la ls -la ./build @@ -390,7 +390,7 @@ jobs: working-directory: projects/rocprofiler-sdk run: | export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH - export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH + export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH CMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} cmake -B build-samples-deb ${{ env.ROCM_PATH }}/share/rocprofiler-sdk/samples CMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} cmake -B build-tests-deb -DGPU_TARGETS="gfx942" ${{ env.ROCM_PATH }}/share/rocprofiler-sdk/tests cmake --build build-samples-deb --target all --parallel 16 @@ -834,6 +834,7 @@ jobs: working-directory: projects/rocprofiler-sdk run: sudo sysctl -w vm.mmap_rnd_bits=28; + export PATH="$HOME/.local/bin:$PATH"; python3 ./source/scripts/run-ci.py -B build --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-${{ matrix.system.sanitizer }} --build-jobs 16 diff --git a/projects/rocprofiler-sdk/.cmake-format.yaml b/projects/rocprofiler-sdk/.cmake-format.yaml index 4e40836786..e970969e05 100644 --- a/projects/rocprofiler-sdk/.cmake-format.yaml +++ b/projects/rocprofiler-sdk/.cmake-format.yaml @@ -262,6 +262,107 @@ parse: DIRECTORY: '*' TARGET: '*' SOURCE: '*' + pytest_discover_tests: + flags: + - STRIP_PARAM_BRACKETS + - INCLUDE_FILE_PATH + - BUNDLE_TESTS + kwargs: + WORKING_DIRECTORY: '*' + TRIM_FROM_NAME: '*' + TRIM_FROM_FULL_NAME: '*' + TEST_PATHS: '*' + LIBRARY_PATH_PREPEND: '*' + PYTHON_PATH_PREPEND: '*' + ENVIRONMENT: '*' + DEPENDS: '*' + EXTRA_ARGS: '*' + DISCOVERY_EXTRA_ARGS: '*' + PROPERTIES: '*' + TIMEOUT: '*' + LABELS: '*' + DISABLED: '*' + FIXTURES_SETUP: '*' + FIXTURES_REQUIRED: '*' + FIXTURES_CLEANUP: '*' + DISABLED_MEMCHECKS: '*' + ATTACHED_FILES: '*' + ATTACHED_FILES_ON_FAIL: '*' + PASS_REGULAR_EXPRESSION: '*' + FAIL_REGULAR_EXPRESSION: '*' + SKIP_REGULAR_EXPRESSION: '*' + rocprofiler_add_unit_test: + flags: + - WILL_FAIL + - DISCOVER + kwargs: + TARGET: '*' + TIMEOUT: '*' + LABELS: '*' + DISABLED: '*' + TEST_LIST: '*' + TEST_PREFIX: '*' + ENVIRONMENT: '*' + PASS_REGULAR_EXPRESSION: '*' + FAIL_REGULAR_EXPRESSION: '*' + SKIP_REGULAR_EXPRESSION: '*' + SOURCES: '*' + rocprofiler_add_integration_execute_test: + flags: + - WILL_FAIL + - UNSTABLE + - DISABLED_CODECOV + kwargs: + TARGET: '*' + WORKING_DIRECTORY: '*' + DEPENDS: '*' + TIMEOUT: '*' + LABELS: '*' + DISABLED: '*' + FIXTURES_SETUP: '*' + FIXTURES_REQUIRED: '*' + FIXTURES_CLEANUP: '*' + DISABLED_MEMCHECKS: '*' + ARGS: '*' + COMMAND: '*' + ATTACHED_FILES: '*' + ATTACHED_FILES_ON_FAIL: '*' + ENVIRONMENT: '*' + PRELOAD: '*' + PASS_REGULAR_EXPRESSION: '*' + FAIL_REGULAR_EXPRESSION: '*' + SKIP_REGULAR_EXPRESSION: '*' + rocprofiler_add_integration_validate_test: + flags: + - WILL_FAIL + - UNSTABLE + - DISABLED_CODECOV + - STRIP_PARAM_BRACKETS + - INCLUDE_FILE_NAME + - BUNDLE_TESTS + kwargs: + TARGET_DEPENDS: '*' + WORKING_DIRECTORY: '*' + DEPENDS: '*' + TIMEOUT: '*' + LABELS: '*' + DISABLED: '*' + FIXTURES_SETUP: '*' + FIXTURES_REQUIRED: '*' + FIXTURES_CLEANUP: '*' + DISABLED_MEMCHECKS: '*' + TEST_PATHS: '*' + CONFIG: '*' + COPY: '*' + ARGS: '*' + DISCOVERY_ARGS: '*' + ATTACHED_FILES: '*' + ATTACHED_FILES_ON_FAIL: '*' + ENVIRONMENT: '*' + PYTHON_PATH: '*' + PASS_REGULAR_EXPRESSION: '*' + FAIL_REGULAR_EXPRESSION: '*' + SKIP_REGULAR_EXPRESSION: '*' override_spec: {} vartags: [] proptags: [] diff --git a/projects/rocprofiler-sdk/CMakeLists.txt b/projects/rocprofiler-sdk/CMakeLists.txt index d7c04dde39..5a12086ad3 100644 --- a/projects/rocprofiler-sdk/CMakeLists.txt +++ b/projects/rocprofiler-sdk/CMakeLists.txt @@ -32,6 +32,7 @@ project( set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "core") set(PACKAGE_NAME ${PROJECT_NAME}) +string(REPLACE "-" "_" PACKAGE_NAME_UNDERSCORED ${PACKAGE_NAME}) if(NOT PROJECT_IS_TOP_LEVEL) set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ") @@ -120,6 +121,7 @@ add_subdirectory(source) include(rocprofiler_config_install) include(rocprofiler_config_install_roctx) include(rocprofiler_config_install_rocpd) +include(rocprofiler_config_install_tests) if(ROCPROFILER_BUILD_TESTS) add_subdirectory(tests) diff --git a/projects/rocprofiler-sdk/cmake/Modules/Findrocprofiler_sdk_pytest.cmake b/projects/rocprofiler-sdk/cmake/Modules/Findrocprofiler_sdk_pytest.cmake new file mode 100644 index 0000000000..9ec7614aa7 --- /dev/null +++ b/projects/rocprofiler-sdk/cmake/Modules/Findrocprofiler_sdk_pytest.cmake @@ -0,0 +1,150 @@ +# Vendor pytest-cmake module. +# Discover required rocprofiler_sdk_pytest target. +# +# This module defines the following imported targets: +# rocprofiler_sdk_pytest::Pytest +# +# It also exposes the 'rocprofiler_sdk_pytest_discover_tests' function, which adds CTest +# test for each Pytest test. The "BUNDLE_PYTHON_TESTS" environment variable +# can be used to run all discovered tests together. +# +# Usage: +# find_package(rocprofiler_sdk_pytest) +# find_package(rocprofiler_sdk_pytest REQUIRED) +# +# Note: +# The Pytest_ROOT environment variable or CMake variable can be used to +# prepend a custom search path. +# (https://cmake.org/cmake/help/latest/policy/CMP0074.html) + +cmake_minimum_required(VERSION 3.20...4.1) + +include(FindPackageHandleStandardArgs) + +find_program(ROCPSDK_PYTEST_EXECUTABLE NAMES pytest) +mark_as_advanced(ROCPSDK_PYTEST_EXECUTABLE) + +if(ROCPSDK_PYTEST_EXECUTABLE) + execute_process( + COMMAND "${ROCPSDK_PYTEST_EXECUTABLE}" --version + OUTPUT_VARIABLE _version + ERROR_VARIABLE _version + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(_version MATCHES "pytest (version )?([0-9]+\\.[0-9]+\\.[0-9]+)") + set(PYTEST_VERSION "${CMAKE_MATCH_2}") + endif() +endif() + +find_package_handle_standard_args( + rocprofiler_sdk_pytest + REQUIRED_VARS ROCPSDK_PYTEST_EXECUTABLE + VERSION_VAR PYTEST_VERSION + HANDLE_COMPONENTS HANDLE_VERSION_RANGE) + +if(rocprofiler_sdk_pytest_FOUND AND NOT TARGET rocprofiler_sdk_pytest::Pytest) + add_executable(rocprofiler_sdk_pytest::Pytest IMPORTED) + set_target_properties(rocprofiler_sdk_pytest::Pytest + PROPERTIES IMPORTED_LOCATION "${ROCPSDK_PYTEST_EXECUTABLE}") + + # Function to discover pytest tests and add them to CTest. + function(rocprofiler_sdk_pytest_discover_tests NAME) + set(_BOOL_ARGS STRIP_PARAM_BRACKETS INCLUDE_FILE_PATH BUNDLE_TESTS) + + set(_SINGLE_VALUE_ARGS WORKING_DIRECTORY TRIM_FROM_NAME TRIM_FROM_FULL_NAME) + + set(_MULTI_VALUE_ARGS + TEST_PATHS LIBRARY_PATH_PREPEND PYTHON_PATH_PREPEND ENVIRONMENT PROPERTIES + DEPENDS EXTRA_ARGS DISCOVERY_EXTRA_ARGS) + + cmake_parse_arguments(PARSE_ARGV 1 "" "${_BOOL_ARGS}" "${_SINGLE_VALUE_ARGS}" + "${_MULTI_VALUE_ARGS}") + + # Set platform-specific library path environment variable. + if(CMAKE_SYSTEM_NAME STREQUAL Windows) + set(LIBRARY_ENV_NAME PATH) + elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(LIBRARY_ENV_NAME DYLD_LIBRARY_PATH) + else() + set(LIBRARY_ENV_NAME LD_LIBRARY_PATH) + endif() + + # Convert paths to CMake-friendly format. + if(DEFINED ENV{${LIBRARY_ENV_NAME}}) + cmake_path(CONVERT "$ENV{${LIBRARY_ENV_NAME}}" TO_CMAKE_PATH_LIST + LIBRARY_PATH) + else() + set(LIBRARY_PATH "") + endif() + if(DEFINED ENV{PYTHONPATH}) + cmake_path(CONVERT "$ENV{PYTHONPATH}" TO_CMAKE_PATH_LIST PYTHON_PATH) + else() + set(PYTHON_PATH "") + endif() + + # Prepend specified paths to the library and Python paths. + if(_LIBRARY_PATH_PREPEND) + list(REVERSE _LIBRARY_PATH_PREPEND) + foreach(_path ${_LIBRARY_PATH_PREPEND}) + set(LIBRARY_PATH "${_path}" "${LIBRARY_PATH}") + endforeach() + endif() + + if(_PYTHON_PATH_PREPEND) + list(REVERSE _PYTHON_PATH_PREPEND) + foreach(_path ${_PYTHON_PATH_PREPEND}) + set(PYTHON_PATH "${_path}" "${PYTHON_PATH}") + endforeach() + endif() + + # Set default working directory if none is specified. + if(NOT _WORKING_DIRECTORY) + set(_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + get_filename_component(_WORKING_DIRECTORY "${_WORKING_DIRECTORY}" REALPATH) + + # Override option by environment variable if available. + if(DEFINED ENV{BUNDLE_PYTHON_TESTS}) + set(_BUNDLE_TESTS $ENV{BUNDLE_PYTHON_TESTS}) + endif() + + # Define file paths for generated CMake include files. + set(_include_file "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_include.cmake") + set(_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_tests.cmake") + + add_custom_command( + VERBATIM + OUTPUT "${_tests_file}" + DEPENDS ${_DEPENDS} + COMMAND + ${CMAKE_COMMAND} -D "PYTEST_EXECUTABLE=${ROCPSDK_PYTEST_EXECUTABLE}" -D + "TEST_PATHS=${_TEST_PATHS}" -D "TEST_GROUP_NAME=${NAME}" -D + "BUNDLE_TESTS=${_BUNDLE_TESTS}" -D "LIBRARY_ENV_NAME=${LIBRARY_ENV_NAME}" + -D "LIBRARY_PATH=${LIBRARY_PATH}" -D "PYTHON_PATH=${PYTHON_PATH}" -D + "TRIM_FROM_NAME=${_TRIM_FROM_NAME}" -D + "TRIM_FROM_FULL_NAME=${_TRIM_FROM_FULL_NAME}" -D + "STRIP_PARAM_BRACKETS=${_STRIP_PARAM_BRACKETS}" -D + "INCLUDE_FILE_PATH=${_INCLUDE_FILE_PATH}" -D + "WORKING_DIRECTORY=${_WORKING_DIRECTORY}" -D + "ENVIRONMENT=${_ENVIRONMENT}" -D "TEST_PROPERTIES=${_PROPERTIES}" -D + "CTEST_FILE=${_tests_file}" -D "EXTRA_ARGS=${_EXTRA_ARGS}" -D + "DISCOVERY_EXTRA_ARGS=${_DISCOVERY_EXTRA_ARGS}" -P + "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/rocprofiler_sdk_PytestAddTests.cmake") + + # Create a custom target to run the tests. + add_custom_target(${NAME} ALL DEPENDS ${_tests_file}) + + file(WRITE "${_include_file}" + "if(EXISTS \"${_tests_file}\")\n" " include(\"${_tests_file}\")\n" + "else()\n" " add_test(${NAME}_NOT_BUILT ${NAME}_NOT_BUILT)\n" "endif()\n") + + # Register the include file to be processed for tests. + set_property( + DIRECTORY + APPEND + PROPERTY TEST_INCLUDE_FILES "${_include_file}") + + endfunction() + +endif() diff --git a/projects/rocprofiler-sdk/cmake/Modules/rocprofiler_sdk_PytestAddTests.cmake b/projects/rocprofiler-sdk/cmake/Modules/rocprofiler_sdk_PytestAddTests.cmake new file mode 100644 index 0000000000..467fd2fed4 --- /dev/null +++ b/projects/rocprofiler-sdk/cmake/Modules/rocprofiler_sdk_PytestAddTests.cmake @@ -0,0 +1,169 @@ +# Wrapper used to create individual CTest tests from Pytest tests. +cmake_minimum_required(VERSION 3.20...4.1) + +if(CMAKE_SCRIPT_MODE_FILE) + + # Initialize content for the CMake test file. + set(_content "") + + # Convert library and Python paths to native format. + cmake_path(CONVERT "${LIBRARY_PATH}" TO_NATIVE_PATH_LIST LIBRARY_PATH) + cmake_path(CONVERT "${PYTHON_PATH}" TO_NATIVE_PATH_LIST PYTHON_PATH) + + # Serialize path values separated by semicolons (required on Windows). + string(REPLACE [[;]] [[\\;]] LIBRARY_PATH "${LIBRARY_PATH}") + string(REPLACE [[;]] [[\\;]] PYTHON_PATH "${PYTHON_PATH}") + + # Set up the encoded environment with required paths. + set(ENCODED_ENVIRONMENT "${LIBRARY_ENV_NAME}=${LIBRARY_PATH}" + "PYTHONPATH=${PYTHON_PATH}") + + # Serialize additional environment variables if any are provided. + foreach(env ${ENVIRONMENT}) + string(REPLACE [[;]] [[\\;]] env "${env}") + list(APPEND ENCODED_ENVIRONMENT "${env}") + endforeach() + + # Handle EXTRA_ARGS for individual tests + if(BUNDLE_TESTS) + list(PREPEND EXTRA_ARGS ${DISCOVERY_EXTRA_ARGS}) + endif() + + set(EXTRA_ARGS_WRAPPED) + foreach(arg IN LISTS EXTRA_ARGS) + list(APPEND EXTRA_ARGS_WRAPPED "[==[${arg}]==]") + endforeach() + list(JOIN EXTRA_ARGS_WRAPPED " " EXTRA_ARGS_STR) + + # Macro to create individual tests with optional test properties. + macro(create_test NAME IDENTIFIERS) + string(APPEND _content "add_test([==[${NAME}]==] \"${PYTEST_EXECUTABLE}\"") + + foreach(identifier ${IDENTIFIERS}) + string(APPEND _content " [==[${identifier}]==]") + endforeach() + + string(APPEND _content " ${EXTRA_ARGS_STR} )\n") + + # Prepare the properties for the test, including the environment settings. + set(args "PROPERTIES ENVIRONMENT [==[${ENCODED_ENVIRONMENT}]==]") + + # Add working directory + string(APPEND args " WORKING_DIRECTORY [==[${WORKING_DIRECTORY}]==]") + + # Append any additional properties, escaping complex characters if necessary. + foreach(property ${TEST_PROPERTIES}) + if(property MATCHES "[^-./:a-zA-Z0-9_]") + string(APPEND args " [==[${property}]==]") + else() + string(APPEND args " ${property}") + endif() + endforeach() + + # Append the test properties to the content. + string(APPEND _content "set_tests_properties([==[${NAME}]==] ${args})\n") + endmacro() + + # If tests are bundled together, create a single test group. + if(BUNDLE_TESTS) + create_test("\${TEST_GROUP_NAME}" "\${TEST_PATHS}") + + else() + # Set environment variables for collecting tests. + set(ENV{${LIBRARY_ENV_NAME}} "${LIBRARY_PATH}") + set(ENV{PYTHONPATH} "${PYTHON_PATH}") + set(ENV{PYTHONWARNINGS} "ignore") + + set(_command "${PYTEST_EXECUTABLE}" --collect-only -q + "--rootdir=${WORKING_DIRECTORY}" ${DISCOVERY_EXTRA_ARGS}) + + foreach(test_path IN LISTS TEST_PATHS) + list(APPEND _command "${test_path}") + endforeach() + + # Collect tests. + execute_process( + COMMAND ${_command} + OUTPUT_VARIABLE _output_lines + ERROR_VARIABLE _output_lines + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${WORKING_DIRECTORY}) + + # Check for errors during test collection. + string(REGEX MATCH "(=+ ERRORS =+|ERROR:).*" _error "${_output_lines}") + + if(_error) + message(${_error}) + message( + FATAL_ERROR "An error occurred during the collection of Python tests.") + endif() + + # Convert the collected output into a list of lines. + string(REPLACE [[;]] [[\;]] _output_lines "${_output_lines}") + string(REPLACE "\n" ";" _output_lines "${_output_lines}") + + # Regex pattern to identify pytest test identifiers. + set(test_pattern "([^:]+)\.py(::([^:]+))?::([^:]+)") + + # Iterate through each line to identify and process tests. + foreach(line ${_output_lines}) + string(REGEX MATCHALL ${test_pattern} matching "${line}") + + # Skip lines that are not identified as tests. + if(NOT matching) + continue() + endif() + + # Extract file, class, and function names from the test pattern. + set(_file ${CMAKE_MATCH_1}) + set(_class ${CMAKE_MATCH_3}) + set(_func ${CMAKE_MATCH_4}) + + # Optionally trim parts of the class or function name. + if(TRIM_FROM_NAME) + string(REGEX REPLACE "${TRIM_FROM_NAME}" "" _class "${_class}") + string(REGEX REPLACE "${TRIM_FROM_NAME}" "" _func "${_func}") + endif() + + # Form the test name using class and function. + if(_class) + set(test_name "${_class}.${_func}") + else() + set(test_name "${_func}") + endif() + + # Optionally strip parameter brackets from the test name. + if(STRIP_PARAM_BRACKETS) + string(REGEX REPLACE "\\[(.+)\\]$" ".\\1" test_name "${test_name}") + endif() + + # Optionally include the file path in the test name. + if(INCLUDE_FILE_PATH) + cmake_path(CONVERT "${_file}" TO_CMAKE_PATH_LIST _file) + string(REGEX REPLACE "/" "." _file "${_file}") + set(test_name "${_file}.${test_name}") + endif() + + # Optionally trim parts of the full test name. + if(TRIM_FROM_FULL_NAME) + string(REGEX REPLACE "${TRIM_FROM_FULL_NAME}" "" test_name "${test_name}") + endif() + + # Prefix the test name with the test group name. + set(test_name "${TEST_GROUP_NAME}.${test_name}") + set(test_case "${line}") + + # Create the test for CTest. + create_test("\${test_name}" "\${test_case}") + endforeach() + + # Warn if no tests were discovered. + if(NOT _content) + message(WARNING "No Python tests have been discovered.") + endif() + endif() + + # Write the generated test content to the specified CTest file. + file(WRITE ${CTEST_FILE} ${_content}) + +endif() diff --git a/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-tests/config.cmake.in b/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-tests/config.cmake.in new file mode 100644 index 0000000000..39a15168e3 --- /dev/null +++ b/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-tests/config.cmake.in @@ -0,0 +1,47 @@ +# - Config file for @PACKAGE_NAME@ and its component libraries +# It defines the following variables: +# +# @PACKAGE_NAME@_VERSION +# @PACKAGE_NAME@_BIN_DIR +# + +# prevent "target already exists" error +include_guard(DIRECTORY) + +# compute paths +get_filename_component(@PACKAGE_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + +@PACKAGE_INIT@ + +set_and_check(@PACKAGE_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +get_filename_component(@PACKAGE_NAME@_ROOT_DIR ${@PACKAGE_NAME@_INCLUDE_DIR} PATH) +set_and_check(@PACKAGE_NAME@_ROOT "${@PACKAGE_NAME@_ROOT_DIR}") + +# extra validation +foreach(_FILE @PROJECT_INCLUDE_FILES@) + set_and_check(_@PACKAGE_NAME@_INCLUDE_FILE_CHECK + "${@PACKAGE_NAME@_INCLUDE_DIR}/${_FILE}") + unset(_@PACKAGE_NAME@_INCLUDE_FILE_CHECK) +endforeach() + +include("${@PACKAGE_NAME@_CMAKE_DIR}/@PACKAGE_NAME@-targets.cmake") + +set(@PACKAGE_NAME@_TEST_FILES) + +foreach(_FILE @PROJECT_INCLUDE_FILES@) + list(APPEND @PACKAGE_NAME@_TEST_FILES "${@PACKAGE_NAME@_INCLUDE_DIR}/${_FILE}") +endforeach() + +function(@PACKAGE_NAME_UNDERSCORED@_add_tests) + foreach(_FILE ${@PACKAGE_NAME@_TEST_FILES}) + include("${_FILE}") + endforeach() +endfunction() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + @PACKAGE_NAME@ + FOUND_VAR @PACKAGE_NAME@_FOUND + VERSION_VAR @PACKAGE_NAME@_VERSION + REQUIRED_VARS @PACKAGE_NAME@_ROOT @PACKAGE_NAME@_VERSION + HANDLE_COMPONENTS HANDLE_VERSION_RANGE) diff --git a/projects/rocprofiler-sdk/cmake/Templates/unit-test.cmake.in b/projects/rocprofiler-sdk/cmake/Templates/unit-test.cmake.in new file mode 100644 index 0000000000..4034fa3d9f --- /dev/null +++ b/projects/rocprofiler-sdk/cmake/Templates/unit-test.cmake.in @@ -0,0 +1,55 @@ +# +# Unit Test for @RAUT_TARGET@ +# + +project(rocprofiler-sdk-tests-unit-tests-@RAUT_TARGET@ LANGUAGES C CXX) + +include(GoogleTest) + +set(_NAME @RAUT_TARGET@) +set(_SOURCES @RAUT_SOURCES@) +set(_LABELS @RAUT_LABELS@) +set(_FAIL_REGEX "@RAUT_FAIL_REGULAR_EXPRESSION@") +set(_PASS_REGEX "@RAUT_PASS_REGULAR_EXPRESSION@") +set(_SKIP_REGEX "@RAUT_SKIP_REGULAR_EXPRESSION@") +set(_DISABLED "@RAUT_DISABLED@") +set(_ENVIRONMENT "@RAUT_ENVIRONMENT@") +set(_PREFIX "@RAUT_TEST_PREFIX@") + +# test sources are in a subfolder +set(_TEST_SOURCES) +foreach(_FILE ${_SOURCES}) + list(APPEND _TEST_SOURCES "${CMAKE_CURRENT_LIST_DIR}/${_NAME}/${_FILE}") +endforeach() + +gtest_add_tests( + TARGET @RAUT_TARGET@ + SOURCES ${_TEST_SOURCES} + TEST_LIST @RAUT_TARGET@_TESTS + TEST_PREFIX ${_PREFIX} + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) + +set_tests_properties( + ${@RAUT_TARGET@_TESTS} + PROPERTIES TIMEOUT + @RAUT_TIMEOUT@ + LABELS + "${_LABELS}" + FAIL_REGULAR_EXPRESSION + "${_FAIL_REGEX}" + PASS_REGULAR_EXPRESSION + "${_PASS_REGEX}" + SKIP_REGULAR_EXPRESSION + "${_SKIP_REGEX}" + ENVIRONMENT + "${_ENVIRONMENT}" + DISABLED + "${_DISABLED}") + +# Disable specific tests +set(_DISABLE_TESTS "@RAUT_DISABLE_TESTS@") +if(_DISABLE_TESTS) + set_tests_properties( + ${_DISABLE_TESTS} + PROPERTIES DISABLED ON) +endif() diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_config_install.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_config_install.cmake index a40af3727a..46ddba47e2 100644 --- a/projects/rocprofiler-sdk/cmake/rocprofiler_config_install.cmake +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_config_install.cmake @@ -51,6 +51,8 @@ install( ${PROJECT_SOURCE_DIR}/cmake/Modules/Findlibdw.cmake ${PROJECT_SOURCE_DIR}/cmake/Modules/FindrocDecode.cmake ${PROJECT_SOURCE_DIR}/cmake/Modules/FindrocJPEG.cmake + ${PROJECT_SOURCE_DIR}/cmake/Modules/Findrocprofiler_sdk_pytest.cmake + ${PROJECT_SOURCE_DIR}/cmake/Modules/rocprofiler_sdk_PytestAddTests.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/Modules COMPONENT development) @@ -98,8 +100,10 @@ configure_file( ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-nolink-target.cmake COPYONLY) -foreach(_FILE rocprofiler-sdk-custom-compilation.cmake rocprofiler-sdk-utilities.cmake - Findlibdw.cmake) +foreach( + _FILE + rocprofiler-sdk-custom-compilation.cmake rocprofiler-sdk-utilities.cmake + Findlibdw.cmake Findrocprofiler_sdk_pytest.cmake rocprofiler_sdk_PytestAddTests.cmake) configure_file( ${PROJECT_SOURCE_DIR}/cmake/Modules/${_FILE} ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/Modules/${_FILE} diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_config_install_tests.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_config_install_tests.cmake new file mode 100644 index 0000000000..2a14e3fe75 --- /dev/null +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_config_install_tests.cmake @@ -0,0 +1,71 @@ +# include guard +include_guard(GLOBAL) + +include(CMakePackageConfigHelpers) + +set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME tests) +set(SDK_PACKAGE_NAME "${PROJECT_NAME}") +set(PACKAGE_NAME "${PROJECT_NAME}-tests") + +set(${PACKAGE_NAME}_BUILD_TREE + ON + CACHE BOOL "" FORCE) + +# do not install the package config if tests are not built +if(NOT ROCPROFILER_BUILD_TESTS) + return() +endif() + +install( + EXPORT ${PACKAGE_NAME}-targets + FILE ${PACKAGE_NAME}-targets.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME} + COMPONENT tests) + +rocprofiler_install_env_setup_files( + NAME ${PACKAGE_NAME} + VERSION ${PROJECT_VERSION} + INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR} + COMPONENT tests) + +# ------------------------------------------------------------------------------# +# install tree +# +set(PROJECT_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) +set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/tests/unit-tests) +string(REPLACE "-" "_" PACKAGE_NAME_UNDERSCORED ${PACKAGE_NAME}) +get_property( + _ROCP_SDK_TEST_TARGETS + DIRECTORY ${CMAKE_SOURCE_DIR} + PROPERTY rocprofiler-sdk-tests-targets) + +foreach(_TARG ${_ROCP_SDK_TEST_TARGETS}) + list(APPEND PROJECT_INCLUDE_FILES "${_TARG}.cmake") +endforeach() + +configure_package_config_file( + ${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/config.cmake.in + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME} + INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} + PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR) + +write_basic_package_version_file( + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY ExactVersion) + +install( + FILES + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME} + COMPONENT tests) + +# ------------------------------------------------------------------------------# +# build tree +# +install( + FILES ${PROJECT_SOURCE_DIR}/LICENSE.md + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PACKAGE_NAME} + COMPONENT tests) diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_config_interfaces.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_config_interfaces.cmake index 0c9e2cda18..e8079748e8 100644 --- a/projects/rocprofiler-sdk/cmake/rocprofiler_config_interfaces.cmake +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_config_interfaces.cmake @@ -23,6 +23,8 @@ target_compile_definitions( # ensure the env overrides the appending /opt/rocm later string(REPLACE ":" ";" CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH};${CMAKE_PREFIX_PATH}") +list(APPEND CMAKE_PREFIX_PATH "$ENV{HOME}/.local") + set(ROCPROFILER_DEFAULT_ROCM_PATH /opt/rocm CACHE PATH "Default search path for ROCM") diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake index 063f54928b..c44610e4ac 100644 --- a/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake @@ -248,4 +248,37 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${ROCM_VERSION_FOR_PACKAGE}" ) +# Make CPack use LLVM binutils so ELF64-AMDGPU (.hsaco) is supported +find_program( + ROCM_LLVM_OBJCOPY + NAMES llvm-objcopy + HINTS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm + PATH_SUFFIXES llvm/bin bin) +find_program( + ROCM_LLVM_OBJDUMP + NAMES llvm-objdump + HINTS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm + PATH_SUFFIXES llvm/bin bin) +find_program( + ROCM_LLVM_READELF + NAMES llvm-readelf + HINTS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm + PATH_SUFFIXES llvm/bin bin) + +if(ROCM_LLVM_OBJCOPY) + set(CPACK_OBJCOPY_EXECUTABLE + "${ROCM_LLVM_OBJCOPY}" + CACHE FILEPATH "" FORCE) +endif() +if(ROCM_LLVM_OBJDUMP) + set(CPACK_OBJDUMP_EXECUTABLE + "${ROCM_LLVM_OBJDUMP}" + CACHE FILEPATH "" FORCE) +endif() +if(ROCM_LLVM_READELF) + set(CPACK_READELF_EXECUTABLE + "${ROCM_LLVM_READELF}" + CACHE FILEPATH "" FORCE) +endif() + include(CPack) diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_utilities.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_utilities.cmake index a243913848..e542c68aa8 100644 --- a/projects/rocprofiler-sdk/cmake/rocprofiler_utilities.cmake +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_utilities.cmake @@ -1037,6 +1037,145 @@ function(rocprofiler_install_env_setup_files) endfunction() # ---------------------------------------------------------------------------- +# Adds a unit test subdirectory +# + +function(rocprofiler_add_unit_test) + cmake_policy(PUSH) + if(POLICY CMP0174) + cmake_policy(SET CMP0174 OLD) + endif() + + # parse args + set(_FLAG_OPTS) + set(_SINGLE_OPTS + "TARGET" + "TEST_LIST" + "TEST_PREFIX" + "TIMEOUT" + "LABELS" + "DISABLED" + "PASS_REGULAR_EXPRESSION" + "FAIL_REGULAR_EXPRESSION" + "SKIP_REGULAR_EXPRESSION") + set(_MULTI_OPTS "SOURCES" "ENVIRONMENT" "DISABLE_TESTS") + + cmake_parse_arguments(RAUT "${_FLAG_OPTS}" "${_SINGLE_OPTS}" "${_MULTI_OPTS}" ${ARGN}) + + include(GoogleTest) + + macro(set_arg_if_empty _VAR) + if(NOT ${_VAR}) + set(${_VAR} ${ARGN}) + endif() + endmacro() + + foreach(_VAR TARGET SOURCES) + if(NOT RAUT_${_VAR}) + message( + FATAL_ERROR "rocprofiler_add_unit_test missing required argument: ${_VAR}" + ) + endif() + endforeach() + + set_arg_if_empty(RAUT_TIMEOUT 45) + set_arg_if_empty(RAUT_LABELS "unittests") + set_arg_if_empty(RAUT_TEST_LIST "${RAUT_TARGET}_TESTS") + set_arg_if_empty(RAUT_FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + set_arg_if_empty(RAUT_DISABLED "OFF") + set_arg_if_empty(RAUT_TEST_PREFIX "unit.") + + set(_DISABLE_TESTS_SOURCE "") + if(RAUT_DISABLE_TESTS) + foreach(_TEST ${RAUT_DISABLE_TESTS}) + list(APPEND _DISABLE_TESTS_SOURCE "${RAUT_TEST_PREFIX}${_TEST}") + endforeach() + endif() + + if(NOT "unittests" IN_LIST RAUT_LABELS) + list(APPEND RAUT_LABELS "unittests") + endif() + + gtest_add_tests( + TARGET ${RAUT_TARGET} + SOURCES ${RAUT_SOURCES} + TEST_LIST ${RAUT_TEST_LIST} + TEST_PREFIX ${RAUT_TEST_PREFIX} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + set_tests_properties( + ${${RAUT_TEST_LIST}} + PROPERTIES TIMEOUT + ${RAUT_TIMEOUT} + LABELS + "${RAUT_LABELS}" + FAIL_REGULAR_EXPRESSION + "${RAUT_FAIL_REGULAR_EXPRESSION}" + PASS_REGULAR_EXPRESSION + "${RAUT_PASS_REGULAR_EXPRESSION}" + SKIP_REGULAR_EXPRESSION + "${RAUT_SKIP_REGULAR_EXPRESSION}" + ENVIRONMENT + "${RAUT_ENVIRONMENT}" + DISABLED + ${RAUT_DISABLED}) + + if(_DISABLE_TESTS_SOURCE) + set_tests_properties(${_DISABLE_TESTS_SOURCE} PROPERTIES DISABLED ON) + endif() + + install( + TARGETS ${RAUT_TARGET} + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests/unit-tests/bin + COMPONENT tests + EXPORT rocprofiler-sdk-tests-targets) + + get_property( + _ROCP_SDK_TEST_TARGETS + DIRECTORY ${CMAKE_SOURCE_DIR} + PROPERTY rocprofiler-sdk-tests-targets) + + if(RAUT_TARGET IN_LIST _ROCP_SDK_TEST_TARGETS) + message( + FATAL_ERROR + "Target ${RAUT_TARGET} already exists in rocprofiler-sdk-tests-targets") + endif() + + set_property( + DIRECTORY ${CMAKE_SOURCE_DIR} + APPEND + PROPERTY rocprofiler-sdk-tests-targets ${RAUT_TARGET}) + + string(REPLACE "-" "_" _PACKAGE_NAME_UNDERSCORED "${CMAKE_PROJECT_NAME}") + set(RAUT_TEST_PREFIX "${_PACKAGE_NAME_UNDERSCORED}.${RAUT_TEST_PREFIX}") + + set(_DISABLE_TESTS_INSTALLED "") + if(RAUT_DISABLE_TESTS) + foreach(_TEST ${RAUT_DISABLE_TESTS}) + list(APPEND _DISABLE_TESTS_INSTALLED "${RAUT_TEST_PREFIX}${_TEST}") + endforeach() + endif() + set(RAUT_DISABLE_TESTS "${_DISABLE_TESTS_INSTALLED}") + + configure_file( + ${CMAKE_SOURCE_DIR}/cmake/Templates/unit-test.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests/unit-tests/${RAUT_TARGET}.cmake + @ONLY) + + install( + FILES ${RAUT_SOURCES} + DESTINATION + ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests/unit-tests/${RAUT_TARGET} + COMPONENT tests) + + install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests/unit-tests/${RAUT_TARGET}.cmake + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests/unit-tests + COMPONENT tests) + + cmake_policy(POP) +endfunction() # gets the user local python bin directory from `python3 -m pip install --user ...` # function(_rocprofiler_get_python_user_bin _OUT) diff --git a/projects/rocprofiler-sdk/source/lib/att-tool/waitcnt/tests/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/att-tool/waitcnt/tests/CMakeLists.txt index 8a13e80cbe..4cc800600e 100644 --- a/projects/rocprofiler-sdk/source/lib/att-tool/waitcnt/tests/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/att-tool/waitcnt/tests/CMakeLists.txt @@ -2,7 +2,14 @@ # Waitcnt ISA tests # +project(rocprofiler-sdk-tests-att-decoder-waitcnt LANGUAGES C CXX) + +include(GoogleTest) + +set(waitcnt_sources att_decoder_waitcnt_test.cpp) + add_executable(att-decoder-waitcnt-test) +target_sources(att-decoder-waitcnt-test PRIVATE ${waitcnt_sources}) target_link_libraries( att-decoder-waitcnt-test PRIVATE rocprofiler-sdk::rocprofiler-sdk-att-parser @@ -12,12 +19,11 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest GTest::gtest_main) -target_sources(att-decoder-waitcnt-test PRIVATE att_decoder_waitcnt_test.cpp) -gtest_add_tests( +rocprofiler_add_unit_test( TARGET att-decoder-waitcnt-test - SOURCES att_decoder_waitcnt_test.cpp - TEST_LIST att-decoder-waitcnt-test_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -set_tests_properties(${att-decoder-waitcnt-test_TESTS} PROPERTIES TIMEOUT 10 LABELS - "unittests") + SOURCES ${waitcnt_sources} + TIMEOUT 10 + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + ) diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/aql/tests/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/aql/tests/CMakeLists.txt index 7fb65a599c..80688cbb78 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/aql/tests/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/aql/tests/CMakeLists.txt @@ -1,13 +1,13 @@ rocprofiler_deactivate_clang_tidy() +project(rocprofiler-sdk-unit-tests-aql LANGUAGES C CXX) + include(GoogleTest) -set(ROCPROFILER_LIB_AQL_TEST_SOURCES "aql_test.cpp" "helpers.cpp") +set(ROCPROFILER_LIB_AQL_TEST_SOURCES aql_test.cpp helpers.cpp) add_executable(aql-test) - target_sources(aql-test PRIVATE ${ROCPROFILER_LIB_AQL_TEST_SOURCES}) - target_link_libraries( aql-test PRIVATE rocprofiler-sdk::counter-test-constants @@ -19,12 +19,14 @@ target_link_libraries( GTest::gtest GTest::gtest_main) -gtest_add_tests( +set(_ROCPROFILER_SHARE_DIR + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}") + +rocprofiler_add_unit_test( TARGET aql-test SOURCES ${ROCPROFILER_LIB_AQL_TEST_SOURCES} - TEST_LIST aql-test_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${aql-test_TESTS} PROPERTIES TIMEOUT 45 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + TIMEOUT 45 + ENVIRONMENT + "ROCPROFILER_METRICS_PATH=${_ROCPROFILER_SHARE_DIR}" + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/metrics.cpp b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/metrics.cpp index bbea0ab61f..e382f24eab 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/metrics.cpp +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/metrics.cpp @@ -261,15 +261,35 @@ findViaInstallPath(const std::string& filename) } std::string -findViaEnvironment(const std::string& filename) +locateMetricsFile(std::string_view name) { - if(const char* metrics_path = nullptr; (metrics_path = getenv("ROCPROFILER_METRICS_PATH"))) + namespace fs = common::filesystem; + + // 1) Try env var + if(const char* env = std::getenv("ROCPROFILER_METRICS_PATH")) { - ROCP_INFO << filename << " is being looked up via env variable ROCPROFILER_METRICS_PATH"; - return common::filesystem::path{std::string{metrics_path}} / filename; + fs::path candidate = fs::path{env} / std::string{name}; + if(fs::exists(candidate)) + { + ROCP_INFO << name << " found via ROCPROFILER_METRICS_PATH: " << candidate.string(); + return candidate.string(); + } + ROCP_WARNING << name << " not found at ROCPROFILER_METRICS_PATH (" << env + << "). Falling back to install path."; } - // No environment variable, lookup via install path - return findViaInstallPath(filename); + + // 2) Fall back to install path + auto install_candidate = findViaInstallPath(std::string{name}); + if(fs::exists(install_candidate)) + { + ROCP_INFO << name << " found via install path: " << install_candidate; + return install_candidate; + } + + // 3) Neither found -> fatal + ROCP_FATAL << "Metric file '" << name << "' not found.\n" + << " Tried: ROCPROFILER_METRICS_PATH/" << name << " and " << install_candidate; + return {}; } } // namespace @@ -298,7 +318,7 @@ loadMetrics(bool reload, const std::optional add_metric) } auto reload_func = [&]() { - auto counters_path = findViaEnvironment("counter_defs.yaml"); + auto counters_path = locateMetricsFile("counter_defs.yaml"); ROCP_FATAL_IF(!common::filesystem::exists(counters_path)) << "metric xml file '" << counters_path << "' does not exist"; return std::make_shared(loadYAML(counters_path, add_metric)); diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/parser/tests/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/parser/tests/CMakeLists.txt index fb0115fb5f..acc3ac0052 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/parser/tests/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/parser/tests/CMakeLists.txt @@ -14,13 +14,15 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest GTest::gtest_main) -gtest_add_tests( +set(_ROCPROFILER_SHARE_DIR + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}") + +rocprofiler_add_unit_test( TARGET parser-test SOURCES ${ROCPROFILER_LIB_PARSER_TEST_SOURCES} - TEST_LIST parser-tests_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${parser-tests_TESTS} - PROPERTIES TIMEOUT 45 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + TIMEOUT 45 + LABELS unittests + ENVIRONMENT + "ROCPROFILER_METRICS_PATH=${_ROCPROFILER_SHARE_DIR}" + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/CMakeLists.txt index 66fd9efa5b..aead962263 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/CMakeLists.txt @@ -1,5 +1,7 @@ rocprofiler_deactivate_clang_tidy() +project(rocprofiler-sdk-unit-tests-counters LANGUAGES C CXX) + include(GoogleTest) find_program( @@ -18,13 +20,10 @@ function(generate_hsaco TARGET_ID INPUT_FILE OUTPUT_FILE) add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/${OUTPUT_FILE} COMMAND ${amdclangpp_EXECUTABLE} ${CLANG_ARG_LIST} - COMMAND - ${CMAKE_COMMAND} -E copy - ${PROJECT_BINARY_DIR}/source/lib/rocprofiler-sdk/counters/tests/${OUTPUT_FILE} - ${CMAKE_BINARY_DIR}/bin/${OUTPUT_FILE} - OUTPUT ${CMAKE_BINARY_DIR}/bin/${OUTPUT_FILE} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${OUTPUT_FILE} + COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/${OUTPUT_FILE} ${CMAKE_BINARY_DIR}/bin/${OUTPUT_FILE} + DEPENDS ${INPUT_FILE} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Building ${OUTPUT_FILE}...") set(HSACO_TARGET_LIST ${HSACO_TARGET_LIST} ${PROJECT_BINARY_DIR}/${OUTPUT_FILE} @@ -39,6 +38,11 @@ endforeach() add_custom_target(agent_hasco_targets DEPENDS ${HSACO_TARGET_LIST}) +install( + FILES ${HSACO_TARGET_LIST} + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests/unit-tests/bin + COMPONENT tests) + add_library(counter_test_constants OBJECT) add_library(rocprofiler-sdk::counter-test-constants ALIAS counter_test_constants) set(ROCPROFILER_LIB_COUNTER_TEST_CONSTANTS_SOURCES hsa_tables.cpp) @@ -60,15 +64,15 @@ set(ROCPROFILER_LIB_COUNTER_TEST_SOURCES device_counting.cpp) set(ROCPROFILER_LIB_COUNTER_TEST_HEADERS code_object_loader.hpp device_counting.hpp) -add_executable(counter-test) +add_executable(counter-tests) -target_sources(counter-test PRIVATE ${ROCPROFILER_LIB_COUNTER_TEST_SOURCES} - ${ROCPROFILER_LIB_COUNTER_TEST_HEADERS}) +target_sources(counter-tests PRIVATE ${ROCPROFILER_LIB_COUNTER_TEST_SOURCES} + ${ROCPROFILER_LIB_COUNTER_TEST_HEADERS}) -add_dependencies(counter-test agent_hasco_targets) +add_dependencies(counter-tests agent_hasco_targets) target_link_libraries( - counter-test + counter-tests PRIVATE rocprofiler-sdk::counter-test-constants rocprofiler-sdk::rocprofiler-sdk-hsa-runtime rocprofiler-sdk::rocprofiler-sdk-hip @@ -77,48 +81,44 @@ target_link_libraries( GTest::gtest GTest::gtest_main) -gtest_add_tests( - TARGET counter-test - SOURCES ${ROCPROFILER_LIB_COUNTER_TEST_SOURCES} - TEST_LIST counter-tests_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${counter-tests_TESTS} - PROPERTIES - TIMEOUT - 45 - LABELS - "unittests" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "Running non-intercept test(.*)could not be locked for profiling due to lack of permissions.*" - ) +set(_ROCPROFILER_SHARE_DIR + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}") # unstable counter collection test: Generates HW exception leading to GPU hang or memory # access fault -set_tests_properties( - device_counting_service_test.sync_counters device_counting_service_test.async_counters - PROPERTIES DISABLED "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}") +rocprofiler_add_unit_test( + TARGET counter-tests + SOURCES ${ROCPROFILER_LIB_COUNTER_TEST_SOURCES} + TIMEOUT 45 + ENVIRONMENT + "ROCPROFILER_METRICS_PATH=${_ROCPROFILER_SHARE_DIR}" + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + SKIP_REGULAR_EXPRESSION + "Running non-intercept test(.*)could not be locked for profiling due to lack of permissions.*" + DISABLE_TESTS + device_counting_service_test.sync_counters + device_counting_service_test.async_counters + device_counting_service_test.sync_gpu_util_verify + device_counting_service_test.sync_sq_waves_verify + device_counting_service_test.sync_sq_waves_verify_non_intercept + device_counting_service_test.raw_sq_waves_verify + device_counting_service_test.sync_grbm_verify) set(ROCPROFILER_LIB_CONSUMER_TEST_SOURCES consumer_test.cpp) -add_executable(consumer-test) -target_sources(consumer-test PRIVATE ${ROCPROFILER_LIB_CONSUMER_TEST_SOURCES}) +add_executable(consumer-tests) +target_sources(consumer-tests PRIVATE ${ROCPROFILER_LIB_CONSUMER_TEST_SOURCES}) target_link_libraries( - consumer-test rocprofiler-sdk::rocprofiler-sdk-hsa-runtime + consumer-tests rocprofiler-sdk::rocprofiler-sdk-hsa-runtime rocprofiler-sdk::rocprofiler-sdk-hip rocprofiler-sdk::rocprofiler-sdk-common-library rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest GTest::gtest_main) -gtest_add_tests( - TARGET consumer-test +rocprofiler_add_unit_test( + TARGET consumer-tests SOURCES ${ROCPROFILER_LIB_CONSUMER_TEST_SOURCES} - TEST_LIST consumer-tests_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${consumer-tests_TESTS} - PROPERTIES TIMEOUT 45 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + TIMEOUT 45 + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/kfd/tests/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/kfd/tests/CMakeLists.txt index 8918a43247..6ed028a77d 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/kfd/tests/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/kfd/tests/CMakeLists.txt @@ -36,13 +36,11 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest GTest::gtest_main) -gtest_add_tests( +rocprofiler_add_unit_test( TARGET kfd-events-parser - SOURCES ${ROCPROFILER_LIB_COUNTER_TEST_SOURCES} - TEST_LIST kfd-events-parsers_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${kfd-events-parsers_TESTS} - PROPERTIES TIMEOUT 45 LABELS "unittests;kfd-events" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + SOURCES ${ROCPROFILER_LIB_KFD_EVENTS_TEST_SOURCES} + TIMEOUT 45 + LABELS "unittests;kfd-events" + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/pc_sampling/parser/tests/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/pc_sampling/parser/tests/CMakeLists.txt index 1c512054d6..46feb0cf51 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/pc_sampling/parser/tests/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/pc_sampling/parser/tests/CMakeLists.txt @@ -33,16 +33,14 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest GTest::gtest_main) -gtest_add_tests( +rocprofiler_add_unit_test( TARGET pcs_gfx9_test SOURCES ${ROCPROFILER_LIB_PC_SAMPLING_PARSER_GFX9_TEST_SOURCES} - TEST_LIST pcs_gfx9_test_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${pcs_gfx9_test_TESTS} - PROPERTIES TIMEOUT 45 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + LABELS "unittests;pc-sampling;gfx9" + TIMEOUT 45 + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + ) add_executable(pcs_id_test) @@ -55,15 +53,14 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest GTest::gtest_main) -gtest_add_tests( +rocprofiler_add_unit_test( TARGET pcs_id_test SOURCES ${ROCPROFILER_LIB_PC_SAMPLING_PARSER_ID_TEST_SOURCES} - TEST_LIST pcs_id_test_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${pcs_id_test_TESTS} PROPERTIES TIMEOUT 45 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + LABELS "unittests" + TIMEOUT 45 + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") add_executable(pcs_bench_test) @@ -91,16 +88,14 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest GTest::gtest_main) -gtest_add_tests( +rocprofiler_add_unit_test( TARGET pcs_thread_test SOURCES ${ROCPROFILER_LIB_PC_SAMPLING_PARSER_MULTIGPU_TEST_SOURCES} - TEST_LIST pcs_thread_test_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${pcs_thread_test_TESTS} - PROPERTIES TIMEOUT 75 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + LABELS "unittests" + TIMEOUT 75 + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") add_executable(pcs_gfx12_test) @@ -114,13 +109,11 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest GTest::gtest_main) -gtest_add_tests( +rocprofiler_add_unit_test( TARGET pcs_gfx12_test SOURCES ${ROCPROFILER_LIB_PC_SAMPLING_PARSER_GFX12_TEST_SOURCES} - TEST_LIST pcs_gfx12_test_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${pcs_gfx12_test_TESTS} - PROPERTIES TIMEOUT 45 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + LABELS "unittests" + TIMEOUT 45 + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/pc_sampling/tests/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/pc_sampling/tests/CMakeLists.txt index 99aea0c478..4f91344f06 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/pc_sampling/tests/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/pc_sampling/tests/CMakeLists.txt @@ -19,14 +19,12 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-static-library GTest::gtest GTest::gtest_main) -gtest_add_tests( +rocprofiler_add_unit_test( TARGET pcs-test - SOURCES ${ROCPROFILER_LIB_COUNTER_TEST_SOURCES} - TEST_LIST pcs-tests_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${pcs-tests_TESTS} - PROPERTIES TIMEOUT 45 LABELS "unittests;pc-sampling" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + SOURCES ${ROCPROFILER_LIB_PC_SAMPLING_TEST_SOURCES} + TIMEOUT 45 + LABELS "unittests;pc-sampling" + SKIP_REGULAR_EXPRESSION "PC sampling unavailable" + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/tests/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/tests/CMakeLists.txt index d71aa7c297..33ab5684b6 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/tests/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/tests/CMakeLists.txt @@ -35,15 +35,15 @@ target_link_libraries( GTest::gtest GTest::gtest_main) -gtest_add_tests( +rocprofiler_add_unit_test( TARGET rocprofiler-sdk-lib-tests SOURCES ${rocprofiler_lib_sources} TEST_LIST lib_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${lib_TESTS} PROPERTIES TIMEOUT 30 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + TIMEOUT 30 + LABELS "unittests" + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") # -------------------------------------------------------------------------------------- # # @@ -68,17 +68,16 @@ target_link_libraries( set_target_properties(rocprofiler-sdk-lib-tests-shared PROPERTIES BUILD_RPATH "\$ORIGIN/../lib") -gtest_add_tests( - TARGET rocprofiler-sdk-lib-tests-shared - SOURCES ${rocprofiler_shared_lib_sources} - TEST_LIST shared_lib_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set(rocprofiler-sdk-lib-tests-env "LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}:$ENV{LD_LIBRARY_PATH}") -set_tests_properties( - ${shared_lib_TESTS} - PROPERTIES TIMEOUT 120 LABELS "unittests" ENVIRONMENT - "${rocprofiler-sdk-lib-tests-env}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_unit_test( + TARGET rocprofiler-sdk-lib-tests-shared + SOURCES ${rocprofiler_shared_lib_sources} + TEST_LIST shared_lib_TESTS + TIMEOUT 120 + LABELS "unittests" + ENVIRONMENT + "${rocprofiler-sdk-lib-tests-env}" + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/thread_trace/tests/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/thread_trace/tests/CMakeLists.txt index 62acae39fb..410fa84eb4 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/thread_trace/tests/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/thread_trace/tests/CMakeLists.txt @@ -19,13 +19,16 @@ target_link_libraries( GTest::gtest_main rocprofiler-sdk::counter-test-constants) -gtest_add_tests( +set(_ROCPROFILER_SHARE_DIR + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}") + +rocprofiler_add_unit_test( TARGET thread-trace-packet-test SOURCES ${ROCPROFILER_THREAD_TRACE_TEST_SOURCES} TEST_LIST thread-trace-packet-test_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${thread-trace-packet-test_TESTS} - PROPERTIES TIMEOUT 10 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + TIMEOUT 10 + LABELS "unittests" + ENVIRONMENT + "ROCPROFILER_METRICS_PATH=${_ROCPROFILER_SHARE_DIR}" + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") diff --git a/projects/rocprofiler-sdk/source/lib/tests/buffering/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/tests/buffering/CMakeLists.txt index 39e771e9b4..034378cc38 100644 --- a/projects/rocprofiler-sdk/source/lib/tests/buffering/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/tests/buffering/CMakeLists.txt @@ -7,21 +7,17 @@ include(GoogleTest) set(buffering_sources buffering-serial.cpp buffering-parallel.cpp buffering-save-load.cpp) -add_executable(buffering-test) -target_sources(buffering-test PRIVATE ${buffering_sources}) +add_executable(buffering-tests) +target_sources(buffering-tests PRIVATE ${buffering_sources}) target_link_libraries( - buffering-test + buffering-tests PRIVATE rocprofiler-sdk::rocprofiler-sdk-headers rocprofiler-sdk::rocprofiler-sdk-common-library GTest::gtest GTest::gtest_main) -gtest_add_tests( - TARGET buffering-test +rocprofiler_add_unit_test( + TARGET buffering-tests SOURCES ${buffering_sources} - TEST_LIST buffering-tests_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${buffering-tests_TESTS} - PROPERTIES TIMEOUT 360 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + ) diff --git a/projects/rocprofiler-sdk/source/lib/tests/codeobj/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/tests/codeobj/CMakeLists.txt index 51985f50d7..7b767dca56 100644 --- a/projects/rocprofiler-sdk/source/lib/tests/codeobj/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/tests/codeobj/CMakeLists.txt @@ -1,13 +1,68 @@ +# +# +# + rocprofiler_deactivate_clang_tidy() -include(GoogleTest) -add_executable(codeobj-library-test) +add_executable(codeobj-library-tests) set(CODEOBJ_LIB_TEST_SOURCES "codeobj_library_test.cpp") -target_sources(codeobj-library-test PRIVATE ${CODEOBJ_LIB_TEST_SOURCES}) + +target_sources(codeobj-library-tests PRIVATE ${CODEOBJ_LIB_TEST_SOURCES}) + +set(PKG_TEST_BIN_DIR "${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests/unit-tests/bin") + +target_compile_definitions( + codeobj-library-tests + PRIVATE CODEOBJ_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}/" + CODEOBJ_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${PKG_TEST_BIN_DIR}/") + +configure_file(smallkernel.bin smallkernel.bin COPYONLY) +configure_file(hipcc_output.s hipcc_output.s COPYONLY) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/hipcc_output.s + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests/unit-tests/bin + COMPONENT tests) + +find_program( + ROCM_LLVM_STRIP + NAMES llvm-strip + HINTS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm + PATH_SUFFIXES llvm/bin bin) + +set(_SMALLBIN "${CMAKE_CURRENT_BINARY_DIR}/smallkernel.bin") +set(_SMALLBIN_STRIPPED "${CMAKE_CURRENT_BINARY_DIR}/smallkernel.bin.stripped") + +if(ROCM_LLVM_STRIP) + add_custom_command( + OUTPUT "${_SMALLBIN_STRIPPED}" + COMMAND "${ROCM_LLVM_STRIP}" -s "${_SMALLBIN}" -o "${_SMALLBIN_STRIPPED}" + DEPENDS "${_SMALLBIN}" + COMMENT + "Stripping ALL symbols from smallkernel.bin so CPack won't try to create a dbgsym" + VERBATIM) + + add_custom_target(strip_smallkernel ALL DEPENDS "${_SMALLBIN_STRIPPED}") + + install( + FILES "${_SMALLBIN_STRIPPED}" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests/unit-tests/bin" + RENAME smallkernel.bin + COMPONENT tests) +else() + message( + WARNING + "llvm-strip not found; installing unmodified smallkernel.bin (CPack may fail on debuginfo)." + ) + install( + FILES "${_SMALLBIN}" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/tests/unit-tests/bin" + COMPONENT tests) +endif() target_link_libraries( - codeobj-library-test + codeobj-library-tests PRIVATE rocprofiler-sdk::rocprofiler-sdk-static-library rocprofiler-sdk::rocprofiler-sdk-glog rocprofiler-sdk::rocprofiler-sdk-hsa-runtime @@ -19,19 +74,9 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-dw rocprofiler-sdk::rocprofiler-sdk-elf) -gtest_add_tests( - TARGET codeobj-library-test +rocprofiler_add_unit_test( + TARGET codeobj-library-tests SOURCES ${CODEOBJ_LIB_TEST_SOURCES} - TEST_LIST codeobj-library-test_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${codeobj-library-test_TESTS} - PROPERTIES TIMEOUT 10 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -target_compile_definitions(codeobj-library-test - PRIVATE -DCODEOBJ_BINARY_DIR=\"${CMAKE_CURRENT_BINARY_DIR}/\") - -configure_file(smallkernel.bin smallkernel.bin COPYONLY) -configure_file(hipcc_output.s hipcc_output.s COPYONLY) + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + ) diff --git a/projects/rocprofiler-sdk/source/lib/tests/codeobj/codeobj_library_test.cpp b/projects/rocprofiler-sdk/source/lib/tests/codeobj/codeobj_library_test.cpp index 8512ce8ee1..50f3af6ba3 100644 --- a/projects/rocprofiler-sdk/source/lib/tests/codeobj/codeobj_library_test.cpp +++ b/projects/rocprofiler-sdk/source/lib/tests/codeobj/codeobj_library_test.cpp @@ -27,17 +27,26 @@ #include #include +#include "lib/common/filesystem.hpp" + #ifndef CODEOBJ_BINARY_DIR static_assert(false && "Please define CODEOBJ_BINARY_DIR to codeobj tests binary, " "e.g. ../source/lib/tests/codeobj/"); #endif +#ifndef CODEOBJ_INSTALL_DIR +static_assert(false && "Please define CODEOBJ_INSTALL_DIR to the installed tests bin directory " + "(e.g. /share/rocprofiler-sdk/tests/unit-tests/bin/)"); +#endif + namespace rocprofiler { namespace testing { namespace codeobjhelper { +namespace fs = common::filesystem; + std::string removeNull(std::string_view s) { @@ -47,11 +56,24 @@ removeNull(std::string_view s) return u; } +// Helper function for path to a test assets +static std::string +get_data_file_path(const char* name) +{ + for(const char* base : {CODEOBJ_BINARY_DIR, CODEOBJ_INSTALL_DIR}) + { + std::error_code ec; + fs::path p = fs::path(base) / name; + if(fs::exists(p, ec) && fs::is_regular_file(p, ec)) return p.string(); + } + return {}; // not found +} + static const std::vector& GetHipccOutput() { static std::vector result = []() { - std::ifstream file(CODEOBJ_BINARY_DIR "hipcc_output.s"); + std::ifstream file(get_data_file_path("hipcc_output.s")); std::vector ret; while(file.good()) @@ -69,7 +91,7 @@ static const std::vector& GetCodeobjContents() { static std::vector buffer = []() { - std::string filename = CODEOBJ_BINARY_DIR "smallkernel.bin"; + std::string filename = get_data_file_path("smallkernel.bin"); std::ifstream file(filename.data(), std::ios::binary); using iterator_t = std::istreambuf_iterator; @@ -141,7 +163,9 @@ TEST(codeobj_library, decoder_component) CodeobjDecoderComponent component(objdata.data(), objdata.size()); - std::string kernel_with_protocol = "file://" CODEOBJ_BINARY_DIR "smallkernel.bin"; + std::string smallkernel_path = + rocprofiler::testing::codeobjhelper::get_data_file_path("smallkernel.bin"); + std::string kernel_with_protocol = "file://" + smallkernel_path; LoadedCodeobjDecoder loadecomp(kernel_with_protocol.data(), loaded_offset, objdata.size()); ASSERT_EQ(component.m_symbol_map.size(), 1); diff --git a/projects/rocprofiler-sdk/source/lib/tests/common/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/tests/common/CMakeLists.txt index 0883b83bd4..45330f4abe 100644 --- a/projects/rocprofiler-sdk/source/lib/tests/common/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/tests/common/CMakeLists.txt @@ -3,8 +3,6 @@ # project(rocprofiler-sdk-tests-common LANGUAGES C CXX) -include(GoogleTest) - set(common_sources c_array.cpp demangling.cpp @@ -27,13 +25,10 @@ target_link_libraries( GTest::gtest GTest::gtest_main) -gtest_add_tests( +rocprofiler_add_unit_test( TARGET common-tests SOURCES ${common_sources} - TEST_LIST common-tests_TESTS - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -set_tests_properties( - ${common-tests_TESTS} - PROPERTIES TIMEOUT 45 LABELS "unittests" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" ENVIRONMENT "TEST_LOG_LEVEL=info") + ENVIRONMENT + "TEST_LOG_LEVEL=info" + "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/llvm/lib:/opt/rocm/lib:/opt/rocm/llvm/lib:$ENV{LD_LIBRARY_PATH}" + ) diff --git a/projects/rocprofiler-sdk/tests/CMakeLists.txt b/projects/rocprofiler-sdk/tests/CMakeLists.txt index cdeb636742..77403292e4 100644 --- a/projects/rocprofiler-sdk/tests/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/CMakeLists.txt @@ -50,6 +50,7 @@ find_package(Python3 REQUIRED) # generally needed find_package(rocprofiler-sdk REQUIRED) +find_package(rocprofiler_sdk_pytest REQUIRED) # get the gfx architectures that are present on the system rocprofiler_sdk_get_gfx_architectures(rocprofiler-sdk-tests-gfx-info ECHO) @@ -60,6 +61,9 @@ add_subdirectory(pytest-packages) # common utilities add_subdirectory(common) +# unit-test subdirectory only exists in rocprofiler-sdk-tests package +add_subdirectory(unit-tests) + # tool libraries used for data collection during integration tests add_subdirectory(tools) diff --git a/projects/rocprofiler-sdk/tests/async-copy-tracing/CMakeLists.txt b/projects/rocprofiler-sdk/tests/async-copy-tracing/CMakeLists.txt index 3513b11372..9e8461b1f0 100644 --- a/projects/rocprofiler-sdk/tests/async-copy-tracing/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/async-copy-tracing/CMakeLists.txt @@ -10,36 +10,29 @@ project( find_package(rocprofiler-sdk REQUIRED) -if(ROCPROFILER_MEMCHECK_PRELOAD_ENV) +if(ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE) set(PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}:$") + "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}:$" + ) else() - set(PRELOAD_ENV "LD_PRELOAD=$") + set(PRELOAD_ENV "$") endif() -add_test(NAME test-async-copy-tracing-execute COMMAND $) +rocprofiler_add_integration_execute_test( + async-copy-tracing + TARGET transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "ROCPROFILER_TOOL_OUTPUT_FILE=async-copy-tracing-test.json" + FIXTURES_SETUP async-copy-tracing) -set(async-copy-tracing-env - "${PRELOAD_ENV}" - "ROCPROFILER_TOOL_OUTPUT_FILE=async-copy-tracing-test.json" - "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" - ) - -set_tests_properties( - test-async-copy-tracing-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT - "${async-copy-tracing-env}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -# copy to binary directory -rocprofiler_configure_pytest_files(COPY validate.py conftest.py CONFIG pytest.ini) - -add_test(NAME test-async-copy-tracing-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --input - ${CMAKE_CURRENT_BINARY_DIR}/async-copy-tracing-test.json) - -set_tests_properties( - test-async-copy-tracing-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - test-async-copy-tracing-execute FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + async-copy-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + LABELS "integration-tests" + TIMEOUT 45 + FIXTURES_REQUIRED async-copy-tracing + ARGS --input ${CMAKE_CURRENT_BINARY_DIR}/async-copy-tracing-test.json) diff --git a/projects/rocprofiler-sdk/tests/async-copy-tracing/pytest.ini b/projects/rocprofiler-sdk/tests/async-copy-tracing/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/async-copy-tracing/pytest.ini +++ b/projects/rocprofiler-sdk/tests/async-copy-tracing/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/c-tool/CMakeLists.txt b/projects/rocprofiler-sdk/tests/c-tool/CMakeLists.txt index 6f9ba961f9..4430150a67 100644 --- a/projects/rocprofiler-sdk/tests/c-tool/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/c-tool/CMakeLists.txt @@ -10,55 +10,41 @@ project( find_package(rocprofiler-sdk REQUIRED) -if(ROCPROFILER_MEMCHECK_PRELOAD_ENV) +if(ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE) set(PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}:$") + "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}:$") else() - set(PRELOAD_ENV "LD_PRELOAD=$") + set(PRELOAD_ENV "$") endif() -add_test(NAME test-c-tool-execute COMMAND $ 1) - -set(c-tool-env - "${PRELOAD_ENV}" - "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" - ) - -set_tests_properties( - test-c-tool-execute - PROPERTIES - TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${c-tool-env}" - PASS_REGULAR_EXPRESSION +rocprofiler_add_integration_execute_test( + test-c-tool + COMMAND $ 1 + DEPENDS transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT + "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" + PASS_REGULAR_EXPRESSION "Test C tool \\(priority=0\\) is using rocprofiler-sdk v([0-9]+\\.[0-9]+\\.[0-9]+)" - FAIL_REGULAR_EXPRESSION + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}|Internal thread for rocprofiler-sdk should not be created" ) # this test uses ROCP_TOOL_LIBRARIES instead of LD_PRELOAD -add_test(NAME test-c-tool-rocp-tool-lib-execute COMMAND $ 1) - -set(c-tool-rocp-tool-lib-env - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}" - "ROCP_TOOL_LIBRARIES=$" - "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" - ) - -set_tests_properties( - test-c-tool-rocp-tool-lib-execute - PROPERTIES - TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${c-tool-rocp-tool-lib-env}" - PASS_REGULAR_EXPRESSION +rocprofiler_add_integration_execute_test( + test-c-tool-rocp-tool-lib + COMMAND $ 1 + DEPENDS transpose rocprofiler-sdk-c-tool + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT + "ROCP_TOOL_LIBRARIES=$" + "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" + PASS_REGULAR_EXPRESSION "Test C tool \\(priority=0\\) is using rocprofiler-sdk v([0-9]+\\.[0-9]+\\.[0-9]+)" - FAIL_REGULAR_EXPRESSION + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}|Internal thread for rocprofiler-sdk should not be created" ) diff --git a/projects/rocprofiler-sdk/tests/common/CMakeLists.txt b/projects/rocprofiler-sdk/tests/common/CMakeLists.txt index 7e3c26b1d9..523118016b 100644 --- a/projects/rocprofiler-sdk/tests/common/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/common/CMakeLists.txt @@ -166,17 +166,384 @@ endif() function(rocprofiler_configure_pytest_files) cmake_parse_arguments(RCPF "" "OUTPUT_DIRECTORY" "COPY;CONFIG" ${ARGN}) + function(rocprofiler_configure_pytest_files_check_pytest_ini _FILENAME) + if(_FILENAME MATCHES ".*pytest\\.ini$") + file(READ ${_FILENAME} _pytest_ini_content) + if(_pytest_ini_content MATCHES "addopts.* -[a-zA-Z]*v.*") + message( + SEND_ERROR + "${_FILENAME} should not contain -v or -vv. This breaks test discovery in pytest_discover_tests" + ) + endif() + endif() + endfunction() + if(NOT RCPF_OUTPUT_DIRECTORY) set(RCPF_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) endif() foreach(FILENAME ${RCPF_COPY}) + rocprofiler_configure_pytest_files_check_pytest_ini( + ${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME} ${RCPF_OUTPUT_DIRECTORY}/${FILENAME} COPYONLY) endforeach() foreach(FILENAME ${RCPF_CONFIG}) + rocprofiler_configure_pytest_files_check_pytest_ini( + ${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME} ${RCPF_OUTPUT_DIRECTORY}/${FILENAME} @ONLY) endforeach() endfunction() + +function(rocprofiler_set_integration_test_name _VAR _BASE _CATEGORY) + set(_NAME "${_BASE}") + + if("${_NAME}" MATCHES "^tests\\.integration\\.${_CATEGORY}.*") + set(_NAME "${_NAME}") + else() + set(_NAME "tests.integration.${_CATEGORY}.${_NAME}") + endif() + + set(${_VAR} + "${_NAME}" + PARENT_SCOPE) +endfunction() + +function(rocprofiler_add_integration_execute_test NAME) + set(_FLAG_OPTS + "WILL_FAIL" # failure is expected in order for test to pass + "UNSTABLE" # disable when ROCPROFILER_DISABLE_UNSTABLE_CTESTS=ON + "DISABLED_CODECOV" # disable when ROCPROFILER_BUILD_CODECOV=ON + ) + set(_SINGLE_OPTS "TARGET" "WORKING_DIRECTORY" "DEPENDS" "TIMEOUT" "LABELS" "DISABLED" + "DISABLED_MEMCHECKS") + set(_MULTI_OPTS + "ARGS" + "COMMAND" + "ATTACHED_FILES" + "ATTACHED_FILES_ON_FAIL" + "ENVIRONMENT" + "PRELOAD" + "FIXTURES_SETUP" + "FIXTURES_REQUIRED" + "FIXTURES_CLEANUP" + "PASS_REGULAR_EXPRESSION" + "FAIL_REGULAR_EXPRESSION" + "SKIP_REGULAR_EXPRESSION") + + cmake_parse_arguments( + arg + "${_FLAG_OPTS}" # + "${_SINGLE_OPTS}" # + "${_MULTI_OPTS}" # + ${ARGN}) + + rocprofiler_set_integration_test_name(arg_NAME "${NAME}" "execute") + + if("${arg_ENVIRONMENT}" MATCHES "LD_PRELOAD=.*") + message( + FATAL_ERROR + "rocprofiler_add_integration_execute_test: LD_PRELOAD is not allowed in ENVIRONMENT for ${NAME} (${arg_NAME}). Use PRELOAD instead." + ) + endif() + + macro(set_arg_if_empty _VAR) + if(NOT ${_VAR}) + set(${_VAR} ${ARGN}) + endif() + endmacro() + + # provide default + set_arg_if_empty(arg_FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + set_arg_if_empty(arg_TIMEOUT 60) + set_arg_if_empty(arg_FIXTURES_SETUP ${NAME}) + + # the test is marked as unstable + if(ROCPROFILER_DISABLE_UNSTABLE_CTESTS AND arg_UNSTABLE) + set(arg_DISABLED ON) + endif() + + # the test shouldn't be run for matching memchecks + if(arg_DISABLED_MEMCHECKS AND ROCPROFILER_MEMCHECK MATCHES + "${arg_DISABLED_MEMCHECKS}") + set(arg_DISABLED ON) + endif() + + # the tests shouldn't be run when rocprofiler-sdk is built with code-coverage support + if(ROCPROFILER_BUILD_CODECOV AND arg_DISABLED_CODECOV) + set(arg_DISABLED ON) + endif() + + # insert sanitizer libraries into LD_PRELOAD + if(ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE) + list(INSERT arg_PRELOAD 0 "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}") + endif() + + if(arg_PRELOAD) + list(JOIN arg_PRELOAD ":" _preload) + set(arg_ENVIRONMENT "LD_PRELOAD=${_preload}" ${arg_ENVIRONMENT}) + endif() + + # provide LD_LIBRARY_PATH by default if not specified + if(NOT "${arg_ENVIRONMENT}" MATCHES "LD_LIBRARY_PATH=.*") + list( + APPEND + arg_ENVIRONMENT + "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" + ) + endif() + + if(NOT "integration-tests" IN_LIST arg_LABELS) + list(APPEND arg_LABELS "integration-tests") + endif() + + if(NOT "execution" IN_LIST arg_LABELS) + list(APPEND arg_LABELS "execution") + endif() + + # Helper to set a property only if the arg is set + function(_rocprofiler_set_test_property_if_arg TEST_NAME PROPERTY_NAME) + if(arg_${PROPERTY_NAME}) + set_tests_properties(${TEST_NAME} PROPERTIES ${PROPERTY_NAME} + "${arg_${PROPERTY_NAME}}") + endif() + endfunction() + + if(DEFINED arg_COMMAND AND DEFINED arg_TARGET) + message(SEND_ERROR "Cannot specify both TARGET and COMMAND arguments at once") + return() + elseif(NOT DEFINED arg_COMMAND AND NOT DEFINED arg_TARGET) + message(SEND_ERROR "One of COMMAND or TARGET must be specified") + return() + endif() + + if(DEFINED arg_COMMAND AND NOT DEFINED arg_DEPENDS) + message(SEND_ERROR "COMMAND signature without DEPENDS specified") + + elseif( + DEFINED arg_COMMAND + AND DEFINED arg_DEPENDS + AND TARGET ${arg_DEPENDS}) + + add_test(NAME "${arg_NAME}" COMMAND ${arg_COMMAND}) + + set_tests_properties(${arg_NAME} PROPERTIES RUN_SERIAL ON) + _rocprofiler_set_test_property_if_arg(${arg_NAME} TIMEOUT) + _rocprofiler_set_test_property_if_arg(${arg_NAME} LABELS) + _rocprofiler_set_test_property_if_arg(${arg_NAME} WORKING_DIRECTORY) + _rocprofiler_set_test_property_if_arg(${arg_NAME} ENVIRONMENT) + _rocprofiler_set_test_property_if_arg(${arg_NAME} PASS_REGULAR_EXPRESSION) + _rocprofiler_set_test_property_if_arg(${arg_NAME} FAIL_REGULAR_EXPRESSION) + _rocprofiler_set_test_property_if_arg(${arg_NAME} SKIP_REGULAR_EXPRESSION) + _rocprofiler_set_test_property_if_arg(${arg_NAME} ATTACHED_FILES) + _rocprofiler_set_test_property_if_arg(${arg_NAME} ATTACHED_FILES_ON_FAIL) + _rocprofiler_set_test_property_if_arg(${arg_NAME} DEPENDS) + _rocprofiler_set_test_property_if_arg(${arg_NAME} DISABLED) + _rocprofiler_set_test_property_if_arg(${arg_NAME} FIXTURES_SETUP) + _rocprofiler_set_test_property_if_arg(${arg_NAME} FIXTURES_REQUIRED) + _rocprofiler_set_test_property_if_arg(${arg_NAME} FIXTURES_CLEANUP) + _rocprofiler_set_test_property_if_arg(${arg_NAME} WILL_FAIL) + + elseif(arg_TARGET AND TARGET ${arg_TARGET}) + + add_test(NAME "${arg_NAME}" COMMAND $ ${arg_ARGS}) + + set_tests_properties(${arg_NAME} PROPERTIES RUN_SERIAL ON) + _rocprofiler_set_test_property_if_arg(${arg_NAME} TIMEOUT) + _rocprofiler_set_test_property_if_arg(${arg_NAME} LABELS) + _rocprofiler_set_test_property_if_arg(${arg_NAME} WORKING_DIRECTORY) + _rocprofiler_set_test_property_if_arg(${arg_NAME} ENVIRONMENT) + _rocprofiler_set_test_property_if_arg(${arg_NAME} PASS_REGULAR_EXPRESSION) + _rocprofiler_set_test_property_if_arg(${arg_NAME} FAIL_REGULAR_EXPRESSION) + _rocprofiler_set_test_property_if_arg(${arg_NAME} SKIP_REGULAR_EXPRESSION) + _rocprofiler_set_test_property_if_arg(${arg_NAME} ATTACHED_FILES) + _rocprofiler_set_test_property_if_arg(${arg_NAME} ATTACHED_FILES_ON_FAIL) + _rocprofiler_set_test_property_if_arg(${arg_NAME} DEPENDS) + _rocprofiler_set_test_property_if_arg(${arg_NAME} DISABLED) + _rocprofiler_set_test_property_if_arg(${arg_NAME} FIXTURES_SETUP) + _rocprofiler_set_test_property_if_arg(${arg_NAME} FIXTURES_REQUIRED) + _rocprofiler_set_test_property_if_arg(${arg_NAME} FIXTURES_CLEANUP) + _rocprofiler_set_test_property_if_arg(${arg_NAME} WILL_FAIL) + + else() + + message(WARNING "Target '${arg_TARGET}' not found") + + add_test( + NAME "${arg_NAME}" + COMMAND + ${CMAKE_COMMAND} -E echo + "'${arg_TARGET}' with args '${arg_ARGS}' could not be executed because the target does not exist" + ) + + # If this target is accidentally run, report it as a failed test + set_tests_properties("${arg_NAME}" PROPERTIES FAIL_REGULAR_EXPRESSION ".*" + DISABLED ON) + endif() +endfunction() + +function(rocprofiler_add_integration_validate_test NAME) + set(_FLAG_OPTS + "WILL_FAIL" # failure is expected in order for test to pass + "UNSTABLE" # disable when ROCPROFILER_DISABLE_UNSTABLE_CTESTS=ON + "DISABLED_CODECOV" # disable when ROCPROFILER_BUILD_CODECOV=ON + "STRIP_PARAM_BRACKETS" + "INCLUDE_FILE_PATH" + "BUNDLE_TESTS") + set(_SINGLE_OPTS "TARGET_DEPENDS" "WORKING_DIRECTORY" "DEPENDS" "TIMEOUT" "LABELS" + "DISABLED" "DISABLED_MEMCHECKS") + set(_MULTI_OPTS + "TEST_PATHS" + "CONFIG" + "COPY" + "ARGS" + "DISCOVERY_ARGS" + "ATTACHED_FILES" + "ATTACHED_FILES_ON_FAIL" + "PYTHON_PATH" + "ENVIRONMENT" + "PRELOAD" + "FIXTURES_SETUP" + "FIXTURES_REQUIRED" + "FIXTURES_CLEANUP" + "PASS_REGULAR_EXPRESSION" + "FAIL_REGULAR_EXPRESSION" + "SKIP_REGULAR_EXPRESSION") + + cmake_parse_arguments( + arg + "${_FLAG_OPTS}" # + "${_SINGLE_OPTS}" # + "${_MULTI_OPTS}" # + ${ARGN}) + + find_package(rocprofiler_sdk_pytest REQUIRED) + + rocprofiler_set_integration_test_name(arg_NAME "${NAME}" "validate") + + if("${arg_ENVIRONMENT}" MATCHES "LD_PRELOAD=.*") + message( + FATAL_ERROR + "rocprofiler_add_integration_validate_test: LD_PRELOAD is not allowed in ENVIRONMENT for ${NAME} (${arg_NAME}). Use PRELOAD instead." + ) + endif() + + macro(set_arg_if_empty _VAR) + if(NOT ${_VAR}) + set(${_VAR} ${ARGN}) + endif() + endmacro() + + # provide default + set_arg_if_empty(arg_FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + set_arg_if_empty(arg_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set_arg_if_empty(arg_TIMEOUT 60) + set_arg_if_empty(arg_FIXTURES_REQUIRED ${NAME}) + set_arg_if_empty(arg_DISABLED OFF) + + # the test is marked as unstable + if(ROCPROFILER_DISABLE_UNSTABLE_CTESTS AND arg_UNSTABLE) + set(arg_DISABLED ON) + endif() + + # the test shouldn't be run for matching memchecks + if(arg_DISABLED_MEMCHECKS AND ROCPROFILER_MEMCHECK MATCHES + "${arg_DISABLED_MEMCHECKS}") + set(arg_DISABLED ON) + endif() + + # the test shouldn't be run if any of the TARGET_DEPENDS are not built + foreach(_TARGET ${arg_TARGET_DEPENDS}) + if(NOT TARGET ${_TARGET}) + set(arg_DISABLED ON) + endif() + endforeach() + + # the tests shouldn't be run when rocprofiler-sdk is built with code-coverage support + if(ROCPROFILER_BUILD_CODECOV AND arg_DISABLED_CODECOV) + set(arg_DISABLED ON) + endif() + + if(NOT "integration-tests" IN_LIST arg_LABELS) + list(APPEND arg_LABELS "integration-tests") + endif() + + if(NOT "validation" IN_LIST arg_LABELS) + list(APPEND arg_LABELS "validation") + endif() + + set(arg_PYTHON_PATH "${ROCPROFILER_SDK_TESTS_BINARY_DIR}/pytest-packages" + ${arg_PYTHON_PATH}) + + set(arg_CONFIG ${arg_CONFIG} ${arg_TEST_PATHS} pytest.ini) + list(REMOVE_DUPLICATES arg_CONFIG) + + rocprofiler_configure_pytest_files(COPY ${arg_COPY} CONFIG ${arg_CONFIG}) + + foreach(_FLAG STRIP_PARAM_BRACKETS INCLUDE_FILE_PATH BUNDLE_TESTS) + if(arg_${_FLAG}) + set(_${_FLAG} ${_FLAG}) + else() + set(_${_FLAG}) + endif() + + endforeach() + + # Build properties list safely to avoid argument shifting + set(_props) + list(APPEND _props DISABLED "${arg_DISABLED}") + list(APPEND _props TIMEOUT "${arg_TIMEOUT}") + + function(_append_prop _key _listvar) + if(DEFINED ${_listvar}) + list(JOIN ${_listvar} ";" _joined) + string(REPLACE ";" "\\;" _escaped "${_joined}") + list(APPEND _props ${_key} "${_escaped}") + set(_props + "${_props}" + PARENT_SCOPE) + endif() + endfunction() + + # Multi-valued properties (must be joined!) + _append_prop(LABELS arg_LABELS) + _append_prop(FAIL_REGULAR_EXPRESSION arg_FAIL_REGULAR_EXPRESSION) + _append_prop(SKIP_REGULAR_EXPRESSION arg_SKIP_REGULAR_EXPRESSION) + _append_prop(PASS_REGULAR_EXPRESSION arg_PASS_REGULAR_EXPRESSION) + _append_prop(FIXTURES_REQUIRED arg_FIXTURES_REQUIRED) + + rocprofiler_sdk_pytest_discover_tests( + ${arg_NAME} + ${_STRIP_PARAM_BRACKETS} + ${_INCLUDE_FILE_PATH} + ${_BUNDLE_TESTS} + TEST_PATHS + ${arg_TEST_PATHS} + WORKING_DIRECTORY + ${arg_WORKING_DIRECTORY} + TRIM_FROM_NAME + "${arg_TRIM_FROM_NAME}" + TRIM_FROM_FULL_NAME + "${arg_TRIM_FROM_FULL_NAME}" + LIBRARY_PATH_PREPEND + ${arg_LIBRARY_PATH} + PYTHON_PATH_PREPEND + ${arg_PYTHON_PATH} + ENVIRONMENT + "${arg_ENVIRONMENT}" + DEPENDS + "${arg_DEPENDS}" + EXTRA_ARGS + ${arg_ARGS} + --durations=20 + -rA + -s + -vv + DISCOVERY_EXTRA_ARGS + ${arg_DISCOVERY_ARGS} + PROPERTIES + ${_props}) + +endfunction() diff --git a/projects/rocprofiler-sdk/tests/counter-collection/CMakeLists.txt b/projects/rocprofiler-sdk/tests/counter-collection/CMakeLists.txt index 6e1f9c434b..801997b3c2 100644 --- a/projects/rocprofiler-sdk/tests/counter-collection/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/counter-collection/CMakeLists.txt @@ -10,52 +10,27 @@ project( find_package(rocprofiler-sdk REQUIRED) -if(ROCPROFILER_MEMCHECK_PRELOAD_ENV) - set(PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}:$") -else() - set(PRELOAD_ENV "LD_PRELOAD=$") -endif() +# Execute test - runs multistream with counter collection enabled +rocprofiler_add_integration_execute_test( + counter-collection + TARGET multistream + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "$" + ENVIRONMENT + "ROCPROFILER_TOOL_OUTPUT_FILE=counter-collection-test.json" + "ROCPROFILER_TOOL_CONTEXTS=COUNTER_COLLECTION" "ROCPROF_COUNTERS=SQ_WAVES_sum" + FIXTURES_SETUP counter-collection + UNSTABLE) -set(counter-collection-env - "${PRELOAD_ENV}" "ROCPROFILER_TOOL_OUTPUT_FILE=counter-collection-test.json" - "ROCPROFILER_TOOL_CONTEXTS=COUNTER_COLLECTION" "ROCPROF_COUNTERS=SQ_WAVES_sum") - -add_test(NAME test-counter-collection-execute COMMAND $) - -set_tests_properties( - test-counter-collection-execute - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${counter-collection-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}" - FIXTURES_SETUP - test-counter-collection) - -# copy to binary directory -rocprofiler_configure_pytest_files(COPY validate.py conftest.py CONFIG pytest.ini) - -add_test(NAME test-counter-collection-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --input - ${CMAKE_CURRENT_BINARY_DIR}/counter-collection-test.json) - -set_tests_properties( - test-counter-collection-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - test-counter-collection-execute - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}" - FIXTURES_REQUIRED - test-counter-collection) +# Validate test - validates the counter collection JSON output +rocprofiler_add_integration_validate_test( + counter-collection + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + LABELS "integration-tests" + TIMEOUT 45 + FIXTURES_REQUIRED counter-collection + ARGS --input ${CMAKE_CURRENT_BINARY_DIR}/counter-collection-test.json + UNSTABLE) diff --git a/projects/rocprofiler-sdk/tests/counter-collection/pytest.ini b/projects/rocprofiler-sdk/tests/counter-collection/pytest.ini index d657f00825..668ce05fc0 100644 --- a/projects/rocprofiler-sdk/tests/counter-collection/pytest.ini +++ b/projects/rocprofiler-sdk/tests/counter-collection/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -ras -vv +addopts = --durations=20 -ras testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/hip-graph-tracing/CMakeLists.txt b/projects/rocprofiler-sdk/tests/hip-graph-tracing/CMakeLists.txt index 71b57d01b4..7744a3c935 100644 --- a/projects/rocprofiler-sdk/tests/hip-graph-tracing/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/hip-graph-tracing/CMakeLists.txt @@ -15,37 +15,24 @@ if(ROCPROFILER_MEMCHECK MATCHES "(Address|Thread)Sanitizer" OR ROCPROFILER_BUILD set(PYTEST_ARGS -k "not test_total_runtime") endif() -if(ROCPROFILER_MEMCHECK_PRELOAD_ENV) - set(PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}:$") -else() - set(PRELOAD_ENV "LD_PRELOAD=$") -endif() +rocprofiler_add_integration_execute_test( + hip-graph-tracing + TARGET hip-graph + TIMEOUT 100 + LABELS "integration-tests" + PRELOAD "$" + ENVIRONMENT + "ROCPROFILER_TOOL_OUTPUT_FILE=hip-graph-tracing-test.json" + "ROCPROFILER_TOOL_CONTEXTS=HIP_API_CALLBACK,HIP_API_BUFFERED,KERNEL_DISPATCH_CALLBACK,KERNEL_DISPATCH_BUFFERED,CODE_OBJECT" + FIXTURES_SETUP hip-graph-tracing) -add_test(NAME test-hip-graph-tracing-execute COMMAND $) - -set(hip-graph-tracing-env - "${PRELOAD_ENV}" - "ROCPROFILER_TOOL_OUTPUT_FILE=hip-graph-tracing-test.json" - "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" - "ROCPROFILER_TOOL_CONTEXTS=HIP_API_CALLBACK,HIP_API_BUFFERED,KERNEL_DISPATCH_CALLBACK,KERNEL_DISPATCH_BUFFERED,CODE_OBJECT" - ) - -set_tests_properties( - test-hip-graph-tracing-execute - PROPERTIES TIMEOUT 100 LABELS "integration-tests" ENVIRONMENT - "${hip-graph-tracing-env}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -rocprofiler_configure_pytest_files(COPY validate.py conftest.py CONFIG pytest.ini) - -add_test( - NAME test-hip-graph-tracing-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py ${PYTEST_ARGS} - --input ${CMAKE_CURRENT_BINARY_DIR}/hip-graph-tracing-test.json) - -set_tests_properties( - test-hip-graph-tracing-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - test-hip-graph-tracing-execute FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + graph-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + LABELS "integration-tests" + TIMEOUT 45 + FIXTURES_REQUIRED hip-graph-tracing + DISCOVERY_ARGS ${PYTEST_ARGS} + ARGS --input ${CMAKE_CURRENT_BINARY_DIR}/hip-graph-tracing-test.json) diff --git a/projects/rocprofiler-sdk/tests/hip-graph-tracing/pytest.ini b/projects/rocprofiler-sdk/tests/hip-graph-tracing/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/hip-graph-tracing/pytest.ini +++ b/projects/rocprofiler-sdk/tests/hip-graph-tracing/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/hip-host-tracing/CMakeLists.txt b/projects/rocprofiler-sdk/tests/hip-host-tracing/CMakeLists.txt index 2a54af317a..797044a3d4 100644 --- a/projects/rocprofiler-sdk/tests/hip-host-tracing/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/hip-host-tracing/CMakeLists.txt @@ -10,51 +10,31 @@ project( find_package(rocprofiler-sdk REQUIRED) -if(ROCPROFILER_MEMCHECK_PRELOAD_ENV) +if(ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE) set(PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}:$") + "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}:$" + ) else() - set(PRELOAD_ENV "LD_PRELOAD=$") + set(PRELOAD_ENV "$") endif() -add_test(NAME test-hip-host-tracing-execute COMMAND $) +rocprofiler_add_integration_execute_test( + hip-host-tracing + TARGET hip-host + TIMEOUT 100 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "ROCPROFILER_TOOL_OUTPUT_FILE=hip-host-tracing-test.json" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + FIXTURES_SETUP hip-host-tracing) -set(hip-host-tracing-env - "${PRELOAD_ENV}" - "ROCPROFILER_TOOL_OUTPUT_FILE=hip-host-tracing-test.json" - "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" - ) - -set_tests_properties( - test-hip-host-tracing-execute - PROPERTIES TIMEOUT - 100 - LABELS - "integration-tests" - ENVIRONMENT - "${hip-host-tracing-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - hip-host-tracing) - -# copy to binary directory -rocprofiler_configure_pytest_files(COPY validate.py conftest.py CONFIG pytest.ini) - -add_test( - NAME test-hip-host-tracing-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py ${PYTEST_ARGS} - --input ${CMAKE_CURRENT_BINARY_DIR}/hip-host-tracing-test.json) - -set_tests_properties( - test-hip-host-tracing-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - test-hip-host-tracing-execute - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_REQUIRED - hip-host-tracing) +rocprofiler_add_integration_validate_test( + hip-host-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + TIMEOUT 45 + LABELS "integration-tests" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + FIXTURES_REQUIRED hip-host-tracing + ARGS --input ${CMAKE_CURRENT_BINARY_DIR}/hip-host-tracing-test.json) diff --git a/projects/rocprofiler-sdk/tests/hip-host-tracing/pytest.ini b/projects/rocprofiler-sdk/tests/hip-host-tracing/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/hip-host-tracing/pytest.ini +++ b/projects/rocprofiler-sdk/tests/hip-host-tracing/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/hsa-memory-allocation/CMakeLists.txt b/projects/rocprofiler-sdk/tests/hsa-memory-allocation/CMakeLists.txt index 662af95376..6532b8dbee 100644 --- a/projects/rocprofiler-sdk/tests/hsa-memory-allocation/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/hsa-memory-allocation/CMakeLists.txt @@ -10,37 +10,21 @@ project( find_package(rocprofiler-sdk REQUIRED) -if(ROCPROFILER_MEMCHECK_PRELOAD_ENV) - set(PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}:$") -else() - set(PRELOAD_ENV "LD_PRELOAD=$") -endif() +rocprofiler_add_integration_execute_test( + memory-allocation-tracing + TARGET hsa-memory-allocation + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "$" + ENVIRONMENT "ROCPROFILER_TOOL_OUTPUT_FILE=memory-allocation-tracing-test.json" + FIXTURES_SETUP memory-allocation-tracing) -add_test(NAME test-memory-allocation-tracing-execute - COMMAND $) - -set(memory-allocation-tracing-env - "${PRELOAD_ENV}" - "ROCPROFILER_TOOL_OUTPUT_FILE=memory-allocation-tracing-test.json" - "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" - ) - -set_tests_properties( - test-memory-allocation-tracing-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT - "${memory-allocation-tracing-env}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -# copy to binary directory -rocprofiler_configure_pytest_files(COPY validate.py conftest.py CONFIG pytest.ini) - -add_test(NAME test-memory-allocation-tracing-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --input - ${CMAKE_CURRENT_BINARY_DIR}/memory-allocation-tracing-test.json) - -set_tests_properties( - test-memory-allocation-tracing-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - test-memory-allocation-tracing-execute FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + memory-allocation-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + LABELS "integration-tests" + TIMEOUT 45 + FIXTURES_REQUIRED memory-allocation-tracing + ARGS --input ${CMAKE_CURRENT_BINARY_DIR}/memory-allocation-tracing-test.json) diff --git a/projects/rocprofiler-sdk/tests/hsa-memory-allocation/pytest.ini b/projects/rocprofiler-sdk/tests/hsa-memory-allocation/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/hsa-memory-allocation/pytest.ini +++ b/projects/rocprofiler-sdk/tests/hsa-memory-allocation/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/kernel-tracing/CMakeLists.txt b/projects/rocprofiler-sdk/tests/kernel-tracing/CMakeLists.txt index 2129fa80f7..0b14d352a0 100644 --- a/projects/rocprofiler-sdk/tests/kernel-tracing/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/kernel-tracing/CMakeLists.txt @@ -17,51 +17,26 @@ if(ROCPROFILER_MEMCHECK MATCHES "(Address|Thread|UndefinedBehavior)Sanitizer" set(PYTEST_ARGS -k "not test_total_runtime") endif() -if(ROCPROFILER_MEMCHECK_PRELOAD_ENV) - set(PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}:$") -else() - set(PRELOAD_ENV "LD_PRELOAD=$") -endif() +set(kernel-tracing-env "ROCPROFILER_TOOL_DISABLE_PERFETTO=1" + "ROCPROFILER_TOOL_OUTPUT_FILE=kernel-tracing-test.json") -add_test(NAME test-kernel-tracing-execute COMMAND $) +rocprofiler_add_integration_execute_test( + kernel-tracing + TARGET reproducible-runtime + TIMEOUT 100 + LABELS "integration-tests" + ENVIRONMENT "${kernel-tracing-env}" + PRELOAD "$" + FIXTURES_SETUP kernel-tracing) -set(kernel-tracing-env - "${PRELOAD_ENV}" - "ROCPROFILER_TOOL_OUTPUT_FILE=kernel-tracing-test.json" - "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" - ) - -set_tests_properties( - test-kernel-tracing-execute - PROPERTIES TIMEOUT - 100 - LABELS - "integration-tests" - ENVIRONMENT - "${kernel-tracing-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - kernel-tracing) - -# copy to binary directory -rocprofiler_configure_pytest_files(COPY validate.py conftest.py CONFIG pytest.ini) - -add_test( - NAME test-kernel-tracing-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py ${PYTEST_ARGS} - --input ${CMAKE_CURRENT_BINARY_DIR}/kernel-tracing-test.json) - -set_tests_properties( - test-kernel-tracing-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - test-kernel-tracing-execute - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_REQUIRED - kernel-tracing) +rocprofiler_add_integration_validate_test( + kernel-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + LABELS "integration-tests" + TIMEOUT 45 + FIXTURES_REQUIRED kernel-tracing + DISCOVERY_ARGS ${PYTEST_ARGS} + ARGS --input ${CMAKE_CURRENT_BINARY_DIR}/kernel-tracing-test.json + UNSTABLE) diff --git a/projects/rocprofiler-sdk/tests/kernel-tracing/pytest.ini b/projects/rocprofiler-sdk/tests/kernel-tracing/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/kernel-tracing/pytest.ini +++ b/projects/rocprofiler-sdk/tests/kernel-tracing/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/openmp-tools/CMakeLists.txt b/projects/rocprofiler-sdk/tests/openmp-tools/CMakeLists.txt index 8611824023..5642ca5950 100644 --- a/projects/rocprofiler-sdk/tests/openmp-tools/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/openmp-tools/CMakeLists.txt @@ -15,13 +15,6 @@ if(ROCPROFILER_MEMCHECK MATCHES "(Address|Thread)Sanitizer" OR ROCPROFILER_BUILD set(PYTEST_ARGS -k "not test_total_runtime") endif() -if(ROCPROFILER_MEMCHECK_PRELOAD_ENV) - set(PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}:$") -else() - set(PRELOAD_ENV "LD_PRELOAD=$") -endif() - set(ROCPROFILER_MEMCHECK_TYPES "ThreadSanitizer" "AddressSanitizer" "UndefinedBehaviorSanitizer") @@ -37,10 +30,7 @@ if("${openmp-tools-gpu-0-gfx-info}" MATCHES "^gfx(10|11|12)[0-9][0-9]$") set(IS_DISABLED ON) endif() -add_test(NAME test-openmp-tools-execute COMMAND $) - set(openmp-tools-env - "${PRELOAD_ENV}" "OMP_NUM_THREADS=2" "OMP_DISPLAY_ENV=1" "OMP_TARGET_OFFLOAD=mandatory" @@ -49,36 +39,24 @@ set(openmp-tools-env "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" ) -set_tests_properties( - test-openmp-tools-execute - PROPERTIES TIMEOUT - 100 - LABELS - "integration-tests;openmp-target" - ENVIRONMENT - "${openmp-tools-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${IS_DISABLED}") +rocprofiler_add_integration_execute_test( + openmp-tools + TARGET openmp-target + TIMEOUT 100 + LABELS "integration-tests;openmp-target" + PRELOAD "$" "${PRELOAD_ENV}" + ENVIRONMENT "${openmp-tools-env}" + DISABLED "${IS_DISABLED}" + FIXTURES_SETUP openmp-tools) -# copy to binary directory -rocprofiler_configure_pytest_files(COPY validate.py conftest.py CONFIG pytest.ini) - -add_test( - NAME test-openmp-tools-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py ${PYTEST_ARGS} - --input ${CMAKE_CURRENT_BINARY_DIR}/openmp-tools-test.json) - -set_tests_properties( - test-openmp-tools-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests;openmp-target" - DEPENDS - test-openmp-tools-execute - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${IS_DISABLED}") +rocprofiler_add_integration_validate_test( + openmp-tools + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + LABELS "integration-tests;openmp-target" + TIMEOUT 45 + FIXTURES_REQUIRED openmp-tools + DISABLED "${IS_DISABLED}" + ARGS ${PYTEST_ARGS} --input ${CMAKE_CURRENT_BINARY_DIR}/openmp-tools-test.json + DISCOVERY_ARGS ${PYTEST_ARGS}) diff --git a/projects/rocprofiler-sdk/tests/openmp-tools/pytest.ini b/projects/rocprofiler-sdk/tests/openmp-tools/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/openmp-tools/pytest.ini +++ b/projects/rocprofiler-sdk/tests/openmp-tools/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/pc_sampling/CMakeLists.txt b/projects/rocprofiler-sdk/tests/pc_sampling/CMakeLists.txt index e6745cf4f6..f293af9e39 100644 --- a/projects/rocprofiler-sdk/tests/pc_sampling/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/pc_sampling/CMakeLists.txt @@ -64,22 +64,12 @@ target_link_libraries( # Check if PC sampling is disabled and whether we should disable the test rocprofiler_sdk_pc_sampling_disabled(IS_PC_SAMPLING_DISABLED) -add_test(NAME pc-sampling-integration-test - COMMAND $) - -set(pc-sampling-integration-test-env "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") - -set_tests_properties( +rocprofiler_add_integration_execute_test( pc-sampling-integration-test - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests;pc-sampling" - SKIP_REGULAR_EXPRESSION - "PC sampling unavailable" - ENVIRONMENT - "${pc-sampling-integration-test-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") + COMMAND $ + DEPENDS pc-sampling-integration-test-client + TIMEOUT 45 + LABELS "integration-tests;pc-sampling" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + SKIP_REGULAR_EXPRESSION "PC sampling unavailable" + DISABLED "${IS_PC_SAMPLING_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/python-bindings/CMakeLists.txt b/projects/rocprofiler-sdk/tests/python-bindings/CMakeLists.txt index dcd790c839..315711ab5e 100644 --- a/projects/rocprofiler-sdk/tests/python-bindings/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/python-bindings/CMakeLists.txt @@ -17,40 +17,35 @@ endif() string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(tracing-env - "${PRELOAD_ENV}" - "PYTHONPATH=${rocprofiler-sdk_LIB_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" - ) - -rocprofiler_configure_pytest_files(CONFIG pytest.ini marker.py COPY validate.py - conftest.py) - -add_test( - NAME test-roctx-python-bindings-execute +rocprofiler_add_integration_execute_test( + roctx-python-bindings COMMAND $ --marker-trace --summary -u sec -d - ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings -o out --output-format csv - json pftrace --log-level config -- ${Python3_EXECUTABLE} - ${CMAKE_CURRENT_BINARY_DIR}/marker.py) + ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings -o out --output-format csv json + pftrace --log-level config -- ${Python3_EXECUTABLE} + ${CMAKE_CURRENT_BINARY_DIR}/marker.py + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 45 + LABELS "integration-tests;python-bindings" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT + "PYTHONPATH=${rocprofiler-sdk_LIB_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" + FIXTURES_SETUP roctx-python-bindings) -set_tests_properties( - test-roctx-python-bindings-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests;python-bindings" ENVIRONMENT - "${tracing-env}") - -add_test( - NAME test-roctx-python-bindings-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_agent_info.csv - --marker-input - ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_marker_api_trace.csv - --json-input ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_results.pftrace) - -set_tests_properties( - test-roctx-python-bindings-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests;python-bindings" DEPENDS - "test-roctx-python-bindings-execute" FAIL_REGULAR_EXPRESSION - "AssertionError") +rocprofiler_add_integration_validate_test( + roctx-python-bindings + TEST_PATHS validate.py + COPY conftest.py marker.py + CONFIG pytest.ini + LABELS "integration-tests;python-bindings" + TIMEOUT 45 + FIXTURES_REQUIRED roctx-python-bindings + ARGS --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_agent_info.csv + --marker-input + ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_marker_api_trace.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_results.pftrace + FAIL_REGULAR_EXPRESSION "AssertionError") diff --git a/projects/rocprofiler-sdk/tests/python-bindings/pytest.ini b/projects/rocprofiler-sdk/tests/python-bindings/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/python-bindings/pytest.ini +++ b/projects/rocprofiler-sdk/tests/python-bindings/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocdecode/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocdecode/CMakeLists.txt index 2170e03912..17fa7ab6e0 100644 --- a/projects/rocprofiler-sdk/tests/rocdecode/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocdecode/CMakeLists.txt @@ -11,13 +11,6 @@ project( find_package(rocprofiler-sdk REQUIRED) find_package(rocDecode) -if(ROCPROFILER_MEMCHECK_PRELOAD_ENV) - set(PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}:$") -else() - set(PRELOAD_ENV "LD_PRELOAD=$") -endif() - file(GLOB_RECURSE ROCDECODE_VIDEO_FILE "${rocDecode_ROOT_DIR}/share/rocdecode/video/*AMD_driving_virtual_20-H265.265") if(TARGET rocdecode-demo AND NOT EXISTS "${ROCDECODE_VIDEO_FILE}") @@ -30,47 +23,26 @@ if(NOT TARGET rocdecode-demo) set(IS_DISABLED ON) endif() -add_test( - NAME test-rocdecode-tracing-execute +rocprofiler_add_integration_execute_test( + rocdecode-tracing COMMAND - $,$<$:$>,${CMAKE_COMMAND}> - -i ${ROCDECODE_VIDEO_FILE}) + $,$,${CMAKE_COMMAND}> + -i ${ROCDECODE_VIDEO_FILE} + DEPENDS rocdecode-demo + TIMEOUT 45 + LABELS "integration-tests" + DISABLED ${IS_DISABLED} + PRELOAD "$" + ENVIRONMENT "ROCPROFILER_TOOL_OUTPUT_FILE=rocdecode-tracing-test.json" + FIXTURES_SETUP rocdecode-tracing) -set(rocdecode-tracing-env - "${PRELOAD_ENV}" - "ROCPROFILER_TOOL_OUTPUT_FILE=rocdecode-tracing-test.json" - "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" - ) - -set_tests_properties( - test-rocdecode-tracing-execute - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${rocdecode-tracing-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - $>) - -# copy to binary directory -rocprofiler_configure_pytest_files(COPY validate.py conftest.py CONFIG pytest.ini) - -add_test(NAME test-rocdecode-tracing-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --input - ${CMAKE_CURRENT_BINARY_DIR}/rocdecode-tracing-test.json) - -set_tests_properties( - test-rocdecode-tracing-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - test-rocdecode-tracing-execute - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - $>) +rocprofiler_add_integration_validate_test( + rocdecode-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + LABELS "integration-tests" + TIMEOUT 45 + DISABLED ${IS_DISABLED} + FIXTURES_REQUIRED rocdecode-tracing + ARGS --input ${CMAKE_CURRENT_BINARY_DIR}/rocdecode-tracing-test.json) diff --git a/projects/rocprofiler-sdk/tests/rocdecode/pytest.ini b/projects/rocprofiler-sdk/tests/rocdecode/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocdecode/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocdecode/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocjpeg/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocjpeg/CMakeLists.txt index 88b7f2f593..49f3d43af9 100644 --- a/projects/rocprofiler-sdk/tests/rocjpeg/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocjpeg/CMakeLists.txt @@ -33,7 +33,6 @@ find_package(rocJPEG) string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(rocjpeg-tracing-env "${PRELOAD_ENV}") set(rocJPEG_IMAGE_DIR "${rocJPEG_ROOT_DIR}/share/rocjpeg/images") if(TARGET rocjpeg-demo AND NOT EXISTS "${rocJPEG_IMAGE_DIR}") @@ -46,47 +45,26 @@ if(NOT TARGET rocjpeg-demo) set(IS_DISABLED ON) endif() -add_test( - NAME test-rocjpeg-tracing-execute +rocprofiler_add_integration_execute_test( + rocjpeg-tracing COMMAND $,$<$:$>,${CMAKE_COMMAND}> - -i ${rocJPEG_IMAGE_DIR}) + -i ${rocJPEG_IMAGE_DIR} + DEPENDS rocjpeg-demo + TIMEOUT 45 + LABELS "integration-tests" + DISABLED ${IS_DISABLED} + PRELOAD "$" "${PRELOAD_ENV}" + ENVIRONMENT "ROCPROFILER_TOOL_OUTPUT_FILE=rocjpeg-tracing-test.json" + FIXTURES_SETUP rocjpeg-tracing) -set(rocjpeg-tracing-env - "${PRELOAD_ENV}" - "ROCPROFILER_TOOL_OUTPUT_FILE=rocjpeg-tracing-test.json" - "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" - ) - -set_tests_properties( - test-rocjpeg-tracing-execute - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${rocjpeg-tracing-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${IS_DISABLED}") - -# copy to binary directory -rocprofiler_configure_pytest_files(COPY validate.py conftest.py CONFIG pytest.ini) - -add_test(NAME test-rocjpeg-tracing-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --input - ${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-tracing-test.json) - -set_tests_properties( - test-rocjpeg-tracing-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - test-rocjpeg-tracing-execute - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${IS_DISABLED}") +rocprofiler_add_integration_validate_test( + rocjpeg-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + LABELS "integration-tests" + TIMEOUT 45 + DISABLED ${IS_DISABLED} + FIXTURES_REQUIRED rocjpeg-tracing + ARGS --input ${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-tracing-test.json) diff --git a/projects/rocprofiler-sdk/tests/rocjpeg/pytest.ini b/projects/rocprofiler-sdk/tests/rocjpeg/pytest.ini index e2027e2fd5..b4e84a8818 100644 --- a/projects/rocprofiler-sdk/tests/rocjpeg/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocjpeg/pytest.ini @@ -22,6 +22,6 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocpd/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocpd/CMakeLists.txt index 8b55f1f145..676276866a 100644 --- a/projects/rocprofiler-sdk/tests/rocpd/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocpd/CMakeLists.txt @@ -12,7 +12,6 @@ find_package(rocprofiler-sdk REQUIRED) find_package(Python3 REQUIRED COMPONENTS Interpreter) set(rocpd-env - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}" "PYTHONPATH=${rocprofiler-sdk_LIB_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" ) @@ -24,23 +23,24 @@ set(rocpd-env foreach(_SUBPARSER "" "-convert" "-query" "-summary") string(REPLACE "-" "" _CMD "${_SUBPARSER}") - add_test(NAME rocpd${_SUBPARSER}-help COMMAND ${Python3_EXECUTABLE} -m rocpd ${_CMD} - --help) - set_tests_properties( + rocprofiler_add_integration_execute_test( rocpd${_SUBPARSER}-help - PROPERTIES TIMEOUT 120 LABELS "integration-tests;rocpd" ENVIRONMENT - "${rocpd-env}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + COMMAND ${Python3_EXECUTABLE} -m rocpd ${_CMD} --help + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocpd-env}") endforeach() foreach(_MODULE "csv" "pftrace" "otf2" "query" "summary") - add_test(NAME rocpd-module-${_MODULE}-help COMMAND ${Python3_EXECUTABLE} -m - rocpd.${_MODULE} --help) - - set_tests_properties( + rocprofiler_add_integration_execute_test( rocpd-module-${_MODULE}-help - PROPERTIES TIMEOUT 120 LABELS "integration-tests;rocpd" ENVIRONMENT - "${rocpd-env}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + COMMAND ${Python3_EXECUTABLE} -m rocpd.${_MODULE} --help + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocpd-env}") endforeach() diff --git a/projects/rocprofiler-sdk/tests/rocprofv3-avail/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3-avail/CMakeLists.txt index 89a29cd4a5..c3b599cc6d 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3-avail/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3-avail/CMakeLists.txt @@ -10,25 +10,8 @@ project( find_package(rocprofiler-sdk REQUIRED) find_package(Python3 REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY conftest.py validate.py) -set(PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") - -add_test(NAME rocprofv3-avail-test-hw-counters - COMMAND ${Python3_EXECUTABLE} $ - info --pmc) - -add_test(NAME rocprofv3-avail-test-pc-sample-config - COMMAND ${Python3_EXECUTABLE} $ - info --pc-sampling) - -add_test(NAME rocprofv3-avail-test-check-hw-counters - COMMAND ${Python3_EXECUTABLE} $ -d - 0 pmc-check SQ_WAVES GRBM_COUNT TCC_HIT) - -add_test(NAME rocprofv3-avail-test-check-hw-counters_2 - COMMAND ${Python3_EXECUTABLE} $ - pmc-check SQ_WAVES GRBM_COUNT TCC_HIT:device=0) +set(PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}") # disable when GPU-0 is navi2, navi3, and navi4 list(GET rocprofiler-sdk-tests-gfx-info 0 pc-sampling-gpu-0-gfx-info) @@ -38,61 +21,57 @@ if("${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx(10|11|12)[0-9][0-9]$" set(IS_DISABLED ON) endif() -set(test-rocprofv3-avail-env "${PRELOAD_ENV}") -set(enable_pc_sampling "ROCPROFILER_PC_SAMPLING_BETA_ENABLED=on") -set_tests_properties( +rocprofiler_add_integration_execute_test( rocprofv3-avail-test-hw-counters - PROPERTIES - TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${test-rocprofv3-avail-env}" - PASS_REGULAR_EXPRESSION + COMMAND ${Python3_EXECUTABLE} $ info + --pmc + DEPENDS rocprofiler-sdk::rocprofv3-avail + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + PASS_REGULAR_EXPRESSION "GPU:[0-9]*\\n*;Name:\\t[a-zA-Z_]*\\n;Counter_Name:\\t[a-zA-Z_]*\\n;Description:\\t(.*)\\n*;Expression:\\t(.)*\\n*;Block:\\t[a-zA-Z]*\\n*;Dimensions:\\t([A-Z_]*)\\t([[0-9]*:[0-9]*\\])*\\n*" - DISABLED - "${IS_DISABLED}") + DISABLED "${IS_DISABLED}") -set_tests_properties( +rocprofiler_add_integration_execute_test( rocprofv3-avail-test-pc-sample-config - PROPERTIES - TIMEOUT - 45 - LABELS - "integration-tests;pc-sampling" - ENVIRONMENT - "${test-rocprofv3-avail-env};${enable_pc_sampling}" - PASS_REGULAR_EXPRESSION + COMMAND ${Python3_EXECUTABLE} $ info + --pc-sampling + DEPENDS rocprofiler-sdk::rocprofv3-avail + TIMEOUT 45 + LABELS "integration-tests;pc-sampling" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "ROCPROFILER_PC_SAMPLING_BETA_ENABLED=on" + PASS_REGULAR_EXPRESSION "GPU[:0-9 ]+\\n*;Name[:a-zA-Z_ ]+\\n;configs[: ]+;Method:(.*)\\n*;Unit:(.*)\\n*;Min_Interval:[0-9]*\\n*;Max_Interval:[0-9]*\\n*;Flags:(.*)\\n*" - DISABLED - "${IS_DISABLED}") + DISABLED "${IS_DISABLED}") -set_tests_properties( +rocprofiler_add_integration_execute_test( rocprofv3-avail-test-check-hw-counters - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT - "${test-rocprofv3-avail-env}" DISABLED "${IS_DISABLED}") + COMMAND ${Python3_EXECUTABLE} $ -d 0 + pmc-check SQ_WAVES GRBM_COUNT TCC_HIT + DEPENDS rocprofiler-sdk::rocprofv3-avail + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + DISABLED "${IS_DISABLED}") -set_tests_properties( +rocprofiler_add_integration_execute_test( rocprofv3-avail-test-check-hw-counters_2 - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT - "${test-rocprofv3-avail-env}" DISABLED "${IS_DISABLED}") + COMMAND ${Python3_EXECUTABLE} $ + pmc-check SQ_WAVES GRBM_COUNT TCC_HIT:device=0 + DEPENDS rocprofiler-sdk::rocprofv3-avail + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + DISABLED "${IS_DISABLED}") -add_test(NAME rocprofv3-avail-test-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py - --rocm-path ${rocprofiler-sdk_ROOT_DIR}) - -set(test-rocprofv3-avail-validate-env "${PRELOAD_ENV}" "PYTHONPATH=$ENV{PYTHONPATH}") - -set_tests_properties( - rocprofv3-avail-test-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${test-rocprofv3-avail-validate-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${IS_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-avail-test + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --rocm-path ${rocprofiler-sdk_ROOT_DIR} + TIMEOUT 45 PRELOAD "${PRELOAD_ENV}" + LABELS "integration-tests" + DISABLED "${IS_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3-avail/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3-avail/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3-avail/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3-avail/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/aborted-app/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/aborted-app/CMakeLists.txt index 58bd9f6650..ec186fa9e0 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/aborted-app/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/aborted-app/CMakeLists.txt @@ -10,60 +10,43 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py - input.json) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") # disable this test for thread sanitizers because of "signal-unsafe call inside signal" # issues on mi200 and mi300 (works fine on vega20 and navi32) if(ROCPROFILER_MEMCHECK STREQUAL "ThreadSanitizer") - set(DISABLE_THIS_TEST ON) + set(IS_DISABLED ON) else() - # set(DISABLE_THIS_TEST OFF) - set(DISABLE_THIS_TEST ON) # this test is currently unstable so we are disabling it - # unconditionally for now + # set(IS_DISABLED OFF) + set(IS_DISABLED ON) # this test is currently unstable so we are disabling it + # unconditionally for now endif() -set(aborted-app-env "${PRELOAD_ENV}" ROCPROF_TESTING_RAISE_SIGNAL=1 - ROCPROF_INTERNAL_TEST_SIGNAL_HANDLER_VIA_EXIT=1) - # app-abort -add_test( - NAME rocprofv3-test-execute-app-abort +rocprofiler_add_integration_execute_test( + rocprofv3-test-app-abort COMMAND $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.json -d - ${CMAKE_CURRENT_BINARY_DIR}/out-aborted-app -- $ 1 1) + ${CMAKE_CURRENT_BINARY_DIR}/out-aborted-app -- $ 1 1 + DEPENDS vector-ops + TIMEOUT 45 + LABELS "integration-tests" + WILL_FAIL + DISABLED ${IS_DISABLED} + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "ROCPROF_TESTING_RAISE_SIGNAL=1" + "ROCPROF_INTERNAL_TEST_SIGNAL_HANDLER_VIA_EXIT=1" + FIXTURES_SETUP rocprofv3-test-app-abort) -set_tests_properties( - rocprofv3-test-execute-app-abort - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${aborted-app-env}" - WILL_FAIL - TRUE - DISABLED - "${DISABLE_THIS_TEST}") - -add_test( - NAME rocprofv3-test-validate-app-abort - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/out-aborted-app/out_results.json) - -set_tests_properties( - rocprofv3-test-validate-app-abort - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - "rocprofv3-test-execute-app-abort" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${DISABLE_THIS_TEST}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-app-abort + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini input.json + TIMEOUT 45 + LABELS "integration-tests" + DISABLED ${IS_DISABLED} + FIXTURES_REQUIRED rocprofv3-test-app-abort + ARGS --json-input ${CMAKE_CURRENT_BINARY_DIR}/out-aborted-app/out_results.json) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/aborted-app/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/aborted-app/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/aborted-app/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/aborted-app/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/advanced-thread-trace/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/advanced-thread-trace/CMakeLists.txt index ed00d3cc0b..18ad97ac51 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/advanced-thread-trace/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/advanced-thread-trace/CMakeLists.txt @@ -69,72 +69,66 @@ if(ROCPROFILER_DISABLE_UNSTABLE_CTESTS) endif() # hsa multiqueue dependency test with lib path -add_test( - NAME rocprofv3-test-att-hsa-multiqueue-cmd-env-att-lib-path-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-att-hsa-multiqueue-cmd-env-att-lib-path COMMAND $ ${COMMON_PARAMS}/cmd_input --att-target-cu 1 --att-shader-engine-mask 0x11 --kernel-include-regex copyD --att-buffer-size 0x6000000 --att-simd-select 0x3 --att-serialize-all 1 -o out -- - $) - -set_tests_properties( - rocprofv3-test-att-hsa-multiqueue-cmd-env-att-lib-path-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DISABLED ${IS_DISABLED}) + $ + DEPENDS hsa_code_object_testapp + LABELS "integration-tests" + TIMEOUT 45 + DISABLED ${IS_DISABLED} + FIXTURES_SETUP rocprofv3-test-att-hsa-multiqueue-cmd-env-att-lib-path) # hsa multiqueue dependency test with json input -add_test( - NAME rocprofv3-test-att-hsa-multiqueue-json-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-att-hsa-multiqueue-json COMMAND $ ${COMMON_PARAMS}/json_input -i ${CMAKE_CURRENT_BINARY_DIR}/att_input.json -- - $) - -set_tests_properties( - rocprofv3-test-att-hsa-multiqueue-json-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DISABLED ${IS_DISABLED}) + $ + DEPENDS hsa_code_object_testapp + LABELS "integration-tests" + TIMEOUT 45 + DISABLED ${IS_DISABLED} + FIXTURES_SETUP rocprofv3-test-att-hsa-multiqueue-json) # validate output -add_test( - NAME rocprofv3-test-att-hsa-multiqueue-cmd-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --input - ${CMAKE_CURRENT_BINARY_DIR}/hsa_code_object_testapp-trace/cmd_input/out_results.json - --code-object-input ${CMAKE_CURRENT_BINARY_DIR} --output-path - ${CMAKE_CURRENT_BINARY_DIR}/hsa_code_object_testapp-trace/cmd_input) +rocprofiler_add_integration_validate_test( + rocprofv3-test-att-hsa-multiqueue-cmd + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + TIMEOUT 45 + LABELS "integration-tests" + DISABLED ${IS_DISABLED} + FIXTURES_REQUIRED rocprofv3-test-att-hsa-multiqueue-cmd-env-att-lib-path + ARGS --input + ${CMAKE_CURRENT_BINARY_DIR}/hsa_code_object_testapp-trace/cmd_input/out_results.json + --code-object-input + ${CMAKE_CURRENT_BINARY_DIR} + --output-path + ${CMAKE_CURRENT_BINARY_DIR}/hsa_code_object_testapp-trace/cmd_input + FAIL_REGULAR_EXPRESSION "AssertionError") -add_test( - NAME rocprofv3-test-att-hsa-multiqueue-json-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --input - ${CMAKE_CURRENT_BINARY_DIR}/hsa_code_object_testapp-trace/json_input/out_results.json - --code-object-input ${CMAKE_CURRENT_BINARY_DIR} --output-path - ${CMAKE_CURRENT_BINARY_DIR}/hsa_code_object_testapp-trace/json_input) - -set_tests_properties( - rocprofv3-test-att-hsa-multiqueue-cmd-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - "rocprofv3-test-att-hsa-multiqueue-cmd-ld-lib-path-execute" - FAIL_REGULAR_EXPRESSION - "AssertionError" - DISABLED - ${IS_DISABLED}) - -set_tests_properties( - rocprofv3-test-att-hsa-multiqueue-json-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - "rocprofv3-test-att-hsa-multiqueue-json-execute" - FAIL_REGULAR_EXPRESSION - "AssertionError" - DISABLED - ${IS_DISABLED}) +rocprofiler_add_integration_validate_test( + rocprofv3-test-att-hsa-multiqueue-json + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-att-hsa-multiqueue-json + DISABLED ${IS_DISABLED} + ARGS --input + ${CMAKE_CURRENT_BINARY_DIR}/hsa_code_object_testapp-trace/json_input/out_results.json + --code-object-input + ${CMAKE_CURRENT_BINARY_DIR} + --output-path + ${CMAKE_CURRENT_BINARY_DIR}/hsa_code_object_testapp-trace/json_input + FAIL_REGULAR_EXPRESSION "AssertionError") function(configure_att_input _FILENAME) set(LIB_PATH_LOC "${attdecoder_LIB_DIR}") @@ -146,93 +140,93 @@ configure_att_input(att_input.yml) configure_att_input(att_input_will_fail.yml) # test yaml input -add_test( - NAME rocprofv3-test-att-yaml-input +rocprofiler_add_integration_execute_test( + rocprofv3-test-att-yaml-input COMMAND $ ${COMMON_PARAMS_NO_LIB}/yaml -i ${CMAKE_CURRENT_BINARY_DIR}/att_input.yml --echo -- - $) - -set_tests_properties( - rocprofv3-test-att-yaml-input PROPERTIES TIMEOUT 45 LABELS "integration-tests" - DISABLED ${IS_DISABLED}) + $ + DEPENDS hsa_code_object_testapp + TIMEOUT 45 + LABELS "integration-tests" + DISABLED ${IS_DISABLED}) # Invalid lib path has to fail -add_test( - NAME rocprofv3-test-att-yaml-input-will-fail +rocprofiler_add_integration_execute_test( + rocprofv3-test-att-yaml-input-will-fail COMMAND $ -i ${CMAKE_CURRENT_BINARY_DIR}/att_input_will_fail.yml --log-level env --echo -- - $) + $ + DEPENDS hsa_code_object_testapp + TIMEOUT 45 + LABELS "integration-tests" + WILL_FAIL + DISABLED ${IS_DISABLED}) -set_tests_properties( - rocprofv3-test-att-yaml-input-will-fail - PROPERTIES TIMEOUT 45 LABELS "integration-tests" WILL_FAIL ON DISABLED ${IS_DISABLED}) - -add_test(NAME rocprofv3-test-att-library-path-cmd-line-will-fail - COMMAND $ --att --att-library-path . - --log-level env --echo -- $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( rocprofv3-test-att-library-path-cmd-line-will-fail - PROPERTIES TIMEOUT 45 LABELS "integration-tests" WILL_FAIL ON DISABLED ${IS_DISABLED}) + COMMAND $ --att --att-library-path . + --log-level env --echo -- $ + DEPENDS hsa_code_object_testapp + TIMEOUT 45 + LABELS "integration-tests" + WILL_FAIL + DISABLED ${IS_DISABLED}) -add_test( - NAME rocprofv3-test-att-library-path-env-var-will-fail - COMMAND $ ${COMMON_PARAMS_NO_LIB}/envfail - --att-library-path . --echo -- $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( rocprofv3-test-att-library-path-env-var-will-fail - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "ROCPROF_ATT_LIBRARY_PATH=${attdecoder_LIB_DIR}" - WILL_FAIL - ON - DISABLED - ${IS_DISABLED}) + COMMAND $ ${COMMON_PARAMS_NO_LIB}/envfail + --att-library-path . --echo -- $ + DEPENDS hsa_code_object_testapp + TIMEOUT 45 + LABELS "integration-tests" + WILL_FAIL + DISABLED ${IS_DISABLED} + ENVIRONMENT "ROCPROF_ATT_LIBRARY_PATH=${attdecoder_LIB_DIR}") -add_test(NAME rocprofv3-test-att-env-var - COMMAND $ ${COMMON_PARAMS_NO_LIB}/envvar - -- $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( rocprofv3-test-att-env-var - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT - "ROCPROF_ATT_LIBRARY_PATH=${attdecoder_LIB_DIR}" DISABLED ${IS_DISABLED}) - + COMMAND $ ${COMMON_PARAMS_NO_LIB}/envvar -- + $ + DEPENDS hsa_code_object_testapp + TIMEOUT 45 + LABELS "integration-tests" + DISABLED ${IS_DISABLED} + ENVIRONMENT "ROCPROF_ATT_LIBRARY_PATH=${attdecoder_LIB_DIR}") # # Uses ATT and Counter Collection at the same time # -add_test(NAME rocprofv3-test-att-hsa-multiqueue-plus-pmc-execute - COMMAND $ ${COMMON_PARAMS}/cmd_input - --pmc SQ_WAVES -o out -- $) - -set_tests_properties( - rocprofv3-test-att-hsa-multiqueue-plus-pmc-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DISABLED ${IS_DISABLED}) +rocprofiler_add_integration_execute_test( + rocprofv3-test-att-hsa-multiqueue-plus-pmc + COMMAND $ ${COMMON_PARAMS}/cmd_input --pmc + SQ_WAVES -o out -- $ + DEPENDS vector-ops + TIMEOUT 45 + LABELS "integration-tests" + DISABLED ${IS_DISABLED}) # Check for conflict PMC + activity -add_test(NAME rocprofv3-test-att-hsa-multiqueue-activity-pmc-will-fail - COMMAND $ ${COMMON_PARAMS}/cmd_input - --pmc SQ_WAVES -o out --att-activity 8 -- $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( rocprofv3-test-att-hsa-multiqueue-activity-pmc-will-fail - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DISABLED ${IS_DISABLED} WILL_FAIL ON) + COMMAND $ ${COMMON_PARAMS}/cmd_input --pmc + SQ_WAVES -o out --att-activity 8 -- $ + DEPENDS vector-ops + TIMEOUT 45 + LABELS "integration-tests" + WILL_FAIL + DISABLED ${IS_DISABLED}) # Check for conflict Perfcounters + activity -add_test( - NAME rocprofv3-test-att-hsa-multiqueue-activity-perf-will-fail - COMMAND $ ${COMMON_PARAMS}/cmd_input - --att-perfcounter-ctrl 8 -o out --att-activity 8 -- $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( rocprofv3-test-att-hsa-multiqueue-activity-perf-will-fail - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DISABLED ${IS_DISABLED} WILL_FAIL ON) + COMMAND $ ${COMMON_PARAMS}/cmd_input + --att-perfcounter-ctrl 8 -o out --att-activity 8 -- $ + DEPENDS vector-ops + TIMEOUT 45 + LABELS "integration-tests" + WILL_FAIL + DISABLED ${IS_DISABLED}) # ATT plus PC sampling @@ -248,39 +242,34 @@ endif() set(PCS_ARGS --pc-sampling-beta-enabled 1 --pc-sampling-unit cycles --pc-sampling-interval 16384 --pc-sampling-method stochastic) -add_test(NAME rocprofv3-test-att-plus-pc-sampling - COMMAND $ ${COMMON_PARAMS}/cmd_input - ${PCS_ARGS} -o out -- $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( rocprofv3-test-att-plus-pc-sampling - PROPERTIES TIMEOUT 90 LABELS "integration-tests;thread-trace;pc-sampling" DISABLED - ${ATT_PLUS_PCS_DISABLE}) + COMMAND $ ${COMMON_PARAMS}/cmd_input + ${PCS_ARGS} -o out -- $ + DEPENDS vector-ops + TIMEOUT 90 + LABELS "integration-tests;thread-trace;pc-sampling" + DISABLED ${ATT_PLUS_PCS_DISABLE}) # Trace two GPUs -add_test(NAME rocprofv3-test-att-gpu-index-two-gpus - COMMAND $ ${COMMON_PARAMS}/cmd_input -o - out --att-gpu-index 0,1 -- $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( rocprofv3-test-att-gpu-index-two-gpus - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DISABLED ${IS_DISABLED}) + COMMAND $ ${COMMON_PARAMS}/cmd_input -o out + --att-gpu-index 0,1 -- $ + DEPENDS vector-ops + TIMEOUT 45 + LABELS "integration-tests" + DISABLED ${IS_DISABLED}) -# No machine has gpu index = 9999 -add_test(NAME rocprofv3-test-att-gpu-index-will-fail - COMMAND $ ${COMMON_PARAMS}/cmd_input -o - out --att-gpu-index 0,9999 -- $) - -# The FAIL regex for this test is the ROCP_ERROR specific to invalid device index -set_tests_properties( +# No machine has gpu index = 9999 The FAIL regex for this test is the ROCP_ERROR specific +# to invalid device index +rocprofiler_add_integration_execute_test( rocprofv3-test-att-gpu-index-will-fail - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DISABLED - ${IS_DISABLED} - WILL_FAIL - True - FAIL_REGULAR_EXPRESSION - "Invalid GPU Device Index") + COMMAND $ ${COMMON_PARAMS}/cmd_input -o out + --att-gpu-index 0,9999 -- $ + DEPENDS vector-ops + TIMEOUT 45 + LABELS "integration-tests" + WILL_FAIL + DISABLED ${IS_DISABLED} + FAIL_REGULAR_EXPRESSION "Invalid GPU Device Index") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/advanced-thread-trace/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/advanced-thread-trace/pytest.ini index e2027e2fd5..b4e84a8818 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/advanced-thread-trace/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/advanced-thread-trace/pytest.ini @@ -22,6 +22,6 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/agent-index/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/agent-index/CMakeLists.txt index 750c33b39a..ff76b269ca 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/agent-index/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/agent-index/CMakeLists.txt @@ -35,90 +35,112 @@ find_package(rocprofiler-sdk REQUIRED) string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(tracing-env "${PRELOAD_ENV}") - -rocprofiler_configure_pytest_files( - CONFIG pytest.ini - COPY validate.py conftest.py input_absolute_agent_index.yaml - input_type_relative_agent_index.yaml input_relative_agent_index.yaml) if(ROCPROFILER_MEMCHECK STREQUAL "LeakSanitizer") set(LOG_LEVEL "warning") # info produces memory leak else() set(LOG_LEVEL "info") endif() -set(execute_tests - rocprofv3-test-agent-index-json-absolute-execute - rocprofv3-test-agent-index-json-type-relative-execute - rocprofv3-test-agent-index-json-relative-execute) -set(input_files - ${CMAKE_CURRENT_BINARY_DIR}/input_absolute_agent_index.yaml - ${CMAKE_CURRENT_BINARY_DIR}/input_type_relative_agent_index.yaml - ${CMAKE_CURRENT_BINARY_DIR}/input_relative_agent_index.yaml) -set(output_dir - ${CMAKE_CURRENT_BINARY_DIR}/%argt%-agent-index-absolute - ${CMAKE_CURRENT_BINARY_DIR}/%argt%-agent-index-type-relative - ${CMAKE_CURRENT_BINARY_DIR}/%argt%-agent-index-relative) +rocprofiler_add_integration_execute_test( + rocprofv3-test-agent-index-json-absolute + COMMAND + $ -i + ${CMAKE_CURRENT_BINARY_DIR}/input_absolute_agent_index.yaml -d + ${CMAKE_CURRENT_BINARY_DIR}/%argt%-agent-index-absolute --log-level ${LOG_LEVEL} + -- $ + DEPENDS transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-agent-index-json-absolute) -list(LENGTH execute_tests execute_test_length) -foreach(i RANGE 0 ${execute_test_length}) - if(${i} EQUAL ${execute_test_length}) - break() - endif() - list(GET execute_tests ${i} test_name) - list(GET input_files ${i} input_file) - list(GET output_dir ${i} output) - add_test(NAME ${test_name} - COMMAND $ -i ${input_file} -d - ${output} --log-level ${LOG_LEVEL} -- $) - set_tests_properties( - ${test_name} - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${tracing-env}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") -endforeach() +rocprofiler_add_integration_execute_test( + rocprofv3-test-agent-index-json-type-relative + COMMAND + $ -i + ${CMAKE_CURRENT_BINARY_DIR}/input_type_relative_agent_index.yaml -d + ${CMAKE_CURRENT_BINARY_DIR}/%argt%-agent-index-type-relative --log-level + ${LOG_LEVEL} -- $ + DEPENDS transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-agent-index-json-type-relative) -set(agent_index_types absolute relative type-relative) -set(validate_tests - rocprofv3-test-agent-index-json-absolute-validate - rocprofv3-test-agent-index-json-relative-validate - rocprofv3-test-agent-index-json-type-relative-validate) -set(output_dir_name transpose-agent-index-absolute transpose-agent-index-relative - transpose-agent-index-type-relative) +rocprofiler_add_integration_execute_test( + rocprofv3-test-agent-index-json-relative + COMMAND + $ -i + ${CMAKE_CURRENT_BINARY_DIR}/input_relative_agent_index.yaml -d + ${CMAKE_CURRENT_BINARY_DIR}/%argt%-agent-index-relative --log-level ${LOG_LEVEL} + -- $ + DEPENDS transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-agent-index-json-relative) -list(LENGTH validate_tests validate_test_length) -foreach(i RANGE 0 ${validate_test_length}) - if(${i} EQUAL ${validate_test_length}) - break() - endif() - list(GET validate_tests ${i} test_name) - list(GET agent_index_types ${i} agent_index) - list(GET output_dir_name ${i} output) - add_test( - NAME ${test_name} - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --agent-index - ${agent_index} --csv-kernel-input - ${CMAKE_CURRENT_BINARY_DIR}/${output}/out_kernel_trace.csv - --csv-memory-allocation-input - ${CMAKE_CURRENT_BINARY_DIR}/${output}/out_memory_allocation_trace.csv - --csv-memory-copy-input - ${CMAKE_CURRENT_BINARY_DIR}/${output}/out_memory_copy_trace.csv --json-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-absolute/out_results.json) -endforeach() +rocprofiler_add_integration_validate_test( + rocprofv3-test-agent-index-json-absolute + TEST_PATHS validate.py + COPY conftest.py input_absolute_agent_index.yaml input_type_relative_agent_index.yaml + input_relative_agent_index.yaml + CONFIG pytest.ini + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-agent-index-json-absolute + ARGS --agent-index + absolute + --csv-kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-absolute/out_kernel_trace.csv + --csv-memory-allocation-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-absolute/out_memory_allocation_trace.csv + --csv-memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-absolute/out_memory_copy_trace.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-absolute/out_results.json + FAIL_REGULAR_EXPRESSION "AssertionError") -set(dependency_tests - rocprofv3-test-agent-index-json-absolute-execute - rocprofv3-test-agent-index-json-relative-execute;rocprofv3-test-agent-index-json-absolute-execute - rocprofv3-test-agent-index-json-type-relative-execute;rocprofv3-test-agent-index-json-absolute-execute - ) +rocprofiler_add_integration_validate_test( + rocprofv3-test-agent-index-json-relative + TEST_PATHS validate.py + COPY conftest.py input_absolute_agent_index.yaml input_type_relative_agent_index.yaml + input_relative_agent_index.yaml + CONFIG pytest.ini + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-agent-index-json-relative + rocprofv3-test-agent-index-json-absolute + ARGS --agent-index + relative + --csv-kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-relative/out_kernel_trace.csv + --csv-memory-allocation-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-relative/out_memory_allocation_trace.csv + --csv-memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-relative/out_memory_copy_trace.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-absolute/out_results.json + FAIL_REGULAR_EXPRESSION "AssertionError") -foreach(i RANGE 0 ${validate_test_length}) - if(${i} EQUAL ${validate_test_length}) - break() - endif() - list(GET validate_tests ${i} test_name) - list(GET dependency_tests ${i} dep) - set_tests_properties( - ${test_name} PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS ${dep} - FAIL_REGULAR_EXPRESSION "AssertionError") -endforeach() +rocprofiler_add_integration_validate_test( + rocprofv3-test-agent-index-json-type-relative + TEST_PATHS validate.py + COPY conftest.py input_absolute_agent_index.yaml input_type_relative_agent_index.yaml + input_relative_agent_index.yaml + CONFIG pytest.ini + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-agent-index-json-type-relative + rocprofv3-test-agent-index-json-absolute + ARGS --agent-index + type-relative + --csv-kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-type-relative/out_kernel_trace.csv + --csv-memory-allocation-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-type-relative/out_memory_allocation_trace.csv + --csv-memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-type-relative/out_memory_copy_trace.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-agent-index-absolute/out_results.json + FAIL_REGULAR_EXPRESSION "AssertionError") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/agent-index/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/agent-index/pytest.ini index e2027e2fd5..b4e84a8818 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/agent-index/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/agent-index/pytest.ini @@ -22,6 +22,6 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/att-consecutive-kernels/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/att-consecutive-kernels/CMakeLists.txt index b5062c7b92..b1bab65b97 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/att-consecutive-kernels/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/att-consecutive-kernels/CMakeLists.txt @@ -66,30 +66,27 @@ if(ROCPROFILER_DISABLE_UNSTABLE_CTESTS) endif() # consecutive kernel test -add_test( - NAME rocprofv3-test-att-consecutive-kernels-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-att-consecutive-kernels COMMAND $ ${ATT_LIB} --att --att-consecutive-kernels 8 -d ${CMAKE_CURRENT_BINARY_DIR}/%tag%-trace -o out - --log-level env -- $) + --log-level env -- $ + DEPENDS vector-ops + TIMEOUT 45 + LABELS "integration-tests" + DISABLED ${IS_DISABLED} + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-att-consecutive-kernels) -set_tests_properties( - rocprofv3-test-att-consecutive-kernels-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DISABLED ${IS_DISABLED}) - -add_test(NAME rocprofv3-test-att-consecutive-kernels-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py - --csv-directory-input ${CMAKE_CURRENT_BINARY_DIR}/vector-ops-trace/) - -set_tests_properties( - rocprofv3-test-att-consecutive-kernels-validate - PROPERTIES TIMEOUT - 60 - LABELS - "integration-tests" - DEPENDS - rocprofv3-test-att-consecutive-kernels-execute - FAIL_REGULAR_EXPRESSION - "AssertionError" - DISABLED - ${IS_DISABLED}) +rocprofiler_add_integration_validate_test( + rocprofv3-test-att-consecutive-kernels + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + TIMEOUT 60 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-att-consecutive-kernels + DISABLED ${IS_DISABLED} + ARGS --csv-directory-input ${CMAKE_CURRENT_BINARY_DIR}/vector-ops-trace/ + FAIL_REGULAR_EXPRESSION "AssertionError") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/att-consecutive-kernels/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/att-consecutive-kernels/pytest.ini index e2027e2fd5..b4e84a8818 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/att-consecutive-kernels/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/att-consecutive-kernels/pytest.ini @@ -22,6 +22,6 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-once/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-once/CMakeLists.txt index aa74876a43..82bb2a33d2 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-once/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-once/CMakeLists.txt @@ -29,86 +29,64 @@ string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") set(attachment-env - "${PRELOAD_ENV}" "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" ) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py) - # Test that launches the app and attaches to it (CSV format) -add_test( - NAME rocprofv3-test-attachment-attach-once-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-attachment-attach-once COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_attachment_test_unified.sh $ $ - ${CMAKE_CURRENT_BINARY_DIR} ${LOG_LEVEL} out) - -set_tests_properties( - rocprofv3-test-attachment-attach-once-execute - PROPERTIES TIMEOUT - 60 - LABELS - "integration-tests;attachment" - ENVIRONMENT - "${attachment-env}" - FAIL_REGULAR_EXPRESSION - "ERROR|FATAL|${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "This test is skipped." - FIXTURES_SETUP - rocprofv3-test-attachment-attach-once - DISABLED - "${IS_DISABLED}") - + ${CMAKE_CURRENT_BINARY_DIR} ${LOG_LEVEL} out + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 60 + LABELS "integration-tests;attachment" + DISABLED ${IS_DISABLED} + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "${attachment-env}" + SKIP_REGULAR_EXPRESSION "This test is skipped." + FIXTURES_SETUP rocprofv3-test-attachment-attach-once + FAIL_REGULAR_EXPRESSION "ERROR|FATAL|${ROCPROFILER_DEFAULT_FAIL_REGEX}") # Validate the output from the attached profiling -add_test( - NAME rocprofv3-test-attachment-attach-once-csv-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --kernel-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_kernel_trace.csv --hsa-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_hsa_api_trace.csv - --memory-copy-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_memory_copy_trace.csv - --agent-input ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_agent_info.csv - --skip-if ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/skipped) +rocprofiler_add_integration_validate_test( + rocprofv3-test-attachment-attach-once-csv + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + TIMEOUT 30 + LABELS "integration-tests;attachment" + DISABLED ${IS_DISABLED} + SKIP_REGULAR_EXPRESSION "SKIPPED" + FIXTURES_REQUIRED rocprofv3-test-attachment-attach-once + ARGS --kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_kernel_trace.csv + --hsa-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_hsa_api_trace.csv + --memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_memory_copy_trace.csv + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_agent_info.csv + --skip-if + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/skipped) -set_tests_properties( - rocprofv3-test-attachment-attach-once-csv-validate - PROPERTIES TIMEOUT - 30 - LABELS - "integration-tests;attachment" - DEPENDS - rocprofv3-test-attachment-attach-once-execute - SKIP_REGULAR_EXPRESSION - "SKIPPED" - FIXTURES_REQUIRED - rocprofv3-test-attachment-attach-once - DISABLED - "${IS_DISABLED}") - -add_test( - NAME rocprofv3-test-attachment-attach-once-json-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --kernel-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json --hsa-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json - --memory-copy-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json --skip-if - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/skipped) - -set_tests_properties( - rocprofv3-test-attachment-attach-once-json-validate - PROPERTIES TIMEOUT - 30 - LABELS - "integration-tests;attachment" - DEPENDS - rocprofv3-test-attachment-attach-once-execute - SKIP_REGULAR_EXPRESSION - "SKIPPED" - FIXTURES_REQUIRED - rocprofv3-test-attachment-attach-once - DISABLED - "${IS_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-attachment-attach-once-json + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + TIMEOUT 30 + LABELS "integration-tests;attachment" + DISABLED ${IS_DISABLED} + SKIP_REGULAR_EXPRESSION "SKIPPED" + FIXTURES_REQUIRED rocprofv3-test-attachment-attach-once + ARGS --kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json + --hsa-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json + --memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json + --skip-if + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/skipped) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-once/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-once/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-once/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-once/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-twice/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-twice/CMakeLists.txt index b10667dab9..13a2d45a37 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-twice/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-twice/CMakeLists.txt @@ -28,87 +28,61 @@ endif() string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(attachment-env - "${PRELOAD_ENV}" - "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" - ) - -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py) - # Test that launches the app and reattaches to it twice (CSV format) -add_test( - NAME rocprofv3-test-attachment-attach-twice-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-attachment-attach-twice COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_attachment_test_unified.sh $ $ - ${CMAKE_CURRENT_BINARY_DIR} ${LOG_LEVEL} out) - -set_tests_properties( - rocprofv3-test-attachment-attach-twice-execute - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;attachment" - ENVIRONMENT - "${attachment-env}" - FAIL_REGULAR_EXPRESSION - "ERROR|FATAL|${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "This test is skipped." - FIXTURES_SETUP - rocprofv3-test-attachment-attach-twice - DISABLED - "${IS_DISABLED}") + ${CMAKE_CURRENT_BINARY_DIR} ${LOG_LEVEL} out + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;attachment" + PRELOAD "${PRELOAD_ENV}" + FAIL_REGULAR_EXPRESSION "ERROR|FATAL|${ROCPROFILER_DEFAULT_FAIL_REGEX}" + SKIP_REGULAR_EXPRESSION "This test is skipped." + FIXTURES_SETUP rocprofv3-test-attachment-attach-twice + DISABLED "${IS_DISABLED}") # Validate the output from the reattached profiling (CSV) -add_test( - NAME rocprofv3-test-attachment-attach-twice-csv-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --kernel-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_kernel_trace.csv --hsa-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_hsa_api_trace.csv - --memory-copy-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_memory_copy_trace.csv - --agent-input ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_agent_info.csv - --skip-if ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/skipped) +rocprofiler_add_integration_validate_test( + rocprofv3-test-attachment-attach-twice-csv + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_kernel_trace.csv + --hsa-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_hsa_api_trace.csv + --memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_memory_copy_trace.csv + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_agent_info.csv + --skip-if + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/skipped + TIMEOUT 30 + LABELS "integration-tests;attachment" + SKIP_REGULAR_EXPRESSION "SKIPPED" + FIXTURES_REQUIRED rocprofv3-test-attachment-attach-twice + DISABLED "${IS_DISABLED}") -set_tests_properties( - rocprofv3-test-attachment-attach-twice-csv-validate - PROPERTIES TIMEOUT - 30 - LABELS - "integration-tests;attachment" - DEPENDS - rocprofv3-test-attachment-attach-twice-execute - SKIP_REGULAR_EXPRESSION - "SKIPPED" - FIXTURES_REQUIRED - rocprofv3-test-attachment-attach-twice - DISABLED - "${IS_DISABLED}") - -add_test( - NAME rocprofv3-test-attachment-attach-twice-json-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --kernel-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json --hsa-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json - --memory-copy-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json --skip-if - ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/skipped) - -set_tests_properties( - rocprofv3-test-attachment-attach-twice-json-validate - PROPERTIES TIMEOUT - 30 - LABELS - "integration-tests;attachment" - DEPENDS - rocprofv3-test-attachment-attach-twice-execute - SKIP_REGULAR_EXPRESSION - "SKIPPED" - FIXTURES_REQUIRED - rocprofv3-test-attachment-attach-twice - DISABLED - "${IS_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-attachment-attach-twice-json + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json + --hsa-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json + --memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/out_results.json + --skip-if + ${CMAKE_CURRENT_BINARY_DIR}/attachment-output/skipped + TIMEOUT 30 + LABELS "integration-tests;attachment" + SKIP_REGULAR_EXPRESSION "SKIPPED" + FIXTURES_REQUIRED rocprofv3-test-attachment-attach-twice + DISABLED "${IS_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-twice/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-twice/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-twice/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/attachment/attach-twice/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/collection-period/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/collection-period/CMakeLists.txt index b09aba2312..9aeacd0258 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/collection-period/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/collection-period/CMakeLists.txt @@ -29,52 +29,35 @@ rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.p # ########################################################################################## -add_test( - NAME rocprofv3-test-collection-period-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-collection-period COMMAND $ --runtime-trace --summary -d ${CMAKE_CURRENT_BINARY_DIR}/collection-period -o out --output-format csv json pftrace otf2 --log-level warning --collection-period 0:1:1 1:1:2 0.5:0.5:0 - --collection-period-unit sec -- $ 5000 4) + --collection-period-unit sec -- $ 5000 4 + DEPENDS reproducible-runtime + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "ROCPROF_COLLECTION_PERIOD_TESTING=true" + FIXTURES_SETUP rocprofv3-test-collection-period + UNSTABLE) -set_tests_properties( - rocprofv3-test-collection-period-execute - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${collection-period-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}") # Once stable, should be disabled - # via IS_THREAD_SANITIZER (thread - # sanitizer has too much - # overhead) - -add_test( - NAME rocprofv3-test-collection-period-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/collection-period/out_results.json --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/collection-period/out_results.pftrace --otf2-input - ${CMAKE_CURRENT_BINARY_DIR}/collection-period/out_results.otf2 - --collection-period-input - ${CMAKE_CURRENT_BINARY_DIR}/collection-period/out_collection_periods.log) - -set_tests_properties( - rocprofv3-test-collection-period-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - "rocprofv3-test-collection-period-execute" - FAIL_REGULAR_EXPRESSION - "AssertionError" - DISABLED - "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}") # Once stable, should be disabled - # via IS_THREAD_SANITIZER (thread - # sanitizer has too much - # overhead) +rocprofiler_add_integration_validate_test( + rocprofv3-test-collection-period + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/collection-period/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/collection-period/out_results.pftrace + --otf2-input + ${CMAKE_CURRENT_BINARY_DIR}/collection-period/out_results.otf2 + --collection-period-input + ${CMAKE_CURRENT_BINARY_DIR}/collection-period/out_collection_periods.log + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-collection-period + UNSTABLE) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/collection-period/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/collection-period/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/collection-period/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/collection-period/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/conversion-script/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/conversion-script/CMakeLists.txt index 85af3356cb..3a7a2a8a62 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/conversion-script/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/conversion-script/CMakeLists.txt @@ -34,23 +34,21 @@ find_package(rocprofiler-sdk REQUIRED) rocprofiler_configure_pytest_files(COPY validate.py input.txt conftest.py CONFIG pytest.ini) -add_test( - NAME rocprofv3-test-conversion-script-execute - COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.txt -T -d - ${CMAKE_CURRENT_BINARY_DIR}/out_conversion_script -o pmc1 --output-format csv -- - $) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(cc-env-pmc "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-conversion-script-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${cc-env-pmc}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_execute_test( + rocprofv3-test-conversion-script + COMMAND + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.txt + -T -d ${CMAKE_CURRENT_BINARY_DIR}/out_conversion_script -o pmc1 --output-format + csv -- $ + DEPENDS vector-ops + LABELS "integration-tests" + TIMEOUT 45 + PRELOAD "${PRELOAD_ENV}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + FIXTURES_SETUP rocprofv3-test-conversion-script) set(convert_tests rocprofv3-test-conversion-script-convert-no-agent-prefix rocprofv3-test-conversion-script-convert-agent-prefix) @@ -74,45 +72,41 @@ foreach(i RANGE 0 ${convert_test_length}) list(GET agent_index_flag ${i} flag) list(GET validate_tests ${i} validate_test_name) if(${flag}) - add_test( - NAME ${test_name} - COMMAND - ${Python3_EXECUTABLE} - $ - --input ${CMAKE_CURRENT_BINARY_DIR}/out_conversion_script --output - ${output} --retain-agent-prefix) - - add_test(NAME ${validate_test_name} - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py - ${PYTEST_ARGS} --input ${output} --retain-agent-prefix true) + set(conversion_cmd + ${Python3_EXECUTABLE} + $ + --input + ${CMAKE_CURRENT_BINARY_DIR}/out_conversion_script + --output + ${output} + --retain-agent-prefix) + set(validate_args --retain-agent-prefix true) else() - add_test( - NAME ${test_name} - COMMAND - ${Python3_EXECUTABLE} - $ - --input ${CMAKE_CURRENT_BINARY_DIR}/out_conversion_script --output - ${output}) - - add_test(NAME ${validate_test_name} - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py - ${PYTEST_ARGS} --input ${output} --retain-agent-prefix false) + set(conversion_cmd + ${Python3_EXECUTABLE} + $ --input + ${CMAKE_CURRENT_BINARY_DIR}/out_conversion_script --output ${output}) + set(validate_args --retain-agent-prefix false) endif() - set_tests_properties( + + rocprofiler_add_integration_execute_test( ${test_name} - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - rocprofv3-test-conversion-script-execute FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - set_tests_properties( + COMMAND ${conversion_cmd} + DEPENDS rocprofiler-sdk::convert-counters-collection-format + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_REQUIRED rocprofv3-test-conversion-script + FIXTURES_SETUP ${test_name}) + + rocprofiler_add_integration_validate_test( ${validate_test_name} - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - ${test_name} - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}") + TEST_PATHS validate.py + COPY conftest.py input.txt + CONFIG pytest.ini + ARGS --input ${output} ${validate_args} + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED ${test_name} + UNSTABLE) endforeach() diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/conversion-script/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/conversion-script/pytest.ini index e2027e2fd5..b4e84a8818 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/conversion-script/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/conversion-script/pytest.ini @@ -22,6 +22,6 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/extra_counters/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/extra_counters/CMakeLists.txt index 8919fb8b6f..9551dc2ef0 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/extra_counters/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/extra_counters/CMakeLists.txt @@ -10,38 +10,29 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py - input.txt extra_counters.yaml) - -# pmc1 with extra counters -add_test( - NAME rocprofv3-test-counter-collection-txt-pmc1-extra-counters-execute - COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.txt -E - ${CMAKE_CURRENT_BINARY_DIR}/extra_counters.yaml -T -d - ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_1_extra -o pmc1 - --output-format csv -- $) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") - -set(cc-env-pmc1 "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-counter-collection-txt-pmc1-extra-counters-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${cc-env-pmc1}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-counter-collection-pmc1-extra-counters-validate +# pmc1 with extra counters +rocprofiler_add_integration_execute_test( + rocprofv3-test-counter-collection-txt-pmc1-extra-counters COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --input - ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_1_extra/pmc_1/pmc1_counter_collection.csv - ) + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.txt + -E ${CMAKE_CURRENT_BINARY_DIR}/extra_counters.yaml -T -d + ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_1_extra -o pmc1 --output-format + csv -- $ + DEPENDS vector-ops + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-counter-collection-txt-pmc1-extra-counters) -set_tests_properties( - rocprofv3-test-counter-collection-pmc1-extra-counters-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-counter-collection-txt-pmc1-extra-counters-execute" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-counter-collection-pmc1-extra-counters + TEST_PATHS validate.py + COPY conftest.py input.txt extra_counters.yaml + CONFIG pytest.ini + ARGS --input + ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_1_extra/pmc_1/pmc1_counter_collection.csv + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-counter-collection-txt-pmc1-extra-counters) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/extra_counters/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/extra_counters/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/extra_counters/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/extra_counters/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input1/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input1/CMakeLists.txt index 541ce42bc4..90817c000e 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input1/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input1/CMakeLists.txt @@ -13,35 +13,31 @@ find_package(rocprofiler-sdk REQUIRED) rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py input.txt) -# pmc1 -add_test( - NAME rocprofv3-test-counter-collection-txt-pmc1-execute - COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.txt -T -d - ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_1 -o pmc1 --output-format csv - json -- $) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(cc-env-pmc1 "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-counter-collection-txt-pmc1-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${cc-env-pmc1}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-counter-collection-pmc1-validate +# pmc1 +rocprofiler_add_integration_execute_test( + rocprofv3-test-counter-collection-txt-pmc1 COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --input - ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_1/pmc_1/pmc1_counter_collection.csv - --json-input - ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_1/pmc_1/pmc1_results.json) + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.txt + -T -d ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_1 -o pmc1 --output-format + csv json -- $ + DEPENDS vector-ops + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-counter-collection-txt-pmc1) -set_tests_properties( - rocprofv3-test-counter-collection-pmc1-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-counter-collection-txt-pmc1-execute" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-counter-collection-pmc1 + TEST_PATHS validate.py + COPY conftest.py input.txt + CONFIG pytest.ini + ARGS --input + ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_1/pmc_1/pmc1_counter_collection.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_1/pmc_1/pmc1_results.json + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-counter-collection-txt-pmc1) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input1/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input1/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input1/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input1/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input2/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input2/CMakeLists.txt index 7cf1359ac8..b18178afc4 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input2/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input2/CMakeLists.txt @@ -10,41 +10,35 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py - input.txt) - -# pmc2 -add_test( - NAME rocprofv3-test-counter-collection-txt-pmc2-execute - COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.txt --output-format CSV JSON -d - ${CMAKE_CURRENT_BINARY_DIR}/%argt%-cc -o out -- $) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(cc-env-pmc2 "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-counter-collection-txt-pmc2-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${cc-env-pmc2}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-counter-collection-txt-pmc2-execute-validate +# pmc2 +rocprofiler_add_integration_execute_test( + rocprofv3-test-counter-collection-txt-pmc2 COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pmc_1/out_agent_info.csv - --counter-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pmc_1/out_counter_collection.csv - --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pmc_2/out_agent_info.csv - --counter-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pmc_2/out_counter_collection.csv) + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.txt + --output-format CSV JSON -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-cc -o out -- + $ + DEPENDS vector-ops + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-counter-collection-txt-pmc2) -set_tests_properties( - rocprofv3-test-counter-collection-txt-pmc2-execute-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-counter-collection-pmc2-execute" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-counter-collection-txt-pmc2 + TEST_PATHS validate.py + COPY conftest.py input.txt + CONFIG pytest.ini + ARGS --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pmc_1/out_agent_info.csv + --counter-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pmc_1/out_counter_collection.csv + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pmc_2/out_agent_info.csv + --counter-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pmc_2/out_counter_collection.csv + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-counter-collection-txt-pmc2) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input2/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input2/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input2/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input2/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input3/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input3/CMakeLists.txt index 48206b09d5..28427e5316 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input3/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input3/CMakeLists.txt @@ -13,66 +13,64 @@ find_package(rocprofiler-sdk REQUIRED) rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py input.json input.yml) -# pmc1 -add_test( - NAME rocprofv3-test-counter-collection-json-pmc1-execute - COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.json -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-cc - -o out_json -f csv -- $) - -add_test( - NAME rocprofv3-test-counter-collection-yaml-pmc1-execute - COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.yml -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-cc -o - out_yaml -f csv -- $) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") - -set(cc-env-pmc1 "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-counter-collection-json-pmc1-execute - rocprofv3-test-counter-collection-yaml-pmc1-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${cc-env-pmc1}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-counter-collection-json-pmc1-validate +# pmc1 +rocprofiler_add_integration_execute_test( + rocprofv3-test-counter-collection-json-pmc1 COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_1/out_json_agent_info.csv - --counter-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_1/out_json_counter_collection.csv - --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_2/out_json_agent_info.csv - --counter-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_2/out_json_counter_collection.csv - ) + $ -i + ${CMAKE_CURRENT_BINARY_DIR}/input.json -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-cc -o + out_json -f csv -- $ + DEPENDS simple-transpose + TIMEOUT 45 + LABELS "integration-tests" + ENVIRONMENT "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-counter-collection-json-pmc1) -set_tests_properties( - rocprofv3-test-counter-collection-json-pmc1-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - rocprofv3-test-counter-collection-json-pmc1-execute - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-counter-collection-json-pmc1 + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_1/out_json_agent_info.csv + --counter-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_1/out_json_counter_collection.csv + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_2/out_json_agent_info.csv + --counter-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_2/out_json_counter_collection.csv + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-counter-collection-json-pmc1) -add_test( - NAME rocprofv3-test-counter-collection-yaml-pmc1-validate +# YAML input test +rocprofiler_add_integration_execute_test( + rocprofv3-test-counter-collection-yaml-pmc1 COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_1/out_yaml_agent_info.csv - --counter-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_1/out_yaml_counter_collection.csv - --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_2/out_yaml_agent_info.csv - --counter-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_2/out_yaml_counter_collection.csv - ) + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.yml + -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-cc -o out_yaml -f csv -- + $ + DEPENDS simple-transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-counter-collection-yaml-pmc1) -set_tests_properties( - rocprofv3-test-counter-collection-yaml-pmc1-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - rocprofv3-test-counter-collection-yaml-pmc1-execute - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-counter-collection-yaml-pmc1 + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_1/out_yaml_agent_info.csv + --counter-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_1/out_yaml_counter_collection.csv + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_2/out_yaml_agent_info.csv + --counter-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/pass_2/out_yaml_counter_collection.csv + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-counter-collection-yaml-pmc1) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input3/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input3/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input3/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/input3/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/kernel_filtering/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/kernel_filtering/CMakeLists.txt index 618672a81c..f4464bcac2 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/kernel_filtering/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/kernel_filtering/CMakeLists.txt @@ -10,111 +10,106 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py - input.txt input.json input.yml) - +string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV + "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") # pmc1 -add_test( - NAME rocprofv3-test-counter-collection-kernel-filtering-input-json-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-counter-collection-kernel-filtering-input-json COMMAND $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.json -d ${CMAKE_CURRENT_BINARY_DIR}/json_input - -- $) + -- $ + DEPENDS vector-ops + TIMEOUT 120 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-counter-collection-kernel-filtering-input-json) -string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-counter-collection-kernel-filtering-input-json + TEST_PATHS validate.py + COPY conftest.py input.txt input.json input.yml + CONFIG pytest.ini + DISCOVERY_ARGS -k _pass + ARGS --input-csv-pass1 + ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_1/out_counter_collection.csv + --input-json-pass1 + ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_1/out_results.json + --input-csv-pass2 + ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_2/out_counter_collection.csv + --input-json-pass2 + ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_2/out_results.json + --input-csv-pass3 + ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_3/out_counter_collection.csv + --input-json-pass3 + ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_3/out_results.json + --input-csv-pass4 + ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_4/out_counter_collection.csv + --input-json-pass4 + ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_4/out_results.json + TIMEOUT 120 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-counter-collection-kernel-filtering-input-json) -set(cc-env-kernel-filtering "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-counter-collection-kernel-filtering-input-json-execute - PROPERTIES TIMEOUT 120 LABELS "integration-tests" ENVIRONMENT - "${cc-env-kernel-filtering}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-counter-collection-kernel-filtering-input-cmd-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-counter-collection-kernel-filtering-input-cmd COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.txt --kernel-include-regex ".*kernel" - --kernel-exclude-regex "multiply" -T -d ${CMAKE_CURRENT_BINARY_DIR}/cmd_input -o - out --output-format csv -- $) + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.txt + --kernel-include-regex ".*kernel" --kernel-exclude-regex "multiply" -T -d + ${CMAKE_CURRENT_BINARY_DIR}/cmd_input -o out --output-format csv -- + $ + DEPENDS vector-ops + TIMEOUT 120 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-counter-collection-kernel-filtering-input-cmd) -set_tests_properties( - rocprofv3-test-counter-collection-kernel-filtering-input-cmd-execute - PROPERTIES TIMEOUT 120 LABELS "integration-tests" ENVIRONMENT - "${cc-env-kernel-filtering}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-counter-collection-kernel-filtering-input-cmd + TEST_PATHS validate.py + COPY conftest.py input.txt input.json input.yml + CONFIG pytest.ini + DISCOVERY_ARGS -k test_validate_counter_collection_csv_pmc1 + ARGS --input-csv-pmc1 + ${CMAKE_CURRENT_BINARY_DIR}/cmd_input/pmc_1/out_counter_collection.csv + TIMEOUT 120 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-counter-collection-kernel-filtering-input-cmd) -# pmc1 -add_test( - NAME rocprofv3-test-counter-collection-kernel-filtering-input-yaml-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-counter-collection-kernel-filtering-input-yaml COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.yml -T -d - ${CMAKE_CURRENT_BINARY_DIR}/yaml_input -o out --output-format csv json -- - $) + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.yml + -T -d ${CMAKE_CURRENT_BINARY_DIR}/yaml_input -o out --output-format csv json -- + $ + DEPENDS vector-ops + TIMEOUT 120 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-counter-collection-kernel-filtering-input-yaml) -set_tests_properties( - rocprofv3-test-counter-collection-kernel-filtering-input-yaml-execute - PROPERTIES TIMEOUT 120 LABELS "integration-tests" ENVIRONMENT - "${cc-env-kernel-filtering}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") -add_test( - NAME rocprofv3-test-counter-collection-kernel-filtering-input-json-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k _pass - --input-csv-pass1 - ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_1/out_counter_collection.csv - --input-json-pass1 ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_1/out_results.json - --input-csv-pass2 - ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_2/out_counter_collection.csv - --input-json-pass2 ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_2/out_results.json - --input-csv-pass3 - ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_3/out_counter_collection.csv - --input-json-pass3 ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_3/out_results.json - --input-csv-pass4 - ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_4/out_counter_collection.csv - --input-json-pass4 ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_4/out_results.json) - -add_test( - NAME rocprofv3-test-counter-collection-kernel-filtering-input-yaml-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k _pass - --input-csv-pass1 - ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_1/out_counter_collection.csv - --input-json-pass1 ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_1/out_results.json - --input-csv-pass2 - ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_2/out_counter_collection.csv - --input-json-pass2 ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_2/out_results.json - --input-csv-pass3 - ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_3/out_counter_collection.csv - --input-json-pass3 ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_3/out_results.json - --input-csv-pass4 - ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_4/out_counter_collection.csv - --input-json-pass4 ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_4/out_results.json) - -add_test( - NAME rocprofv3-test-counter-collection-kernel-filtering-input-cmd-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - test_validate_counter_collection_csv_pmc1 --input-csv-pmc1 - ${CMAKE_CURRENT_BINARY_DIR}/cmd_input/pmc_1/out_counter_collection.csv) - -set_tests_properties( - rocprofv3-test-counter-collection-kernel-filtering-input-json-validate - PROPERTIES TIMEOUT 120 LABELS "integration-tests" DEPENDS - "rocprofv3-test-counter-collection-kernel-filtering-input-json-execute" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -set_tests_properties( - rocprofv3-test-counter-collection-kernel-filtering-input-cmd-validate - PROPERTIES TIMEOUT 120 LABELS "integration-tests" DEPENDS - "rocprofv3-test-counter-collection-kernel-filtering-input-cmd-execute" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -set_tests_properties( - rocprofv3-test-counter-collection-kernel-filtering-input-yaml-validate - PROPERTIES TIMEOUT 120 LABELS "integration-tests" DEPENDS - "rocprofv3-test-counter-collection-kernel-filtering-input-yaml-execute" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-counter-collection-kernel-filtering-input-yaml + TEST_PATHS validate.py + COPY conftest.py input.txt input.json input.yml + CONFIG pytest.ini + DISCOVERY_ARGS -k _pass + ARGS --input-csv-pass1 + ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_1/out_counter_collection.csv + --input-json-pass1 + ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_1/out_results.json + --input-csv-pass2 + ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_2/out_counter_collection.csv + --input-json-pass2 + ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_2/out_results.json + --input-csv-pass3 + ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_3/out_counter_collection.csv + --input-json-pass3 + ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_3/out_results.json + --input-csv-pass4 + ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_4/out_counter_collection.csv + --input-json-pass4 + ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_4/out_results.json + TIMEOUT 120 + LABELS "integration-tests" FIXTURES + rocprofv3-test-counter-collection-kernel-filtering-input-yaml) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/kernel_filtering/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/kernel_filtering/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/kernel_filtering/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/kernel_filtering/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/list_metrics/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/list_metrics/CMakeLists.txt index ae423e7eeb..e85c88860f 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/list_metrics/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/list_metrics/CMakeLists.txt @@ -10,50 +10,48 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY input.json) -# basic-metrics -add_test( - NAME rocprofv3-test-list-avail-execute - COMMAND $ -d - ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_2 -o metrics --list-avail) - -# list-metrics-stdout -add_test(NAME rocprofv3-test-list-avail-std-out-execute - COMMAND $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.json) - -# list-metrics with tracing -add_test( - NAME rocprofv3-test-list-avail-trace-execute - COMMAND - $ -d - ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_2 -o metrics --list-avail - --sys-trace --log-level warning -- $) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(cc-env-list-metrics "${PRELOAD_ENV}" "ROCPD_LOG_LEVEL=info") +rocprofiler_configure_pytest_files( + OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + CONFIG pytest.ini + COPY input.json) -set_tests_properties( - rocprofv3-test-list-avail-execute - PROPERTIES TIMEOUT 60 LABELS "integration-tests" ENVIRONMENT "${cc-env-list-metrics}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +# basic-metrics +rocprofiler_add_integration_execute_test( + rocprofv3-test-list-avail + COMMAND $ -d + ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_2 -o metrics --list-avail + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 60 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "ROCPD_LOG_LEVEL=info") -set_tests_properties( - rocprofv3-test-list-avail-std-out-execute - PROPERTIES - TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${cc-env-list-metrics}" - PASS_REGULAR_EXPRESSION +# list-metrics-stdout +rocprofiler_add_integration_execute_test( + rocprofv3-test-list-avail-std-out + COMMAND $ -i + ${CMAKE_CURRENT_BINARY_DIR}/input.json + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "ROCPD_LOG_LEVEL=info" + PASS_REGULAR_EXPRESSION "GPU:[0-9]*\\n*;Name:\\t[a-zA-Z_]*\\n;counter_name:\\t[a-zA-Z_]*\\n;description:\\t(.*)\\n*;expression:\\t(.)*\\n*;block:\\t[a-zA-Z]*\\n*;dimension_name:\\t([A-Z_]*)\\n*; dimension_instances:\\t([[0-9]*:[0-9]*\\])*\\n*;method:(.*)\\n*;unit:(.*)\\n*;min_interval:[0-9]*\\n*;max_interval:[0-9]*\\n*;flags:(.*)\\n*" ) -set_tests_properties( - rocprofv3-test-list-avail-trace-execute - PROPERTIES TIMEOUT 60 LABELS "integration-tests" ENVIRONMENT "${cc-env-list-metrics}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +# list-metrics with tracing +rocprofiler_add_integration_execute_test( + rocprofv3-test-list-avail-trace + COMMAND + $ -d + ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_2 -o metrics --list-avail + --sys-trace --log-level warning -- $ + DEPENDS transpose + TIMEOUT 60 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "ROCPD_LOG_LEVEL=info") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/list_metrics/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/list_metrics/pytest.ini index c3c15206ee..771b423340 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/list_metrics/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/list_metrics/pytest.ini @@ -1,4 +1,4 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/multiplex/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/multiplex/CMakeLists.txt index 54616ee13a..1e4765ba9e 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/multiplex/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/multiplex/CMakeLists.txt @@ -32,81 +32,61 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py - input.json input.yml) - -# pmc1 -add_test( - NAME rocprofv3-test-counter-collection-multiplex-execute - COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.json -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-cc - -o out_json -f csv -- $) - -add_test( - NAME rocprofv3-test-counter-collection-multiple-yaml-execute - COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.yml -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-cc -o - out_yaml -f csv -- $) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(cc-env-pmc1 "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-counter-collection-multiplex-execute - rocprofv3-test-counter-collection-multiple-yaml-execute - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${cc-env-pmc1}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - TRUE) - -add_test( - NAME rocprofv3-test-counter-collection-multiplex-validate +# JSON input test +rocprofiler_add_integration_execute_test( + rocprofv3-test-counter-collection-multiplex COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/out_json_agent_info.csv - --counter-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/out_json_counter_collection.csv) + $ -i + ${CMAKE_CURRENT_BINARY_DIR}/input.json -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-cc -o + out_json -f csv -- $ + DEPENDS simple-transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-counter-collection-multiplex + UNSTABLE) -set_tests_properties( - rocprofv3-test-counter-collection-multiplex-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - rocprofv3-test-counter-collection-multiplex-execute - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - TRUE) +rocprofiler_add_integration_validate_test( + rocprofv3-test-counter-collection-multiplex + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/out_json_agent_info.csv + --counter-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/out_json_counter_collection.csv + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-counter-collection-multiplex + UNSTABLE) -add_test( - NAME rocprofv3-test-counter-collection-multiple-yaml-validate +# YAML input test +rocprofiler_add_integration_execute_test( + rocprofv3-test-counter-collection-multiple-yaml COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/out_yaml_agent_info.csv - --counter-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/out_yaml_counter_collection.csv) + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.yml + -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-cc -o out_yaml -f csv -- + $ + DEPENDS simple-transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-counter-collection-multiple-yaml + UNSTABLE) -set_tests_properties( - rocprofv3-test-counter-collection-multiple-yaml-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - rocprofv3-test-counter-collection-multiple-yaml-execute - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - TRUE) +rocprofiler_add_integration_validate_test( + rocprofv3-test-counter-collection-multiple-yaml + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/out_yaml_agent_info.csv + --counter-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-cc/out_yaml_counter_collection.csv + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-counter-collection-multiple-yaml + UNSTABLE) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/multiplex/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/multiplex/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/multiplex/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/multiplex/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/range_filtering/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/range_filtering/CMakeLists.txt index 6a81e20df4..9d1db8c6e3 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/range_filtering/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/range_filtering/CMakeLists.txt @@ -10,40 +10,35 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py - input_range.json) - -add_test( - NAME rocprofv3-test-counter-collection-kernel-filtering-range-filter-execute - COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input_range.json -d - ${CMAKE_CURRENT_BINARY_DIR}/range_filter -- $ 1 15) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(cc-env-kernel-filtering "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-counter-collection-kernel-filtering-range-filter-execute - PROPERTIES TIMEOUT 120 LABELS "integration-tests" ENVIRONMENT - "${cc-env-kernel-filtering}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-counter-collection-kernel-filtering-range-filter-validate +# Range filtering test +rocprofiler_add_integration_execute_test( + rocprofv3-test-counter-collection-kernel-filtering-range-filter COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-config - ${CMAKE_CURRENT_BINARY_DIR}/input_range.json --input-json-pass1 - ${CMAKE_CURRENT_BINARY_DIR}/range_filter/pass_1/out_results.json - --input-json-pass2 - ${CMAKE_CURRENT_BINARY_DIR}/range_filter/pass_2/out_results.json - --input-json-pass3 - ${CMAKE_CURRENT_BINARY_DIR}/range_filter/pass_3/out_results.json) + $ -i + ${CMAKE_CURRENT_BINARY_DIR}/input_range.json -d + ${CMAKE_CURRENT_BINARY_DIR}/range_filter -- $ 1 15 + DEPENDS transpose + TIMEOUT 120 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-counter-collection-kernel-filtering-range-filter) -set_tests_properties( - rocprofv3-test-counter-collection-kernel-filtering-range-filter-validate - PROPERTIES TIMEOUT 120 LABELS "integration-tests" DEPENDS - "rocprofv3-test-counter-collection-kernel-filtering-range-filter-execute" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-counter-collection-kernel-filtering-range-filter + TEST_PATHS validate.py + COPY conftest.py input_range.json + CONFIG pytest.ini + ARGS --json-config + ${CMAKE_CURRENT_BINARY_DIR}/input_range.json + --input-json-pass1 + ${CMAKE_CURRENT_BINARY_DIR}/range_filter/pass_1/out_results.json + --input-json-pass2 + ${CMAKE_CURRENT_BINARY_DIR}/range_filter/pass_2/out_results.json + --input-json-pass3 + ${CMAKE_CURRENT_BINARY_DIR}/range_filter/pass_3/out_results.json + TIMEOUT 120 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-counter-collection-kernel-filtering-range-filter) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/range_filtering/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/range_filtering/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/range_filtering/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/counter-collection/range_filtering/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/hip-stream-display/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/hip-stream-display/CMakeLists.txt index d76bcff15a..6077319256 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/hip-stream-display/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/hip-stream-display/CMakeLists.txt @@ -30,53 +30,38 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") set(hip-stream-display-env "${PRELOAD_ENV}") -add_test( - NAME rocprofv3-test-hip-stream-display-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-hip-stream-display COMMAND $ --kernel-rename -s -d ${CMAKE_CURRENT_BINARY_DIR}/%tag%-trace -o out --output-format json pftrace csv - --log-level env -- $) + --log-level env -- $ + DEPENDS hip-streams + TIMEOUT 60 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-hip-stream-display + DISABLED $>) -set_tests_properties( - rocprofv3-test-hip-stream-display-execute - PROPERTIES TIMEOUT - 60 - LABELS - "integration-tests" - ENVIRONMENT - "${hip-stream-display-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - $>) - -add_test( - NAME rocprofv3-test-hip-stream-display-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-trace/out_results.json --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-trace/out_results.pftrace - --kernel-csv-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-trace/out_kernel_trace.csv - --memory-copy-csv-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-trace/out_memory_copy_trace.csv) - -set_tests_properties( - rocprofv3-test-hip-stream-display-validate - PROPERTIES TIMEOUT - 60 - LABELS - "integration-tests" - DEPENDS - rocprofv3-test-hip-stream-display-execute - FAIL_REGULAR_EXPRESSION - "AssertionError" - DISABLED - $>) +rocprofiler_add_integration_validate_test( + rocprofv3-test-hip-stream-display + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-trace/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-trace/out_results.pftrace + --kernel-csv-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-trace/out_kernel_trace.csv + --memory-copy-csv-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-trace/out_memory_copy_trace.csv + TIMEOUT 60 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-hip-stream-display + DISABLED $>) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/hip-stream-display/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/hip-stream-display/pytest.ini index e2027e2fd5..b4e84a8818 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/hip-stream-display/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/hip-stream-display/pytest.ini @@ -22,6 +22,6 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/hip-streams-per-thread/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/hip-streams-per-thread/CMakeLists.txt index 2073fd29cf..8ba9f0f5bd 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/hip-streams-per-thread/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/hip-streams-per-thread/CMakeLists.txt @@ -30,54 +30,36 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(hip-stream-env "${PRELOAD_ENV}") set(NUM_THREADS 9) -add_test( - NAME rocprofv3-test-hip-streams-per-thread-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-hip-streams-per-thread COMMAND $ -s -d ${CMAKE_CURRENT_BINARY_DIR}/%tag%-trace -o out --output-format json pftrace csv - --log-level env -- $ ${NUM_THREADS}) + --log-level env -- $ ${NUM_THREADS} + DEPENDS hip-streams-per-thread + TIMEOUT 60 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-hip-streams-per-thread + DISABLED $>) -set_tests_properties( - rocprofv3-test-hip-streams-per-thread-execute - PROPERTIES TIMEOUT - 60 - LABELS - "integration-tests" - ENVIRONMENT - "${hip-stream-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - $>) - -add_test( - NAME rocprofv3-test-hip-streams-per-thread-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-per-thread-trace/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-per-thread-trace/out_results.pftrace - --memory-copy-csv-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-per-thread-trace/out_memory_copy_trace.csv - ) - -set_tests_properties( - rocprofv3-test-hip-streams-per-thread-validate - PROPERTIES TIMEOUT - 60 - LABELS - "integration-tests" - DEPENDS - rocprofv3-test-hip-streams-per-thread-execute - FAIL_REGULAR_EXPRESSION - "AssertionError" - DISABLED - $>) +rocprofiler_add_integration_validate_test( + rocprofv3-test-hip-streams-per-thread + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-per-thread-trace/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-per-thread-trace/out_results.pftrace + --memory-copy-csv-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-streams-per-thread-trace/out_memory_copy_trace.csv + TIMEOUT 60 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-hip-streams-per-thread + DISABLED $>) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/hip-streams-per-thread/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/hip-streams-per-thread/pytest.ini index e2027e2fd5..b4e84a8818 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/hip-streams-per-thread/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/hip-streams-per-thread/pytest.ini @@ -22,6 +22,6 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/hsa-queue-dependency/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/hsa-queue-dependency/CMakeLists.txt index bea9a731c5..72ccde6633 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/hsa-queue-dependency/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/hsa-queue-dependency/CMakeLists.txt @@ -11,39 +11,34 @@ project( string(REPLACE "LD_PRELOAD=" "--preload;" PRELOAD_ARGS "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(tracing-env "") - -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py) - find_package(rocprofiler-sdk REQUIRED) # hsa multiqueue dependency test -add_test( - NAME rocprofv3-test-hsa-multiqueue-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-hsa-multiqueue COMMAND $ --hsa-trace --kernel-trace -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-trace -o out --output-format json csv pftrace - ${PRELOAD_ARGS} -- $) + ${PRELOAD_ARGS} -- $ + DEPENDS multiqueue_testapp + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_SETUP rocprofv3-test-hsa-multiqueue + FAIL_REGULAR_EXPRESSION "HSA_API|HIP_API") -set_tests_properties( - rocprofv3-test-hsa-multiqueue-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${tracing-env}" - FAIL_REGULAR_EXPRESSION "HSA_API|HIP_API") - -add_test( - NAME rocprofv3-test-hsa-multiqueue-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --hsa-trace-input - ${CMAKE_CURRENT_BINARY_DIR}/multiqueue_testapp-trace/out_hsa_api_trace.csv - --kernel-trace-input - ${CMAKE_CURRENT_BINARY_DIR}/multiqueue_testapp-trace/out_kernel_trace.csv - --json-input - ${CMAKE_CURRENT_BINARY_DIR}/multiqueue_testapp-trace/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/multiqueue_testapp-trace/out_results.pftrace) - -set_tests_properties( - rocprofv3-test-hsa-multiqueue-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-hsa-multiqueue-execute" FAIL_REGULAR_EXPRESSION - "AssertionError") +rocprofiler_add_integration_validate_test( + rocprofv3-test-hsa-multiqueue + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --hsa-trace-input + ${CMAKE_CURRENT_BINARY_DIR}/multiqueue_testapp-trace/out_hsa_api_trace.csv + --kernel-trace-input + ${CMAKE_CURRENT_BINARY_DIR}/multiqueue_testapp-trace/out_kernel_trace.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/multiqueue_testapp-trace/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/multiqueue_testapp-trace/out_results.pftrace + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-hsa-multiqueue) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/hsa-queue-dependency/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/hsa-queue-dependency/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/hsa-queue-dependency/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/hsa-queue-dependency/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/CMakeLists.txt index e2b51f742c..645634a332 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/CMakeLists.txt @@ -19,10 +19,8 @@ endif() string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(kernel-rename-env "${PRELOAD_ENV}") - -rocprofiler_configure_pytest_files(CONFIG pytest.ini input-kernel-rename.yml - COPY validate.py conftest.py) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/input-kernel-rename.yml.in + ${CMAKE_CURRENT_BINARY_DIR}/input-kernel-rename.yml @ONLY) ########################################################################################## # @@ -30,8 +28,8 @@ rocprofiler_configure_pytest_files(CONFIG pytest.ini input-kernel-rename.yml # ########################################################################################## -add_test( - NAME rocprofv3-test-kernel-rename-cmd-line-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-kernel-rename-cmd-line COMMAND $ -M --sys-trace no --hsa-trace=0 --hsa-core-trace=1 --hip-compiler-trace False --hip-runtime-trace --kernel-trace @@ -39,28 +37,27 @@ add_test( --output-format pftrace json otf2 --log-level env --kernel-rename --perfetto-shmem-size-hint 128 --perfetto-buffer-size 2048000 --perfetto-buffer-fill-policy ring_buffer --perfetto-backend inprocess -- - $) + $ + DEPENDS transpose + TIMEOUT 45 + LABELS "integration-tests" + ENVIRONMENT "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-kernel-rename-cmd-line) -set_tests_properties( - rocprofv3-test-kernel-rename-cmd-line-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${kernel-rename-env}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-kernel-rename-cmd-line-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.pftrace - --otf2-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.otf2) - -set_tests_properties( - rocprofv3-test-kernel-rename-cmd-line-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-kernel-rename-execute" FAIL_REGULAR_EXPRESSION - "AssertionError") +rocprofiler_add_integration_validate_test( + rocprofv3-test-kernel-rename-cmd-line + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.pftrace + --otf2-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.otf2 + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-kernel-rename-cmd-line) ########################################################################################## # @@ -68,29 +65,28 @@ set_tests_properties( # ########################################################################################## -add_test( - NAME rocprofv3-test-kernel-rename-inp-yaml-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-kernel-rename-inp-yaml COMMAND $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input-kernel-rename.yml -- $) + ${CMAKE_CURRENT_BINARY_DIR}/input-kernel-rename.yml -- $ + DEPENDS transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-kernel-rename-inp-yaml) -set_tests_properties( - rocprofv3-test-kernel-rename-inp-yaml-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${kernel-rename-env}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-kernel-rename-inp-yaml-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.pftrace - --otf2-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.otf2) - -set_tests_properties( - rocprofv3-test-kernel-rename-inp-yaml-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-kernel-rename-inp-yaml-execute" FAIL_REGULAR_EXPRESSION - "AssertionError") +rocprofiler_add_integration_validate_test( + rocprofv3-test-kernel-rename-inp-yaml + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.pftrace + --otf2-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.otf2 + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-kernel-rename-inp-yaml) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/input-kernel-rename.yml b/projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/input-kernel-rename.yml.in similarity index 100% rename from projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/input-kernel-rename.yml rename to projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/input-kernel-rename.yml.in diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/kernel-rename/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/memory-allocation/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/memory-allocation/CMakeLists.txt index 2df58bc478..e23f7ef91c 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/memory-allocation/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/memory-allocation/CMakeLists.txt @@ -10,39 +10,32 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py) - string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(memory-allocation-tracing-env "${PRELOAD_ENV}") - -add_test( - NAME rocprofv3-test-memory-allocation-tracing-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-memory-allocation-tracing COMMAND $ --memory-allocation-trace -d ${CMAKE_CURRENT_BINARY_DIR}/%tag%-trace -o out --output-format json otf2 csv - --log-level env -- $) + --log-level env -- $ + DEPENDS hsa-memory-allocation + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-memory-allocation-tracing) -set_tests_properties( - rocprofv3-test-memory-allocation-tracing-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT - "${memory-allocation-tracing-env}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-memory-allocation-tracing-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/hsa-memory-allocation-trace/out_results.json - --otf2-input - ${CMAKE_CURRENT_BINARY_DIR}/hsa-memory-allocation-trace/out_results.otf2 - --csv-input - ${CMAKE_CURRENT_BINARY_DIR}/hsa-memory-allocation-trace/out_memory_allocation_trace.csv - ) - -set_tests_properties( - rocprofv3-test-memory-allocation-tracing-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - rocprofv3-test-memory-allocation-tracing-execute FAIL_REGULAR_EXPRESSION - "AssertionError") +rocprofiler_add_integration_validate_test( + rocprofv3-test-memory-allocation-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/hsa-memory-allocation-trace/out_results.json + --otf2-input + ${CMAKE_CURRENT_BINARY_DIR}/hsa-memory-allocation-trace/out_results.otf2 + --csv-input + ${CMAKE_CURRENT_BINARY_DIR}/hsa-memory-allocation-trace/out_memory_allocation_trace.csv + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-memory-allocation-tracing) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/memory-allocation/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/memory-allocation/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/memory-allocation/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/memory-allocation/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/minimum-bytes/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/minimum-bytes/CMakeLists.txt index 1c711bb27a..88987128be 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/minimum-bytes/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/minimum-bytes/CMakeLists.txt @@ -10,40 +10,34 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py - input.json) +string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV + "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") # pmc2 -add_test( - NAME rocprofv3-test-minimum-bytes-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-minimum-bytes COMMAND $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.json --output-format csv json pftrace -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-kernel-trace -o out -- - $) + $ + DEPENDS simple-transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-minimum-bytes) -string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") - -set(cc-env-pmc2 "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-minimum-bytes-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${cc-env-pmc2}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-minimum-bytes-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --trace-input-csv - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-kernel-trace/out*.csv - --trace-input-json - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-kernel-trace/out_results.json - --trace-input-pftrace - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-kernel-trace/out_results.pftrace) - -set_tests_properties( - rocprofv3-test-minimum-bytes-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-minimum-bytes-execute" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-minimum-bytes + TEST_PATHS validate.py + COPY conftest.py input.json + CONFIG pytest.ini + ARGS --trace-input-csv + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-kernel-trace/out*.csv + --trace-input-json + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-kernel-trace/out_results.json + --trace-input-pftrace + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-kernel-trace/out_results.pftrace + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-minimum-bytes) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/minimum-bytes/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/minimum-bytes/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/minimum-bytes/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/minimum-bytes/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/negate-aggregate-tracing-options/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/negate-aggregate-tracing-options/CMakeLists.txt index f7ff33b411..d120331507 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/negate-aggregate-tracing-options/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/negate-aggregate-tracing-options/CMakeLists.txt @@ -35,9 +35,9 @@ find_package(rocprofiler-sdk REQUIRED) string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(negate-aggregate-tracing-options-env "${PRELOAD_ENV}") - -rocprofiler_configure_pytest_files(CONFIG input-negate-aggregate-tracing-options.yml) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/input-negate-aggregate-tracing-options.yml.in + ${CMAKE_CURRENT_BINARY_DIR}/input-negate-aggregate-tracing-options.yml @ONLY) ########################################################################################## # @@ -45,8 +45,8 @@ rocprofiler_configure_pytest_files(CONFIG input-negate-aggregate-tracing-options # ########################################################################################## -add_test( - NAME rocprofv3-test-negate-aggregate-tracing-options-cmd-line +rocprofiler_add_integration_execute_test( + rocprofv3-test-negate-aggregate-tracing-options-cmd-line COMMAND $ -M --sys-trace -d ${CMAKE_CURRENT_BINARY_DIR} -o out --log-level info --hip-trace=no --hsa-trace=no @@ -55,20 +55,12 @@ add_test( --kokkos-trace=no --rocdecode-trace=no --rocjpeg-trace=no --hip-runtime-trace=no --hip-compiler-trace=no --hsa-core-trace=no --hsa-amd-trace=no --hsa-image-trace=no --hsa-finalizer-trace=no --advanced-thread-trace=no - --kernel-rename=no --summary --echo -- ${CMAKE_COMMAND}) - -set_tests_properties( - rocprofv3-test-negate-aggregate-tracing-options-cmd-line - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${negate-aggregate-tracing-options-env}" - PASS_REGULAR_EXPRESSION - "command:.*${CMAKE_COMMAND}" - WILL_FAIL - ON) + --kernel-rename=no --summary --echo -- ${CMAKE_COMMAND} + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + WILL_FAIL) ########################################################################################## # @@ -76,22 +68,14 @@ set_tests_properties( # ########################################################################################## -add_test( - NAME rocprofv3-test-negate-aggregate-tracing-options-inp-yaml +rocprofiler_add_integration_execute_test( + rocprofv3-test-negate-aggregate-tracing-options-inp-yaml COMMAND $ -i ${CMAKE_CURRENT_BINARY_DIR}/input-negate-aggregate-tracing-options.yml -- - ${CMAKE_COMMAND}) - -set_tests_properties( - rocprofv3-test-negate-aggregate-tracing-options-inp-yaml - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${negate-aggregate-tracing-options-env}" - PASS_REGULAR_EXPRESSION - "command:.*${CMAKE_COMMAND}" - WILL_FAIL - ON) + ${CMAKE_COMMAND} + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + WILL_FAIL) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/negate-aggregate-tracing-options/input-negate-aggregate-tracing-options.yml b/projects/rocprofiler-sdk/tests/rocprofv3/negate-aggregate-tracing-options/input-negate-aggregate-tracing-options.yml.in similarity index 100% rename from projects/rocprofiler-sdk/tests/rocprofv3/negate-aggregate-tracing-options/input-negate-aggregate-tracing-options.yml rename to projects/rocprofiler-sdk/tests/rocprofv3/negate-aggregate-tracing-options/input-negate-aggregate-tracing-options.yml.in diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/CMakeLists.txt index bec59ac45f..9e5843d034 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/CMakeLists.txt @@ -13,156 +13,106 @@ rocprofiler_sdk_pc_sampling_disabled(IS_PC_SAMPLING_DISABLED) find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py - input.json input.yml) +string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV + "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-cmd-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-cmd COMMAND $ --pc-sampling-unit time --pc-sampling-method host_trap --pc-sampling-interval 1 -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input -o out --output-format csv json - -- $) + -- $ + DEPENDS exec-mask-manipulation + TIMEOUT 90 + LABELS "integration-tests;pc-sampling" + PRELOAD "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-cmd + DISABLED "${IS_PC_SAMPLING_DISABLED}") -string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-cmd + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + DISCOVERY_ARGS -k test_validate_pc_sampling_exec_mask_manipulation_ + ARGS --input-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_pc_sampling_host_trap.csv + --input-json + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_results.json + --all-sampled + False + TIMEOUT 60 + LABELS "integration-tests;pc-sampling" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-cmd + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_DISABLED}") -set(pc-sampling-env-host-trap-exec-mask-manipulation "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-cmd-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling" - ENVIRONMENT - "${pc-sampling-env-host-trap-exec-mask-manipulation}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-json-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-json COMMAND $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.json -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input -- - $) + $ + DEPENDS exec-mask-manipulation + TIMEOUT 90 + LABELS "integration-tests;pc-sampling" + PRELOAD "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-json + DISABLED "${IS_PC_SAMPLING_DISABLED}") -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-json-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling" - ENVIRONMENT - "${pc-sampling-env-host-trap-exec-mask-manipulation}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-json + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + DISCOVERY_ARGS -k test_validate_pc_sampling_exec_mask_manipulation_ + ARGS --input-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_pc_sampling_host_trap.csv + --input-json + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_results.json + --all-sampled + False + TIMEOUT 60 + LABELS "integration-tests;pc-sampling" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-json + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_DISABLED}") -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-yaml-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-yaml COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.yml -d - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input -o out --output-format csv - json -- $) + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.yml + -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input -o out --output-format csv + json -- $ + DEPENDS exec-mask-manipulation + TIMEOUT 90 + LABELS "integration-tests;pc-sampling" + PRELOAD "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-yaml + DISABLED "${IS_PC_SAMPLING_DISABLED}") -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-yaml-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling" - ENVIRONMENT - "${pc-sampling-env-host-trap-exec-mask-manipulation}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") - -# ========================= Validation tests - -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-cmd-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - test_validate_pc_sampling_exec_mask_manipulation_ --input-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_pc_sampling_host_trap.csv - --input-json ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_results.json - --all-sampled False) - -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-cmd-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling" - DEPENDS - "rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-cmd-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-json-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - test_validate_pc_sampling_exec_mask_manipulation_ --input-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_pc_sampling_host_trap.csv - --input-json ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_results.json - --all-sampled False) - -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-json-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling" - DEPENDS - "rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-json-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-yaml-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - test_validate_pc_sampling_exec_mask_manipulation_ --input-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_pc_sampling_host_trap.csv - --input-json ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_results.json - --all-sampled False) - -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-yaml-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling" - DEPENDS - "rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-yaml-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-yaml + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + DISCOVERY_ARGS -k test_validate_pc_sampling_exec_mask_manipulation_ + ARGS --input-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_pc_sampling_host_trap.csv + --input-json + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_results.json + --all-sampled + False + TIMEOUT 60 + LABELS "integration-tests;pc-sampling" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-yaml + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/conftest.py b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/conftest.py index 6c077d286d..b283f4758e 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/conftest.py +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/conftest.py @@ -76,11 +76,17 @@ def input_csv(request): @pytest.fixture def input_json(request): filename = request.config.getoption("--input-json") - with open(filename, "r") as inp: - # Significant overhead of 5-6secs observed when feeding - # data into the dotdict. - # Using plain python dict instead - return collapse_dict_list(json.load(inp)) + if not os.path.isfile(filename): + # The CSV file is not generated, because the dependency test + # responsible to generate this file was skipped or failed. + # Thus emit the message to skip this test as well. + print("PC sampling unavailable") + else: + with open(filename, "r") as inp: + # Significant overhead of 5-6secs observed when feeding + # data into the dotdict. + # Using plain python dict instead + return collapse_dict_list(json.load(inp)) @pytest.fixture diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/CMakeLists.txt index 6851871ca5..7c2e1b9419 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/CMakeLists.txt @@ -13,8 +13,8 @@ find_package(rocprofiler-sdk REQUIRED) # Check if PC sampling is disabled and whether we should skip the tests. rocprofiler_sdk_pc_sampling_disabled(IS_PC_SAMPLING_DISABLED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py - input.json input.yml) +string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV + "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") # To ensure we sample all agents, use 16 threads each assigned to one agent in a round # robin manner. To keep the job per device reasonable, each thread offloads 100 instances @@ -22,159 +22,109 @@ rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.p set(TRANSPOSE_NUM_THREADS 16) set(TRANSPOSE_NUM_ITERATIONS 100) -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-cmd-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-cmd COMMAND $ --kernel-trace --pc-sampling-unit time --pc-sampling-method host_trap --pc-sampling-interval 1 --agent-index absolute -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input -o out --output-format csv -- - $ ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS}) + $ ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS} + DEPENDS transpose + TIMEOUT 90 + LABELS "integration-tests;pc-sampling" + PRELOAD "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-cmd + DISABLED "${IS_PC_SAMPLING_DISABLED}") -string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-cmd + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS -k + test_multi_agent_support + --input-samples-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_pc_sampling_host_trap.csv + --input-kernel-trace-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_kernel_trace.csv + --input-agent-info-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_agent_info.csv + TIMEOUT 60 + LABELS "integration-tests;pc-sampling" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-cmd + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_DISABLED}") -set(pc-sampling-env-host-trap-transpose-multiple-agents "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-cmd-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling" - ENVIRONMENT - "${pc-sampling-env-host-trap-transpose-multiple-agents}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-json-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-json COMMAND $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.json -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input -- $ - ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS}) + ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS} + DEPENDS transpose + TIMEOUT 90 + LABELS "integration-tests;pc-sampling" + PRELOAD "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-json + DISABLED "${IS_PC_SAMPLING_DISABLED}") -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-json-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling" - ENVIRONMENT - "${pc-sampling-env-host-trap-transpose-multiple-agents}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-json + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS -k + test_multi_agent_support + --input-samples-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_pc_sampling_host_trap.csv + --input-kernel-trace-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_kernel_trace.csv + --input-agent-info-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_agent_info.csv + TIMEOUT 60 + LABELS "integration-tests;pc-sampling" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-json + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_DISABLED}") -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-yaml-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-yaml COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.yml -d - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input -o out --output-format csv -- - $ ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS}) + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.yml + -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input -o out --output-format csv + -- $ ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS} + DEPENDS transpose + TIMEOUT 90 + LABELS "integration-tests;pc-sampling" + PRELOAD "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-yaml + DISABLED "${IS_PC_SAMPLING_DISABLED}") -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-yaml-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling" - ENVIRONMENT - "${pc-sampling-env-host-trap-transpose-multiple-agents}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") - -# ========================= Validation tests - -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-cmd-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - test_multi_agent_support --input-samples-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_pc_sampling_host_trap.csv - --input-kernel-trace-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_kernel_trace.csv - --input-agent-info-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_agent_info.csv) - -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-cmd-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling" - DEPENDS - "rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-cmd-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-json-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - test_multi_agent_support --input-samples-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_pc_sampling_host_trap.csv - --input-kernel-trace-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_kernel_trace.csv - --input-agent-info-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_agent_info.csv) - -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-json-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling" - DEPENDS - "rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-json-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-yaml-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - test_multi_agent_support --input-samples-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_pc_sampling_host_trap.csv - --input-kernel-trace-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_kernel_trace.csv - --input-agent-info-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_agent_info.csv) - -set_tests_properties( - rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-yaml-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling" - DEPENDS - "rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-yaml-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-yaml + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS -k + test_multi_agent_support + --input-samples-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_pc_sampling_host_trap.csv + --input-kernel-trace-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_kernel_trace.csv + --input-agent-info-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_agent_info.csv + TIMEOUT 60 + LABELS "integration-tests;pc-sampling" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-yaml + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/CMakeLists.txt index 8a0d9ebfca..a5f85c9838 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/CMakeLists.txt @@ -35,156 +35,109 @@ find_package(rocprofiler-sdk REQUIRED) # Checking whether stochastic PC sampling is disabled. If so, skip the tests. rocprofiler_sdk_pc_sampling_stochastic_disabled(IS_PC_SAMPLING_STOCHASTIC_DISABLED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py - input.json input.yml) +string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV + "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-cmd-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-cmd COMMAND $ --pc-sampling-unit cycles --pc-sampling-method stochastic --pc-sampling-interval 1048576 -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input -o out --output-format csv json - -- $) + -- $ + DEPENDS exec-mask-manipulation + TIMEOUT 90 + LABELS "integration-tests;pc-sampling;stochastic" + ENVIRONMENT "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-cmd + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") -string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-cmd + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS -k + test_validate_pc_sampling_ + --input-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_pc_sampling_stochastic.csv + --input-json + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_results.json + --all-sampled + False + TIMEOUT 60 + LABELS "integration-tests;pc-sampling;stochastic" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-cmd + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") -set(pc-sampling-env-stochastic-exec-mask-manipulation "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-cmd-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling;stochastic" - ENVIRONMENT - "${pc-sampling-env-stochastic-exec-mask-manipulation}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-json-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-json COMMAND $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.json -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input -- - $) + $ + DEPENDS exec-mask-manipulation + TIMEOUT 90 + LABELS "integration-tests;pc-sampling;stochastic" + ENVIRONMENT "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-json + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-json-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling;stochastic" - ENVIRONMENT - "${pc-sampling-env-stochastic-exec-mask-manipulation}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-json + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS -k + test_validate_pc_sampling_ + --input-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_pc_sampling_stochastic.csv + --input-json + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_results.json + --all-sampled + False + TIMEOUT 60 + LABELS "integration-tests;pc-sampling;stochastic" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-json + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-yaml-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-yaml COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.yml -d - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input -- - $) + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.yml + -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input -- + $ + DEPENDS exec-mask-manipulation + TIMEOUT 90 + LABELS "integration-tests;pc-sampling;stochastic" + ENVIRONMENT "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-yaml + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-yaml-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling;stochastic" - ENVIRONMENT - "${pc-sampling-env-stochastic-exec-mask-manipulation}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") - -# ========================= Validation tests - -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-cmd-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - test_validate_pc_sampling_ --input-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_pc_sampling_stochastic.csv - --input-json ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_results.json - --all-sampled False) - -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-cmd-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling;stochastic" - DEPENDS - "rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-cmd-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-json-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - test_validate_pc_sampling_ --input-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_pc_sampling_stochastic.csv - --input-json ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_results.json - --all-sampled False) - -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-json-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling;stochastic" - DEPENDS - "rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-json-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-yaml-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - test_validate_pc_sampling_ --input-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_pc_sampling_stochastic.csv - --input-json ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_results.json - --all-sampled False) - -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-yaml-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling;stochastic" - DEPENDS - "rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-yaml-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-yaml + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS -k + test_validate_pc_sampling_ + --input-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_pc_sampling_stochastic.csv + --input-json + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_results.json + --all-sampled + False + TIMEOUT 60 + LABELS "integration-tests;pc-sampling;stochastic" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-yaml + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/conftest.py b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/conftest.py index e76b594fc7..0d7d59f5a2 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/conftest.py +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/conftest.py @@ -79,11 +79,17 @@ def input_csv(request): @pytest.fixture def input_json(request): filename = request.config.getoption("--input-json") - with open(filename, "r") as inp: - # Significant overhead of 5-6secs observed when feeding - # data into the dotdict. - # Using plain python dict instead - return collapse_dict_list(json.load(inp)) + if not os.path.isfile(filename): + # The CSV file is not generated, because the dependency test + # responsible to generate this file was skipped or failed. + # Thus emit the message to skip this test as well. + print("PC sampling unavailable") + else: + with open(filename, "r") as inp: + # Significant overhead of 5-6secs observed when feeding + # data into the dotdict. + # Using plain python dict instead + return collapse_dict_list(json.load(inp)) @pytest.fixture diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/CMakeLists.txt index ca88e6567a..1211b8887b 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/CMakeLists.txt @@ -35,8 +35,8 @@ find_package(rocprofiler-sdk REQUIRED) # Checking whether stochastic PC sampling is disabled. If so, skip the tests. rocprofiler_sdk_pc_sampling_stochastic_disabled(IS_PC_SAMPLING_STOCHASTIC_DISABLED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py - input.json input.yml) +string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV + "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") # To ensure we sample all agents, use 16 threads each assigned to one agent in a round # robin manner. To keep the job per device reasonable, each thread offloads 100 instances @@ -44,165 +44,115 @@ rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.p set(TRANSPOSE_NUM_THREADS 16) set(TRANSPOSE_NUM_ITERATIONS 100) -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-cmd-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-cmd COMMAND - $ --kernel-trace --pc-sampling-unit - cycles --pc-sampling-method stochastic --pc-sampling-interval 1048576 -d + $ --kernel-trace --pc-sampling-unit cycles + --pc-sampling-method stochastic --pc-sampling-interval 1048576 -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input -o out --output-format csv json - -- $ ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS}) + -- $ ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS} + DEPENDS transpose + TIMEOUT 90 + LABELS "integration-tests;pc-sampling;stochastic" + ENVIRONMENT "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-cmd + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") -string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-cmd + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS -k + test_ + --input-samples-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_pc_sampling_stochastic.csv + --input-samples-json + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_results.json + --input-kernel-trace-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_kernel_trace.csv + --input-agent-info-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_agent_info.csv + TIMEOUT 60 + LABELS "integration-tests;pc-sampling;stochastic" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-cmd + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") -set(pc-sampling-env-stochastic-transpose-multiple-agents "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-cmd-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling;stochastic" - ENVIRONMENT - "${pc-sampling-env-stochastic-transpose-multiple-agents}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-json-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-json COMMAND $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.json -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input -- $ - ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS}) + ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS} + DEPENDS transpose + TIMEOUT 90 + LABELS "integration-tests;pc-sampling;stochastic" + ENVIRONMENT "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-json + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-json-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling;stochastic" - ENVIRONMENT - "${pc-sampling-env-stochastic-transpose-multiple-agents}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-json + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS -k + test_ + --input-samples-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_pc_sampling_stochastic.csv + --input-samples-json + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_results.json + --input-kernel-trace-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_kernel_trace.csv + --input-agent-info-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_agent_info.csv + TIMEOUT 60 + LABELS "integration-tests;pc-sampling;stochastic" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-json + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-yaml-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-yaml COMMAND - $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input.yml -d - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input -- $ - ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS}) + $ -i ${CMAKE_CURRENT_BINARY_DIR}/input.yml + -d ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input -- $ + ${TRANSPOSE_NUM_THREADS} ${TRANSPOSE_NUM_ITERATIONS} + DEPENDS transpose + TIMEOUT 90 + LABELS "integration-tests;pc-sampling;stochastic" + ENVIRONMENT "${PRELOAD_ENV}" + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + FIXTURES_SETUP + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-yaml + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-yaml-execute - PROPERTIES TIMEOUT - 90 - LABELS - "integration-tests;pc-sampling;stochastic" - ENVIRONMENT - "${pc-sampling-env-stochastic-transpose-multiple-agents}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") - -# ========================= Validation tests - -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-cmd-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k test_ - --input-samples-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_pc_sampling_stochastic.csv - --input-samples-json - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_results.json - --input-kernel-trace-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_kernel_trace.csv - --input-agent-info-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_cmd_input/out_agent_info.csv) - -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-cmd-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling;stochastic" - DEPENDS - "rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-cmd-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-json-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k test_ - --input-samples-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_pc_sampling_stochastic.csv - --input-samples-json - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_results.json - --input-kernel-trace-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_kernel_trace.csv - --input-agent-info-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_json_input/out_agent_info.csv) - -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-json-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling;stochastic" - DEPENDS - "rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-json-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") - -add_test( - NAME rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-yaml-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k test_ - --input-samples-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_pc_sampling_stochastic.csv - --input-samples-json - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_results.json - --input-kernel-trace-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_kernel_trace.csv - --input-agent-info-csv - ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_agent_info.csv) - -set_tests_properties( - rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-yaml-validate - PROPERTIES - TIMEOUT - 60 - LABELS - "integration-tests;pc-sampling;stochastic" - DEPENDS - "rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-yaml-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - SKIP_REGULAR_EXPRESSION - "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" - DISABLED - "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-yaml + TEST_PATHS validate.py + COPY conftest.py input.json input.yml + CONFIG pytest.ini + ARGS -k + test_ + --input-samples-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_pc_sampling_stochastic.csv + --input-samples-json + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_results.json + --input-kernel-trace-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_kernel_trace.csv + --input-agent-info-csv + ${CMAKE_CURRENT_BINARY_DIR}/pc_sampling_yaml_input/out_agent_info.csv + TIMEOUT 60 + LABELS "integration-tests;pc-sampling;stochastic" + FIXTURES_REQUIRED + rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-yaml + SKIP_REGULAR_EXPRESSION "${ROCPROFV3_TESTS_PC_SAMPLING_SKIP_REGEX}" + DISABLED "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/conftest.py b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/conftest.py index 56b39cca61..e954614957 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/conftest.py +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/conftest.py @@ -106,8 +106,14 @@ def input_agent_info_csv(request): @pytest.fixture def input_samples_json(request): filename = request.config.getoption("--input-samples-json") - with open(filename, "r") as inp: - # Significant overhead of 5-6secs observed when feeding - # data into the dotdict. - # Using plain python dict instead - return collapse_dict_list(json.load(inp)) + if not os.path.isfile(filename): + # The CSV file is not generated, because the dependency test + # responsible to generate this file was skipped or failed. + # Thus emit the message to skip this test as well. + print("PC sampling unavailable") + else: + with open(filename, "r") as inp: + # Significant overhead of 5-6secs observed when feeding + # data into the dotdict. + # Using plain python dict instead + return collapse_dict_list(json.load(inp)) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/python-bindings/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/python-bindings/CMakeLists.txt index 33eaf082fa..bcdd79a301 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/python-bindings/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/python-bindings/CMakeLists.txt @@ -23,46 +23,35 @@ endif() string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(tracing-env - "${PRELOAD_ENV}" - "PYTHONPATH=${rocprofiler-sdk_LIB_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" - ) - -rocprofiler_configure_pytest_files(CONFIG pytest.ini marker.py COPY validate.py - conftest.py) - -add_test( - NAME rocprofv3-trace-roctx-python-bindings-execute +rocprofiler_add_integration_execute_test( + rocprofv3-trace-roctx-python-bindings COMMAND $ --marker-trace --summary -u sec -d - ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings -o out --output-format csv - json pftrace --log-level ${LOG_LEVEL} -- ${Python3_EXECUTABLE} - ${CMAKE_CURRENT_BINARY_DIR}/marker.py) + ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings -o out --output-format csv json + pftrace --log-level ${LOG_LEVEL} -- ${Python3_EXECUTABLE} + ${CMAKE_CURRENT_BINARY_DIR}/marker.py + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT + "PYTHONPATH=${rocprofiler-sdk_LIB_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" + FIXTURES_SETUP rocprofv3-trace-roctx-python-bindings) -set_tests_properties( - rocprofv3-trace-roctx-python-bindings-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${tracing-env}") - -add_test( - NAME rocprofv3-trace-roctx-python-bindings-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_agent_info.csv - --marker-input - ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_marker_api_trace.csv - --json-input ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_results.pftrace) - -set_tests_properties( - rocprofv3-trace-roctx-python-bindings-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - "rocprofv3-trace-roctx-python-bindings-execute" - DISABLED - "${TRANSPOSE_ROCTRACER_ROCTX_DISABLED}" - FAIL_REGULAR_EXPRESSION - "AssertionError") +rocprofiler_add_integration_validate_test( + rocprofv3-trace-roctx-python-bindings + TEST_PATHS validate.py + COPY conftest.py marker.py + CONFIG pytest.ini + ARGS --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_agent_info.csv + --marker-input + ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_marker_api_trace.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/marker-python-bindings/out_results.pftrace + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-trace-roctx-python-bindings + DISABLED "${TRANSPOSE_ROCTRACER_ROCTX_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/python-bindings/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/python-bindings/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/python-bindings/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/python-bindings/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/rocdecode-trace/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/rocdecode-trace/CMakeLists.txt index 901a34330f..64a86e7b29 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/rocdecode-trace/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/rocdecode-trace/CMakeLists.txt @@ -30,46 +30,36 @@ if(NOT TARGET rocdecode-demo) set(IS_DISABLED ON) endif() -add_test( - NAME rocprofv3-test-rocdecode-tracing-execute +# rocDecode tracing test +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocdecode-tracing COMMAND $ --rocdecode-trace -d ${CMAKE_CURRENT_BINARY_DIR}/%tag%-trace -o out --output-format json csv pftrace otf2 --log-level env -- - $,$<$:$>,rocdecode-demo> - -i ${ROCDECODE_VIDEO_FILE}) + $,$,rocdecode-demo> + -i ${ROCDECODE_VIDEO_FILE} + DEPENDS rocdecode-demo + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-rocdecode-tracing + DISABLED "${IS_DISABLED}") -set_tests_properties( - rocprofv3-test-rocdecode-tracing-execute - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${rocdecode-tracing-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${IS_DISABLED}") - -add_test( - NAME rocprofv3-test-rocdecode-tracing-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/rocdecode-demo-trace/out_results.json --otf2-input - ${CMAKE_CURRENT_BINARY_DIR}/rocdecode-demo-trace/out_results.otf2 --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/rocdecode-demo-trace/out_results.pftrace --csv-input - ${CMAKE_CURRENT_BINARY_DIR}/rocdecode-demo-trace/out_rocdecode_api_trace.csv) - -set_tests_properties( - rocprofv3-test-rocdecode-tracing-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - rocprofv3-test-rocdecode-tracing-execute - FAIL_REGULAR_EXPRESSION - "AssertionError" - DISABLED - "${IS_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-rocdecode-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/rocdecode-demo-trace/out_results.json + --otf2-input + ${CMAKE_CURRENT_BINARY_DIR}/rocdecode-demo-trace/out_results.otf2 + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/rocdecode-demo-trace/out_results.pftrace + --csv-input + ${CMAKE_CURRENT_BINARY_DIR}/rocdecode-demo-trace/out_rocdecode_api_trace.csv + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-rocdecode-tracing + DISABLED "${IS_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/rocdecode-trace/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/rocdecode-trace/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/rocdecode-trace/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/rocdecode-trace/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/rocjpeg-trace/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/rocjpeg-trace/CMakeLists.txt index fbc555354d..b246784f81 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/rocjpeg-trace/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/rocjpeg-trace/CMakeLists.txt @@ -51,46 +51,35 @@ endif() # CI Sanitizer run gives the following error: No target "rocjpeg-demo" Adding if-statement # to avoid tests for now to stop error -add_test( - NAME rocprofv3-test-rocjpeg-tracing-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocjpeg-tracing COMMAND $ --rocjpeg-trace -d ${CMAKE_CURRENT_BINARY_DIR}/%tag%-trace -o out --output-format json csv --log-level env -- - $,$<$:$>,rocjpeg-demo> - -i ${rocJPEG_IMAGE_DIR}) + $,$,rocjpeg-demo> -i + ${rocJPEG_IMAGE_DIR} + DEPENDS rocjpeg-demo + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-rocjpeg-tracing + DISABLED "${IS_DISABLED}") -set_tests_properties( - rocprofv3-test-rocjpeg-tracing-execute - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${rocjpeg-tracing-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${IS_DISABLED}") - -add_test( - NAME rocprofv3-test-rocjpeg-tracing-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_results.json --otf2-input - ${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_results.otf2 --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_results.pftrace --csv-input - ${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_rocjpeg_api_trace.csv) - -set_tests_properties( - rocprofv3-test-rocjpeg-tracing-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - rocprofv3-test-rocjpeg-tracing-execute - FAIL_REGULAR_EXPRESSION - "AssertionError" - DISABLED - "${IS_DISABLED}") +rocprofiler_add_integration_validate_test( + rocprofv3-test-rocjpeg-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_results.json + --otf2-input + ${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_results.otf2 + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_results.pftrace + --csv-input + ${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_rocjpeg_api_trace.csv + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-rocjpeg-tracing + DISABLED "${IS_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/rocjpeg-trace/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/rocjpeg-trace/pytest.ini index e2027e2fd5..b4e84a8818 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/rocjpeg-trace/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/rocjpeg-trace/pytest.ini @@ -22,6 +22,6 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-kernel-rename/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-kernel-rename/CMakeLists.txt index 6d7b0608e1..37df700254 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-kernel-rename/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-kernel-rename/CMakeLists.txt @@ -30,12 +30,9 @@ project( find_package(rocprofiler-sdk REQUIRED) set(rocprofv3-rocpd-env - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}" "PYTHONPATH=${rocprofiler-sdk_LIB_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" ) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY conftest.py validate.py) - find_package(Python3 REQUIRED) ######################################################################################### @@ -44,45 +41,31 @@ find_package(Python3 REQUIRED) # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-no-rename-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-no-rename COMMAND $ -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-no-kernel-rename -o out --output-format rocpd - json csv --kernel-trace -- $) + json csv --kernel-trace -- $ + DEPENDS simple-transpose + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-rename) -set_tests_properties( - rocprofv3-test-rocpd-no-rename-execute - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - rocprofv3-test-rocpd-no-rename) - -add_test( - NAME rocprofv3-test-rocpd-rename-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-rename COMMAND $ -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-kernel-rename -o out --output-format csv - --kernel-trace --kernel-rename -- $) - -set_tests_properties( - rocprofv3-test-rocpd-rename-execute - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - rocprofv3-test-rocpd-rename) + --kernel-trace --kernel-rename -- $ + DEPENDS simple-transpose + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-rename) ######################################################################################### # @@ -90,53 +73,33 @@ set_tests_properties( # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-rename-csv-generation +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-rename-csv-generation COMMAND ${Python3_EXECUTABLE} -m rocpd convert -f csv --kernel-rename -d ${CMAKE_CURRENT_BINARY_DIR}/generated-rename-csv/ -i - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-no-kernel-rename/out_results.db) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-no-kernel-rename/out_results.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-rename-csv-generation + FIXTURES_REQUIRED rocprofv3-test-rocpd-rename) -set_tests_properties( - rocprofv3-test-rocpd-rename-csv-generation - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-no-rename-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - rocprofv3-test-rocpd-rename-generation - FIXTURES_REQUIRED - rocprofv3-test-rocpd-no-rename) - -add_test( - NAME rocprofv3-test-rocpd-no-rename-csv-generation +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-no-rename-csv-generation COMMAND ${Python3_EXECUTABLE} -m rocpd convert -f csv -d ${CMAKE_CURRENT_BINARY_DIR}/generated-no-rename-csv/ -i - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-no-kernel-rename/out_results.db) - -set_tests_properties( - rocprofv3-test-rocpd-no-rename-csv-generation - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-no-rename-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - rocprofv3-test-rocpd-no-rename-generation - FIXTURES_REQUIRED - rocprofv3-test-rocpd-no-rename) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-no-kernel-rename/out_results.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-rename-csv-generation + FIXTURES_REQUIRED rocprofv3-test-rocpd-rename) ######################################################################################### # @@ -144,32 +107,20 @@ set_tests_properties( # ######################################################################################### -set(VALIDATION_DEPENDS rocprofv3-test-rocpd-rename-csv-generation - rocprofv3-test-rocpd-no-rename-csv-generation) - -add_test( - NAME rocprofv3-test-rocpd-rename-validation - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --rename-csv-input - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-kernel-rename/out_kernel_trace.csv - --no-rename-csv-input - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-no-kernel-rename/out_kernel_trace.csv - --generated-rename-csv-input - ${CMAKE_CURRENT_BINARY_DIR}/generated-rename-csv/out_kernel_trace.csv - --generated-no-rename-csv-input - ${CMAKE_CURRENT_BINARY_DIR}/generated-no-rename-csv/out_kernel_trace.csv) - -set_tests_properties( - rocprofv3-test-rocpd-rename-validation - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "${VALIDATION_DEPENDS}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd-no-rename-generation) +rocprofiler_add_integration_validate_test( + rocprofv3-test-rocpd-rename + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --rename-csv-input + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-kernel-rename/out_kernel_trace.csv + --no-rename-csv-input + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-no-kernel-rename/out_kernel_trace.csv + --generated-rename-csv-input + ${CMAKE_CURRENT_BINARY_DIR}/generated-rename-csv/out_kernel_trace.csv + --generated-no-rename-csv-input + ${CMAKE_CURRENT_BINARY_DIR}/generated-no-rename-csv/out_kernel_trace.csv + TIMEOUT 120 + LABELS "integration-tests;rocpd" PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_REQUIRED rocprofv3-test-rocpd-rename-csv-generation) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-kernel-rename/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-kernel-rename/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-kernel-rename/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-kernel-rename/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-scratch/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-scratch/CMakeLists.txt index 3a70fde388..b045fe7527 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-scratch/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-scratch/CMakeLists.txt @@ -11,7 +11,6 @@ project( find_package(rocprofiler-sdk REQUIRED) set(rocprofv3-rocpd-scratch-env - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}" "PYTHONPATH=${rocprofiler-sdk_LIB_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" "OMPI_ALLOW_RUN_AS_ROOT=1" "OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1") @@ -26,25 +25,18 @@ find_package(Python3 REQUIRED) # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-scratch-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-scratch COMMAND $ --scratch-memory-trace -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data -o out --output-format rocpd json - --runtime-trace --kernel-rename -- $) - -set_tests_properties( - rocprofv3-test-rocpd-scratch-execute - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-scratch-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - rocprofv3-test-rocpd-scratch) + --runtime-trace --kernel-rename -- $ + DEPENDS scratch-memory + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-scratch-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-scratch) ######################################################################################### # @@ -52,29 +44,19 @@ set_tests_properties( # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-scratch-perfetto-generation +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-scratch-perfetto-generation COMMAND ${Python3_EXECUTABLE} -m rocpd convert -f pftrace --kernel-rename -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data -i - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.db) - -set_tests_properties( - rocprofv3-test-rocpd-scratch-perfetto-generation - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-scratch-env}" - DEPENDS - "rocprofv3-test-rocpd-scratch-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - rocprofv3-test-rocpd-scratch-generation - FIXTURES_REQUIRED - rocprofv3-test-rocpd-scratch) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-scratch-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-scratch-generation + FIXTURES_REQUIRED rocprofv3-test-rocpd-scratch) ######################################################################################### # @@ -82,26 +64,14 @@ set_tests_properties( # ######################################################################################### -set(VALIDATION_DEPENDS rocprofv3-test-rocpd-scratch-perfetto-generation) - -add_test( - NAME rocprofv3-test-rocpd-scratch-validation - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.json --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_results.pftrace) - -set_tests_properties( - rocprofv3-test-rocpd-scratch-validation - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-scratch-env}" - DEPENDS - rocprofv3-test-rocpd-scratch-perfetto-generation - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd-scratch-generation) +rocprofiler_add_integration_validate_test( + rocprofv3-test-rocpd-scratch + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.json + --pftrace-input ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_results.pftrace + TIMEOUT 120 + LABELS "integration-tests;rocpd" PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-scratch-env}" + FIXTURES_REQUIRED rocprofv3-test-rocpd-scratch-generation) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-scratch/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-scratch/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-scratch/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd-scratch/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd/CMakeLists.txt index 75b8dd37b4..c826544a2a 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd/CMakeLists.txt @@ -11,13 +11,10 @@ project( find_package(rocprofiler-sdk REQUIRED) set(rocprofv3-rocpd-env - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}" "PYTHONPATH=${rocprofiler-sdk_LIB_DIR}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" "OMPI_ALLOW_RUN_AS_ROOT=1" "OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1") -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY conftest.py validate.py) - find_package(MPI) find_package(Python3 REQUIRED) @@ -40,60 +37,49 @@ endif() # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd COMMAND $ -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data -o out --output-format rocpd json --runtime-trace --kernel-rename --output-config --pmc SQ_WAVES -- - $ 500 2) + $ 500 2 + DEPENDS reproducible-dispatch-count + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-rocpd) -# Can remove this test if MULTIPROC is re-enabled and rely on the multiproc databases for -# packaging -add_test( - NAME rocprofv3-test-rocpd-execute2 - COMMAND - $ -d - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data -o out2 --output-format rocpd - --runtime-trace --kernel-rename --pmc SQ_WAVES -- - $ 500 2) - -set_tests_properties( - rocprofv3-test-rocpd-execute rocprofv3-test-rocpd-execute2 - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - rocprofv3-test-rocpd) - -add_test( - NAME rocprofv3-test-rocpd-execute-multiproc +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-multiproc COMMAND ${MULTIPROC_LAUNCHER} ${Python3_EXECUTABLE} $ -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc -o out_mp_%rank% --output-format rocpd json --runtime-trace --kernel-rename --output-config --pmc - SQ_WAVES -- $ 200 1) + SQ_WAVES -- $ 200 1 + DEPENDS reproducible-dispatch-count + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-rocpd-multiproc + DISABLED "${MULTIPROC_IS_DISABLED}") -set_tests_properties( - rocprofv3-test-rocpd-execute-multiproc - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${MULTIPROC_IS_DISABLED}" - FIXTURES_SETUP - rocprofv3-test-rocpd-multiproc) +# Can remove this test if MULTIPROC is re-enabled and rely on the multiproc databases for +# packaging +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-execute2 + COMMAND + $ -d + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data -o out2 --output-format rocpd + --runtime-trace --kernel-rename --pmc SQ_WAVES -- + $ 500 2 + DEPENDS reproducible-dispatch-count + TIMEOUT 120 + LABELS "integration-tests;rocpd" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + FIXTURES_SETUP rocprofv3-test-rocpd) ######################################################################################### # @@ -101,52 +87,35 @@ set_tests_properties( # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-otf2-generation +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-otf2-generation COMMAND ${Python3_EXECUTABLE} -m rocpd convert -f otf2 --kernel-rename -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data -i - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.db) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-generation + FIXTURES_REQUIRED rocprofv3-test-rocpd) -set_tests_properties( - rocprofv3-test-rocpd-otf2-generation - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - rocprofv3-test-rocpd-generation - FIXTURES_REQUIRED - rocprofv3-test-rocpd) - -add_test( - NAME rocprofv3-test-rocpd-otf2-generation-multiproc +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-otf2-generation-multiproc COMMAND ${Python3_EXECUTABLE} -m rocpd convert -f otf2 --kernel-rename -d - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data-multiproc -o rocpd-mp-output-test - -i ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out_mp_0_results.db - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out_mp_1_results.db) - -set_tests_properties( - rocprofv3-test-rocpd-otf2-generation-multiproc - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${MULTIPROC_IS_DISABLED}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd-multiproc) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data-multiproc -o rocpd-mp-output-test -i + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out_mp_0_results.db + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out_mp_1_results.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-generation + FIXTURES_REQUIRED rocprofv3-test-rocpd + DISABLED "${MULTIPROC_IS_DISABLED}") ######################################################################################### # @@ -154,53 +123,36 @@ set_tests_properties( # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-perfetto-generation +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-perfetto-generation COMMAND ${Python3_EXECUTABLE} -m rocpd convert -f pftrace --kernel-rename -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data -i - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.db) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-generation + FIXTURES_REQUIRED rocprofv3-test-rocpd) -set_tests_properties( - rocprofv3-test-rocpd-perfetto-generation - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - rocprofv3-test-rocpd-generation - FIXTURES_REQUIRED - rocprofv3-test-rocpd) - -add_test( - NAME rocprofv3-test-rocpd-perfetto-generation-multiproc +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-perfetto-generation-multiproc COMMAND ${Python3_EXECUTABLE} -m rocpd convert -f perfetto --kernel-rename --group-by-queue -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data-multiproc -o out_mp -i ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out_mp_0_results.db - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out_mp_1_results.db) - -set_tests_properties( - rocprofv3-test-rocpd-perfetto-generation-multiproc - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${MULTIPROC_IS_DISABLED}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd-multiproc) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out_mp_1_results.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-generation + FIXTURES_REQUIRED rocprofv3-test-rocpd + DISABLED "${MULTIPROC_IS_DISABLED}") ######################################################################################### # @@ -208,81 +160,54 @@ set_tests_properties( # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-csv-generation +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-csv-generation COMMAND ${Python3_EXECUTABLE} -m rocpd convert -f csv --kernel-rename -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data -i - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.db) - -set_tests_properties( - rocprofv3-test-rocpd-csv-generation - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - rocprofv3-test-rocpd-generation - FIXTURES_REQUIRED - rocprofv3-test-rocpd) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-generation + FIXTURES_REQUIRED rocprofv3-test-rocpd) ######################################################################################### # # Summary generation # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-summary-generation +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-summary-generation COMMAND ${Python3_EXECUTABLE} -m rocpd summary --domain-summary --summary-by-rank -f csv -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/summary -i - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.db) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 45 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-generation + FIXTURES_REQUIRED rocprofv3-test-rocpd) -set_tests_properties( - rocprofv3-test-rocpd-summary-generation - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_SETUP - rocprofv3-test-rocpd-generation - FIXTURES_REQUIRED - rocprofv3-test-rocpd) - -add_test( - NAME rocprofv3-test-rocpd-summary-generation-multiproc +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-summary-generation-multiproc COMMAND ${Python3_EXECUTABLE} -m rocpd summary --domain-summary --summary-by-rank -f csv -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-test/summary -o out_mp -i ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out_mp_0_results.db - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out_mp_1_results.db) - -set_tests_properties( - rocprofv3-test-rocpd-summary-generation-multiproc - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${MULTIPROC_IS_DISABLED}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd-multiproc) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out_mp_1_results.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FIXTURES_SETUP rocprofv3-test-rocpd-generation + FIXTURES_REQUIRED rocprofv3-test-rocpd + DISABLED "${MULTIPROC_IS_DISABLED}") ######################################################################################### # @@ -290,37 +215,26 @@ set_tests_properties( # ######################################################################################### -set(VALIDATION_DEPENDS - rocprofv3-test-rocpd-perfetto-generation rocprofv3-test-rocpd-csv-generation - rocprofv3-test-rocpd-otf2-generation) - -add_test( - NAME rocprofv3-test-rocpd-validation - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.json --otf2-input - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_results.otf2 --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_results.pftrace --csv-input - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_agent_info.csv - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_counter_collection_trace.csv - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_kernel_trace.csv - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_memory_allocation_trace.csv - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_regions_trace.csv) - -set_tests_properties( - rocprofv3-test-rocpd-validation - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "${VALIDATION_DEPENDS}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd-generation) +rocprofiler_add_integration_validate_test( + rocprofv3-test-rocpd + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out_results.json + --otf2-input + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_results.otf2 + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_results.pftrace + --csv-input + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_agent_info.csv + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_counter_collection_trace.csv + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_kernel_trace.csv + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_memory_allocation_trace.csv + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-output-data/out_regions_trace.csv + TIMEOUT 120 + LABELS "integration-tests;rocpd" + FIXTURES_REQUIRED rocprofv3-test-rocpd-generation) ######################################################################################### # @@ -328,51 +242,34 @@ set_tests_properties( # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-package-generation +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-package-generation COMMAND ${Python3_EXECUTABLE} -m rocpd package --consolidate -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/test_package -i - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out*.db) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/out*.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + FIXTURES_SETUP rocprofv3-test-rocpd-package-generation + FIXTURES_REQUIRED rocprofv3-test-rocpd) -set_tests_properties( - rocprofv3-test-rocpd-package-generation - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-execute" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd) - -add_test( - NAME rocprofv3-test-rocpd-package-generation-multiproc +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-package-generation-multiproc COMMAND ${Python3_EXECUTABLE} -m rocpd package --consolidate -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/test_package_multi -i - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out*.db) - -set_tests_properties( - rocprofv3-test-rocpd-package-generation-multiproc - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-execute-multiproc" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${MULTIPROC_IS_DISABLED}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd-multiproc) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/out*.db + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + DISABLED "${MULTIPROC_IS_DISABLED}" + FIXTURES_SETUP rocprofv3-test-rocpd-package-generation-multiproc + FIXTURES_REQUIRED rocprofv3-test-rocpd-multiproc) ######################################################################################### # @@ -380,51 +277,32 @@ set_tests_properties( # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-query-using-package +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-query-using-package COMMAND ${Python3_EXECUTABLE} -m rocpd query -i ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/test_package.rpdb --query - "SELECT id, type FROM rocpd_info_agent LIMIT 10;") + "SELECT id, type FROM rocpd_info_agent LIMIT 10;" + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + FIXTURES_REQUIRED rocprofv3-test-rocpd-package-generation) -set_tests_properties( - rocprofv3-test-rocpd-query-using-package - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-package-generation" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd) - -add_test( - NAME rocprofv3-test-rocpd-query-using-package-multiproc +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-query-using-package-multiproc COMMAND ${Python3_EXECUTABLE} -m rocpd query -i ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/test_package_multi.rpdb - --query "SELECT id, type FROM rocpd_info_agent LIMIT 10;") - -set_tests_properties( - rocprofv3-test-rocpd-query-using-package-multiproc - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-package-generation-multiproc" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${MULTIPROC_IS_DISABLED}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd-multiproc) + --query "SELECT id, type FROM rocpd_info_agent LIMIT 10;" + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + DISABLED "${MULTIPROC_IS_DISABLED}" + FIXTURES_REQUIRED rocprofv3-test-rocpd-package-generation-multiproc) ######################################################################################### # @@ -432,51 +310,34 @@ set_tests_properties( # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-merge-generation-using-package +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-merge-generation-using-package COMMAND ${Python3_EXECUTABLE} -m rocpd merge -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data -o merged_db -i - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/test_package.rpdb) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/test_package.rpdb + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + FIXTURES_SETUP rocprofv3-test-rocpd-merge-generation-using-package + FIXTURES_REQUIRED rocprofv3-test-rocpd-package-generation) -set_tests_properties( - rocprofv3-test-rocpd-merge-generation-using-package - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-package-generation" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd) - -add_test( - NAME rocprofv3-test-rocpd-merge-generation-using-package-multiproc +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-merge-generation-using-package-multiproc COMMAND ${Python3_EXECUTABLE} -m rocpd merge -d ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc -o merged_db_multi.db -i - ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/test_package_multi.rpdb) - -set_tests_properties( - rocprofv3-test-rocpd-merge-generation-using-package-multiproc - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-package-generation-multiproc" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${MULTIPROC_IS_DISABLED}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd-multiproc) + ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/test_package_multi.rpdb + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + DISABLED "${MULTIPROC_IS_DISABLED}" + FIXTURES_SETUP rocprofv3-test-rocpd-merge-generation-using-package-multiproc + FIXTURES_REQUIRED rocprofv3-test-rocpd-package-generation-multiproc) ######################################################################################### # @@ -484,48 +345,29 @@ set_tests_properties( # ######################################################################################### -add_test( - NAME rocprofv3-test-rocpd-query-using-mergedDB +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-query-using-mergedDB COMMAND ${Python3_EXECUTABLE} -m rocpd query -i ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data/merged_db.db --query - "SELECT id, type FROM rocpd_info_agent LIMIT 10;") + "SELECT id, type FROM rocpd_info_agent LIMIT 10;" + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + FIXTURES_REQUIRED rocprofv3-test-rocpd-merge-generation-using-package) -set_tests_properties( - rocprofv3-test-rocpd-query-using-mergedDB - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-merge-generation-using-package" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd) - -add_test( - NAME rocprofv3-test-rocpd-query-using-mergedDB-multiproc +rocprofiler_add_integration_execute_test( + rocprofv3-test-rocpd-query-using-mergedDB-multiproc COMMAND ${Python3_EXECUTABLE} -m rocpd query -i ${CMAKE_CURRENT_BINARY_DIR}/rocpd-input-data-multiproc/merged_db_multi.db --query - "SELECT id, type FROM rocpd_info_agent LIMIT 10;") - -set_tests_properties( - rocprofv3-test-rocpd-query-using-mergedDB-multiproc - PROPERTIES TIMEOUT - 120 - LABELS - "integration-tests;rocpd" - ENVIRONMENT - "${rocprofv3-rocpd-env}" - DEPENDS - "rocprofv3-test-rocpd-merge-generation-using-package-multiproc" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${MULTIPROC_IS_DISABLED}" - FIXTURES_REQUIRED - rocprofv3-test-rocpd-multiproc) + "SELECT id, type FROM rocpd_info_agent LIMIT 10;" + DEPENDS rocprofiler-sdk::rocprofv3 + TIMEOUT 120 + LABELS "integration-tests;rocpd" + ENVIRONMENT "${rocprofv3-rocpd-env}" + FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + DISABLED "${MULTIPROC_IS_DISABLED}" + FIXTURES_REQUIRED rocprofv3-test-rocpd-merge-generation-using-package-multiproc) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/rocpd/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/rocpd/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/CMakeLists.txt index 2317bdcf34..775ad56610 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/CMakeLists.txt @@ -13,10 +13,8 @@ find_package(rocprofiler-sdk REQUIRED) string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(tracing-env "${PRELOAD_ENV}") - -rocprofiler_configure_pytest_files(CONFIG pytest.ini roctracer-roctx-input.yml - COPY validate.py conftest.py) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/roctracer-roctx-input.yml.in + ${CMAKE_CURRENT_BINARY_DIR}/roctracer-roctx-input.yml @ONLY) if(TARGET transpose-roctracer-roctx) set(TRANSPOSE_ROCTRACER_ROCTX_EXE $) @@ -26,33 +24,31 @@ else() set(TRANSPOSE_ROCTRACER_ROCTX_DISABLED ON) endif() -add_test(NAME rocprofv3-test-roctracer-roctx-trace-execute - COMMAND $ -i roctracer-roctx-input.yml - -- ${TRANSPOSE_ROCTRACER_ROCTX_EXE}) - -set_tests_properties( - rocprofv3-test-roctracer-roctx-trace-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${tracing-env}" - DISABLED "${TRANSPOSE_ROCTRACER_ROCTX_DISABLED}") - -add_test( - NAME rocprofv3-test-roctracer-roctx-trace-validate +rocprofiler_add_integration_execute_test( + rocprofv3-test-roctracer-roctx-trace COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/roctracer-roctx-trace/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/roctracer-roctx-trace/out_results.pftrace - --otf2-input ${CMAKE_CURRENT_BINARY_DIR}/roctracer-roctx-trace/out_results.otf2) + $ -i + ${CMAKE_CURRENT_BINARY_DIR}/roctracer-roctx-input.yml -- + ${TRANSPOSE_ROCTRACER_ROCTX_EXE} + DEPENDS transpose-roctracer-roctx + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + DISABLED "${TRANSPOSE_ROCTRACER_ROCTX_DISABLED}" + FIXTURES_SETUP rocprofv3-test-roctracer-roctx-trace) -set_tests_properties( - rocprofv3-test-roctracer-roctx-trace-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - "rocprofv3-test-roctracer-roctx-trace-execute" - DISABLED - "${TRANSPOSE_ROCTRACER_ROCTX_DISABLED}" - FAIL_REGULAR_EXPRESSION - "AssertionError") +rocprofiler_add_integration_validate_test( + rocprofv3-test-roctracer-roctx-trace + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/roctracer-roctx-trace/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/roctracer-roctx-trace/out_results.pftrace + --otf2-input + ${CMAKE_CURRENT_BINARY_DIR}/roctracer-roctx-trace/out_results.otf2 + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-roctracer-roctx-trace + DISABLED "${TRANSPOSE_ROCTRACER_ROCTX_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/roctracer-roctx-input.yml b/projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/roctracer-roctx-input.yml.in similarity index 100% rename from projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/roctracer-roctx-input.yml rename to projects/rocprofiler-sdk/tests/rocprofv3/roctracer-roctx/roctracer-roctx-input.yml.in diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/scratch-memory/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/scratch-memory/CMakeLists.txt index eea3ae6d60..26862d1ecc 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/scratch-memory/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/scratch-memory/CMakeLists.txt @@ -15,54 +15,31 @@ rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.p string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(scratch-memory-tracing-env "${PRELOAD_ENV}") - -set(VALIDATION_DEPENDS) foreach(_OUTPUT_FORMAT csv json) - add_test( - NAME rocprofv3-test-scratch-memory-tracing-${_OUTPUT_FORMAT}-execute + rocprofiler_add_integration_execute_test( + rocprofv3-test-scratch-memory-tracing-${_OUTPUT_FORMAT} COMMAND $ --scratch-memory-trace -d ${CMAKE_CURRENT_BINARY_DIR}/%tag%-trace -o out --output-format - ${_OUTPUT_FORMAT} --log-level env -- $) - - set_tests_properties( - rocprofv3-test-scratch-memory-tracing-${_OUTPUT_FORMAT}-execute - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${scratch-memory-tracing-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}" - FIXTURES_SETUP - rocprofv3-scratch-memory-tracing) - - list(APPEND VALIDATION_DEPENDS - rocprofv3-test-scratch-memory-tracing-${_OUTPUT_FORMAT}-execute) + ${_OUTPUT_FORMAT} --log-level env -- $ + DEPENDS scratch-memory + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-scratch-memory-tracing-${_OUTPUT_FORMAT} + DISABLED "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}") endforeach() -add_test( - NAME rocprofv3-test-scratch-memory-tracing-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/scratch-memory-trace/out_results.json --csv-input - ${CMAKE_CURRENT_BINARY_DIR}/scratch-memory-trace/out_scratch_memory_trace.csv) - -set_tests_properties( - rocprofv3-test-scratch-memory-tracing-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - "${VALIDATION_DEPENDS}" - FAIL_REGULAR_EXPRESSION - "AssertionError" - DISABLED - "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}" - FIXTURES_REQUIRED - rocprofv3-scratch-memory-tracing) +rocprofiler_add_integration_validate_test( + rocprofv3-test-scratch-memory-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input ${CMAKE_CURRENT_BINARY_DIR}/scratch-memory-trace/out_results.json + --csv-input + ${CMAKE_CURRENT_BINARY_DIR}/scratch-memory-trace/out_scratch_memory_trace.csv + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-scratch-memory-tracing-csv + rocprofv3-test-scratch-memory-tracing-json + DISABLED "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/scratch-memory/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/scratch-memory/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/scratch-memory/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/scratch-memory/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/summary/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/summary/CMakeLists.txt index f7bfab4b9b..e545fecccc 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/summary/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/summary/CMakeLists.txt @@ -19,10 +19,8 @@ endif() string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(summary-env "${PRELOAD_ENV}") - -rocprofiler_configure_pytest_files(CONFIG pytest.ini input-summary.yaml COPY validate.py - conftest.py) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/input-summary.yml.in + ${CMAKE_CURRENT_BINARY_DIR}/input-summary.yml @ONLY) ########################################################################################## # @@ -30,38 +28,36 @@ rocprofiler_configure_pytest_files(CONFIG pytest.ini input-summary.yaml COPY val # ########################################################################################## -set(summary-cmdl-env ${summary-env} "ARBITRARY_ENV_VARIABLE=%tag%-trace-cmd-line") - -add_test( - NAME rocprofv3-test-summary-cmd-line-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-summary-cmd-line COMMAND $ -d ${CMAKE_CURRENT_BINARY_DIR}/%tag%-trace-cmd-line -o out --output-format pftrace json otf2 --log-level env --runtime-trace --kernel-rename --summary --summary-output-file summary --summary-per-domain --summary-groups - "KERNEL_DISPATCH|MEMORY_COPY" ".*_API" -- $ 2 500 10) + "KERNEL_DISPATCH|MEMORY_COPY" ".*_API" -- $ 2 500 10 + DEPENDS transpose + TIMEOUT 45 + LABELS "integration-tests" + ENVIRONMENT "${PRELOAD_ENV}" "ARBITRARY_ENV_VARIABLE=%tag%-trace-cmd-line" + FIXTURES_SETUP rocprofv3-test-summary-cmd-line) -set_tests_properties( - rocprofv3-test-summary-cmd-line-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${summary-cmdl-env}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-summary-cmd-line-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.pftrace - --otf2-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.otf2 - --summary-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_summary.txt) - -set_tests_properties( - rocprofv3-test-summary-cmd-line-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-summary-execute" FAIL_REGULAR_EXPRESSION "AssertionError") +rocprofiler_add_integration_validate_test( + rocprofv3-test-summary-cmd-line + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.pftrace + --otf2-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_results.otf2 + --summary-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-cmd-line/out_summary.txt + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-summary-cmd-line) ########################################################################################## # @@ -71,32 +67,31 @@ set_tests_properties( set(summary-yaml-env ${summary-env} "ARBITRARY_ENV_VARIABLE=%tag%-trace-inp-yaml") -add_test( - NAME rocprofv3-test-summary-inp-yaml-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-summary-inp-yaml COMMAND $ -i - ${CMAKE_CURRENT_BINARY_DIR}/input-summary.yaml -- $ 2 500 - 10) + ${CMAKE_CURRENT_BINARY_DIR}/input-summary.yml -- $ 2 500 10 + DEPENDS transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "ARBITRARY_ENV_VARIABLE=%tag%-trace-inp-yaml" + FIXTURES_SETUP rocprofv3-test-summary-inp-yaml) -set_tests_properties( - rocprofv3-test-summary-inp-yaml-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${summary-yaml-env}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") - -add_test( - NAME rocprofv3-test-summary-inp-yaml-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.pftrace - --otf2-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.otf2 - --summary-input - ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_summary.txt) - -set_tests_properties( - rocprofv3-test-summary-inp-yaml-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-summary-inp-yaml-execute" FAIL_REGULAR_EXPRESSION - "AssertionError") +rocprofiler_add_integration_validate_test( + rocprofv3-test-summary-inp-yaml + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.pftrace + --otf2-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_results.otf2 + --summary-input + ${CMAKE_CURRENT_BINARY_DIR}/transpose-trace-inp-yaml/out_summary.txt + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-summary-inp-yaml) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/summary/input-summary.yaml b/projects/rocprofiler-sdk/tests/rocprofv3/summary/input-summary.yml.in similarity index 100% rename from projects/rocprofiler-sdk/tests/rocprofv3/summary/input-summary.yaml rename to projects/rocprofiler-sdk/tests/rocprofv3/summary/input-summary.yml.in diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/summary/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/summary/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/summary/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/summary/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/tracing-hip-in-libraries/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/tracing-hip-in-libraries/CMakeLists.txt index 9f5e8d3800..3ba8bb8c17 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/tracing-hip-in-libraries/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/tracing-hip-in-libraries/CMakeLists.txt @@ -10,8 +10,6 @@ project( find_package(rocprofiler-sdk REQUIRED) -rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py) - string(REPLACE "LD_PRELOAD=" "" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") if(PRELOAD_ENV) @@ -20,65 +18,52 @@ else() set(PRELOAD_ARGS) endif() -set(tracing-env) - -set(VALIDATION_DEPENDS) foreach(_OUTPUT_FORMAT csv json pftrace otf2) - add_test( - NAME rocprofv3-test-trace-hip-in-libraries-${_OUTPUT_FORMAT}-execute + rocprofiler_add_integration_execute_test( + rocprofv3-test-trace-hip-in-libraries-${_OUTPUT_FORMAT} COMMAND - $ --hip-runtime-trace - --hsa-core-trace --hsa-amd-trace --marker-trace --kernel-trace - --memory-copy-trace --stats --output-format ${_OUTPUT_FORMAT} -d - ${CMAKE_CURRENT_BINARY_DIR}/%argt%-trace -o out ${PRELOAD_ARGS} -- - $) - - set_tests_properties( - rocprofv3-test-trace-hip-in-libraries-${_OUTPUT_FORMAT}-execute - PROPERTIES TIMEOUT 120 LABELS "integration-tests" ENVIRONMENT "${tracing-env}" - FIXTURES_SETUP rocprofv3-test-trace-hip-in-libraries) - - list(APPEND VALIDATION_DEPENDS - rocprofv3-test-trace-hip-in-libraries-${_OUTPUT_FORMAT}-execute) + $ --hip-runtime-trace --hsa-core-trace + --hsa-amd-trace --marker-trace --kernel-trace --memory-copy-trace --stats + --output-format ${_OUTPUT_FORMAT} -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-trace + -o out ${PRELOAD_ARGS} -- $ + DEPENDS hip-in-libraries + TIMEOUT 120 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-trace-hip-in-libraries) endforeach() -add_test( - NAME rocprofv3-test-trace-hip-in-libraries-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --hsa-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_hsa_api_trace.csv - --hip-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_hip_api_trace.csv - --kernel-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_kernel_trace.csv - --memory-copy-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_memory_copy_trace.csv - --marker-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_marker_api_trace.csv - --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_agent_info.csv - --kernel-stats - ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_kernel_stats.csv - --hip-stats - ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_hip_api_stats.csv - --hsa-stats - ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_hsa_api_stats.csv - --memory-copy-stats - ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_memory_copy_stats.csv - --json-input ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_results.pftrace - --otf2-input ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_results.otf2) - -set_tests_properties( - rocprofv3-test-trace-hip-in-libraries-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - "${VALIDATION_DEPENDS}" - FAIL_REGULAR_EXPRESSION - "AssertionError" - FIXTURES_REQUIRED - rocprofv3-test-trace-hip-in-libraries) +rocprofiler_add_integration_validate_test( + rocprofv3-test-trace-hip-in-libraries + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --hsa-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_hsa_api_trace.csv + --hip-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_hip_api_trace.csv + --kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_kernel_trace.csv + --memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_memory_copy_trace.csv + --marker-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_marker_api_trace.csv + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_agent_info.csv + --kernel-stats + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_kernel_stats.csv + --hip-stats + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_hip_api_stats.csv + --hsa-stats + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_hsa_api_stats.csv + --memory-copy-stats + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_memory_copy_stats.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_results.pftrace + --otf2-input + ${CMAKE_CURRENT_BINARY_DIR}/hip-in-libraries-trace/out_results.otf2 + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-trace-hip-in-libraries) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/tracing-hip-in-libraries/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/tracing-hip-in-libraries/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/tracing-hip-in-libraries/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/tracing-hip-in-libraries/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/tracing-plus-counter-collection/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/tracing-plus-counter-collection/CMakeLists.txt index 27afed060d..110cd61d88 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/tracing-plus-counter-collection/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/tracing-plus-counter-collection/CMakeLists.txt @@ -10,51 +10,42 @@ project( find_package(rocprofiler-sdk REQUIRED) -# copy to binary directory -rocprofiler_configure_pytest_files(COPY validate.py conftest.py input.txt - CONFIG pytest.ini) +string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV + "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") # pmc -add_test( - NAME rocprofv3-test-tracing-plus-counter-collection-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-tracing-plus-counter-collection COMMAND $ --hsa-trace --kernel-trace -i ${CMAKE_CURRENT_BINARY_DIR}/input.txt -d ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace -o pmc --output-format - JSON PFTRACE CSV -- $) - -string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") - -set(cc-tracing-env "${PRELOAD_ENV}") - -set_tests_properties( - rocprofv3-test-tracing-plus-counter-collection-execute - PROPERTIES TIMEOUT 90 LABELS "integration-tests;application-replay" ENVIRONMENT - "${cc-tracing-env}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + JSON PFTRACE CSV -- $ + DEPENDS simple-transpose + TIMEOUT 90 + LABELS "integration-tests;application-replay" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-tracing-plus-counter-collection) foreach(_DIR "pmc_1" "pmc_2" "pmc_3" "pmc_4") - add_test( - NAME rocprofv3-test-tracing-plus-counter-collection-validate-${_DIR} - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - "${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace/${_DIR}/pmc_results.json" - --pftrace-input - "${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace/${_DIR}/pmc_results.pftrace" - --hsa-input - "${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace/${_DIR}/pmc_hsa_api_trace.csv" - --agent-input - "${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace/${_DIR}/pmc_agent_info.csv" - --counter-input - "${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace/${_DIR}/pmc_counter_collection.csv" - ) - - set_tests_properties( - rocprofv3-test-tracing-plus-counter-collection-validate-${_DIR} - PROPERTIES TIMEOUT 45 LABELS "integration-tests;application-replay" DEPENDS - "rocprofv3-test-tracing-plus-counter-collection-execute" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + rocprofiler_add_integration_validate_test( + rocprofv3-test-tracing-plus-counter-collection-${_DIR} + TEST_PATHS validate.py + COPY conftest.py input.txt + CONFIG pytest.ini + ARGS --json-input + ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace/${_DIR}/pmc_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace/${_DIR}/pmc_results.pftrace + --hsa-input + ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace/${_DIR}/pmc_hsa_api_trace.csv + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace/${_DIR}/pmc_agent_info.csv + --counter-input + ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace/${_DIR}/pmc_counter_collection.csv + TIMEOUT 45 + LABELS "integration-tests;application-replay" + FIXTURES_REQUIRED rocprofv3-test-tracing-plus-counter-collection) endforeach() set(cmdl_single "GRBM_COUNT") @@ -62,38 +53,37 @@ set(cmdl_multiple "SQ_WAVES" "GRBM_GUI_ACTIVE" "SQ_CYCLES:device=16384" "SQ_BUSY_CYCLES:device=65536") foreach(_GROUP "single" "multiple") - - set(_TEST_NAME_PREFIX rocprofv3-test-tracing-plus-counter-collection-cmdl-${_GROUP}) - - add_test( - NAME ${_TEST_NAME_PREFIX}-execute + rocprofiler_add_integration_execute_test( + rocprofv3-test-tracing-plus-counter-collection-cmdl-${_GROUP} COMMAND $ --sys-trace --kernel-rename --pmc ${cmdl_${_GROUP}} -d ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace - -o cmdl/${_GROUP} --output-format JSON PFTRACE CSV -- - $ 2 50 5) - - set_tests_properties( - ${_TEST_NAME_PREFIX}-execute - PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT "${cc-tracing-env}" - FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + -o cmdl/${_GROUP} --output-format JSON PFTRACE CSV -- $ + 2 50 5 + DEPENDS transpose + TIMEOUT 45 + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-tracing-plus-counter-collection-cmdl-${_GROUP}) set(_TEST_OUTPUT_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/out_counter_collection_trace/cmdl/${_GROUP}) - add_test( - NAME ${_TEST_NAME_PREFIX}-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input - "${_TEST_OUTPUT_PREFIX}_results.json" --pftrace-input - "${_TEST_OUTPUT_PREFIX}_results.pftrace" --hsa-input - "${_TEST_OUTPUT_PREFIX}_hsa_api_trace.csv" --agent-input - "${_TEST_OUTPUT_PREFIX}_agent_info.csv" --counter-input - "${_TEST_OUTPUT_PREFIX}_counter_collection.csv") - - set_tests_properties( - ${_TEST_NAME_PREFIX}-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "${_TEST_NAME_PREFIX}-execute" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + rocprofiler_add_integration_validate_test( + rocprofv3-test-tracing-plus-counter-collection-cmdl-${_GROUP} + TEST_PATHS validate.py + COPY conftest.py input.txt + CONFIG pytest.ini + ARGS --json-input + ${_TEST_OUTPUT_PREFIX}_results.json + --pftrace-input + ${_TEST_OUTPUT_PREFIX}_results.pftrace + --hsa-input + ${_TEST_OUTPUT_PREFIX}_hsa_api_trace.csv + --agent-input + ${_TEST_OUTPUT_PREFIX}_agent_info.csv + --counter-input + ${_TEST_OUTPUT_PREFIX}_counter_collection.csv + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-tracing-plus-counter-collection-cmdl-${_GROUP}) endforeach() diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/tracing-plus-counter-collection/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/tracing-plus-counter-collection/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/tracing-plus-counter-collection/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/tracing-plus-counter-collection/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/tracing/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/tracing/CMakeLists.txt index 13a9924966..1a52de6fc8 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/tracing/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/tracing/CMakeLists.txt @@ -19,195 +19,169 @@ endif() string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}") -set(tracing-env "${PRELOAD_ENV}") - -rocprofiler_configure_pytest_files( - CONFIG pytest.ini COPY validate.py conftest.py input_systrace.json input_trace.json) - -add_test( - NAME rocprofv3-test-trace-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-trace COMMAND $ -M --hsa-trace --kernel-trace --memory-copy-trace --marker-trace -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-trace -o cmdl-input/out --output-format pftrace csv json rocpd --log-level ${LOG_LEVEL} -- - $) - -set_tests_properties( - rocprofv3-test-trace-execute - PROPERTIES - TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${tracing-env}" - FAIL_REGULAR_EXPRESSION + $ + DEPENDS simple-transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-trace + FAIL_REGULAR_EXPRESSION "HSA_API|HIP_API|HIP_COMPILER_API|MARKER_CORE_API|MARKER_CONTROL_API|MARKER_NAME_API|KERNEL_DISPATCH|CODE_OBJECT" ) -add_test( - NAME rocprofv3-test-trace-input-json-execute +rocprofiler_add_integration_validate_test( + rocprofv3-test-trace + TEST_PATHS validate.py + COPY conftest.py input_systrace.json input_trace.json + CONFIG pytest.ini + ARGS --hsa-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_hsa_api_trace.csv + --kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_kernel_trace.csv + --memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_memory_copy_trace.csv + --marker-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_marker_api_trace.csv + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_agent_info.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_results.pftrace + --rocpd-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_results.db + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-trace) + +rocprofiler_add_integration_execute_test( + rocprofv3-test-trace-input-json COMMAND $ -i ${CMAKE_CURRENT_BINARY_DIR}/input_trace.json -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-trace --log-level ${LOG_LEVEL} -- - $) - -set_tests_properties( - rocprofv3-test-trace-input-json-execute - PROPERTIES - TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${tracing-env}" - FAIL_REGULAR_EXPRESSION + $ + DEPENDS simple-transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-trace-input-json + FAIL_REGULAR_EXPRESSION "HSA_API|HIP_API|HIP_COMPILER_API|MARKER_CORE_API|MARKER_CONTROL_API|MARKER_NAME_API|KERNEL_DISPATCH|CODE_OBJECT" ) -add_test( - NAME rocprofv3-test-trace-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --hsa-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_hsa_api_trace.csv - --kernel-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_kernel_trace.csv - --memory-copy-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_memory_copy_trace.csv - --marker-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_marker_api_trace.csv - --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_agent_info.csv - --json-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_results.pftrace - --rocpd-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/cmdl-input/out_results.db) - -add_test( - NAME rocprofv3-test-trace-input-json-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --hsa-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_hsa_api_trace.csv - --kernel-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_kernel_trace.csv - --memory-copy-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_memory_copy_trace.csv - --marker-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_marker_api_trace.csv - --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_agent_info.csv - --json-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_results.pftrace - --rocpd-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_results.db) - -set_tests_properties( - rocprofv3-test-trace-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-trace-execute" FAIL_REGULAR_EXPRESSION "AssertionError") - -set_tests_properties( - rocprofv3-test-trace-input-json-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-trace-input-json-execute" FAIL_REGULAR_EXPRESSION - "AssertionError") +rocprofiler_add_integration_validate_test( + rocprofv3-test-trace-input-json + TEST_PATHS validate.py + COPY conftest.py input_systrace.json input_trace.json + CONFIG pytest.ini + ARGS --hsa-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_hsa_api_trace.csv + --kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_kernel_trace.csv + --memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_memory_copy_trace.csv + --marker-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_marker_api_trace.csv + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_agent_info.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_results.pftrace + --rocpd-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-trace/json-input/out_results.db + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-trace-input-json) # sys-trace test: tests --sys-trace command with mangled kernel names and validates # generated files -add_test( - NAME rocprofv3-test-systrace-execute +rocprofiler_add_integration_execute_test( + rocprofv3-test-systrace COMMAND $ --sys-trace -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-systrace -o cmdl-input/out --output-format - pftrace csv json rocpd -- $) - -set_tests_properties( - rocprofv3-test-systrace-execute - PROPERTIES - TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${tracing-env}" - FAIL_REGULAR_EXPRESSION + pftrace csv json rocpd -- $ + DEPENDS simple-transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-systrace + FAIL_REGULAR_EXPRESSION "HSA_API|HIP_API|HIP_COMPILER_API|MARKER_CORE_API|MARKER_CONTROL_API|MARKER_NAME_API|KERNEL_DISPATCH|CODE_OBJECT" ) -add_test( - NAME rocprofv3-test-systrace-input-json-execute +rocprofiler_add_integration_validate_test( + rocprofv3-test-systrace + TEST_PATHS validate.py + COPY conftest.py input_systrace.json input_trace.json + CONFIG pytest.ini + DISCOVERY_ARGS -k "not test_hsa_api_trace" + ARGS --hsa-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_hsa_api_trace.csv + --kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_kernel_trace.csv + --memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_memory_copy_trace.csv + --marker-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_marker_api_trace.csv + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_agent_info.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_results.pftrace + --rocpd-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_results.db + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-systrace) + +rocprofiler_add_integration_execute_test( + rocprofv3-test-systrace-input-json COMMAND $ -i ${CMAKE_CURRENT_BINARY_DIR}/input_systrace.json -d - ${CMAKE_CURRENT_BINARY_DIR}/%argt%-systrace -- $) - -set_tests_properties( - rocprofv3-test-systrace-input-json-execute - PROPERTIES - TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${tracing-env}" - FAIL_REGULAR_EXPRESSION + ${CMAKE_CURRENT_BINARY_DIR}/%argt%-systrace -- $ + DEPENDS simple-transpose + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + FIXTURES_SETUP rocprofv3-test-systrace-input-json + FAIL_REGULAR_EXPRESSION "HSA_API|HIP_API|HIP_COMPILER_API|MARKER_CORE_API|MARKER_CONTROL_API|MARKER_NAME_API|KERNEL_DISPATCH|CODE_OBJECT" ) -add_test( - NAME rocprofv3-test-systrace-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - "not test_hsa_api_trace" --hsa-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_hsa_api_trace.csv - --kernel-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_kernel_trace.csv - --memory-copy-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_memory_copy_trace.csv - --marker-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_marker_api_trace.csv - --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_agent_info.csv - --json-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_results.pftrace - --rocpd-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/cmdl-input/out_results.db) -add_test( - NAME rocprofv3-test-systrace-input-json-validate - COMMAND - ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py -k - "not test_hsa_api_trace" --hsa-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_hsa_api_trace.csv - --kernel-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_kernel_trace.csv - --memory-copy-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_memory_copy_trace.csv - --marker-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_marker_api_trace.csv - --agent-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_agent_info.csv - --json-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_results.json - --pftrace-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_results.pftrace - --rocpd-input - ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_results.db) - -set_tests_properties( - rocprofv3-test-systrace-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-systrace-execute" FAIL_REGULAR_EXPRESSION "AssertionError") - -set_tests_properties( - rocprofv3-test-systrace-input-json-validate - PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS - "rocprofv3-test-systrace-input-json-execute" FAIL_REGULAR_EXPRESSION - "AssertionError") +rocprofiler_add_integration_validate_test( + rocprofv3-test-systrace-input-json + TEST_PATHS validate.py + COPY conftest.py input_systrace.json input_trace.json + CONFIG pytest.ini + DISCOVERY_ARGS -k "not test_hsa_api_trace" + ARGS --hsa-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_hsa_api_trace.csv + --kernel-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_kernel_trace.csv + --memory-copy-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_memory_copy_trace.csv + --marker-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_marker_api_trace.csv + --agent-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_agent_info.csv + --json-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_results.json + --pftrace-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_results.pftrace + --rocpd-input + ${CMAKE_CURRENT_BINARY_DIR}/simple-transpose-systrace/json-input/out_results.db + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED rocprofv3-test-systrace-input-json) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/tracing/pytest.ini b/projects/rocprofiler-sdk/tests/rocprofv3/tracing/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/tracing/pytest.ini +++ b/projects/rocprofiler-sdk/tests/rocprofv3/tracing/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/scratch-memory-tracing/CMakeLists.txt b/projects/rocprofiler-sdk/tests/scratch-memory-tracing/CMakeLists.txt index fc85a59a65..739f5fae8b 100644 --- a/projects/rocprofiler-sdk/tests/scratch-memory-tracing/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/scratch-memory-tracing/CMakeLists.txt @@ -10,54 +10,35 @@ project( find_package(rocprofiler-sdk REQUIRED) -if(ROCPROFILER_MEMCHECK_PRELOAD_ENV) +if(ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE) set(PRELOAD_ENV - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}:$") + "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}:$" + ) else() - set(PRELOAD_ENV "LD_PRELOAD=$") + set(PRELOAD_ENV "$") endif() -add_test(NAME test-scratch-memory-tracing-execute COMMAND $) - -set(scratch-memory-tracing-env - "${PRELOAD_ENV}" - "ROCPROFILER_TOOL_OUTPUT_FILE=scratch-memory-tracing-test.json" - "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" - ) - -set_tests_properties( - test-scratch-memory-tracing-execute - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - ENVIRONMENT - "${scratch-memory-tracing-env}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}" - FIXTURES_SETUP - scratch-memory-trace) +rocprofiler_add_integration_execute_test( + test-scratch-memory-tracing + COMMAND $ + DEPENDS scratch-memory + TIMEOUT 45 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT + "ROCPROFILER_TOOL_OUTPUT_FILE=scratch-memory-tracing-test.json" + "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" + FIXTURES_SETUP test-scratch-memory-tracing + UNSTABLE) # copy to binary directory -rocprofiler_configure_pytest_files(COPY validate.py conftest.py CONFIG pytest.ini) - -add_test(NAME test-scratch-memory-tracing-validate - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --input - ${CMAKE_CURRENT_BINARY_DIR}/scratch-memory-tracing-test.json) - -set_tests_properties( - test-scratch-memory-tracing-validate - PROPERTIES TIMEOUT - 45 - LABELS - "integration-tests" - DEPENDS - test-scratch-memory-tracing-execute - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - "${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}" - FIXTURES_REQUIRED - scratch-memory-trace) +rocprofiler_add_integration_validate_test( + test-scratch-memory-tracing + TEST_PATHS validate.py + COPY conftest.py + CONFIG pytest.ini + ARGS --input ${CMAKE_CURRENT_BINARY_DIR}/scratch-memory-tracing-test.json + TIMEOUT 45 + LABELS "integration-tests" + FIXTURES_REQUIRED test-scratch-memory-tracing + UNSTABLE) diff --git a/projects/rocprofiler-sdk/tests/scratch-memory-tracing/pytest.ini b/projects/rocprofiler-sdk/tests/scratch-memory-tracing/pytest.ini index 5e1e1c14a0..8bf72b0989 100644 --- a/projects/rocprofiler-sdk/tests/scratch-memory-tracing/pytest.ini +++ b/projects/rocprofiler-sdk/tests/scratch-memory-tracing/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = --durations=20 -rA -s -vv +addopts = --durations=20 -rA -s testpaths = validate.py pythonpath = @ROCPROFILER_SDK_TESTS_BINARY_DIR@/pytest-packages diff --git a/projects/rocprofiler-sdk/tests/thread-trace/CMakeLists.txt b/projects/rocprofiler-sdk/tests/thread-trace/CMakeLists.txt index 8be522031a..f7165449f9 100644 --- a/projects/rocprofiler-sdk/tests/thread-trace/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/thread-trace/CMakeLists.txt @@ -52,22 +52,13 @@ target_link_libraries( PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::tests-build-flags rocprofiler-sdk::tests-common-library) -add_test(NAME thread-trace-api-single-test - COMMAND $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( thread-trace-api-single-test - PROPERTIES TIMEOUT - 10 - LABELS - "integration-tests" - ENVIRONMENT - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - ${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}) - + COMMAND $ + DEPENDS thread-trace-api-single-test + TIMEOUT 10 + LABELS "integration-tests" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}") # Multi dispatch test add_executable(thread-trace-api-multi-test) target_sources( @@ -78,21 +69,13 @@ target_link_libraries( PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::tests-build-flags rocprofiler-sdk::tests-common-library) -add_test(NAME thread-trace-api-multi-test - COMMAND $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( thread-trace-api-multi-test - PROPERTIES TIMEOUT - 10 - LABELS - "integration-tests" - ENVIRONMENT - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - ${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}) + COMMAND $ + DEPENDS thread-trace-api-multi-test + TIMEOUT 10 + LABELS "integration-tests" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}") # Agent profiling test add_executable(thread-trace-api-agent-test) @@ -103,52 +86,31 @@ target_link_libraries( PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::tests-build-flags rocprofiler-sdk::tests-common-library) -add_test(NAME thread-trace-api-agent-test - COMMAND $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( thread-trace-api-agent-test - PROPERTIES TIMEOUT - 10 - LABELS - "integration-tests" - ENVIRONMENT - "${ROCPROFILER_MEMCHECK_PRELOAD_ENV}" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - ${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}) + COMMAND $ + DEPENDS thread-trace-api-agent-test + TIMEOUT 10 + LABELS "integration-tests" + PRELOAD "${ROCPROFILER_MEMCHECK_PRELOAD_ENV_VALUE}") # Test large buffer sizes. 5120 == 5GB -add_test(NAME thread-trace-api-large-buffer-test - COMMAND $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( thread-trace-api-large-buffer-test - PROPERTIES TIMEOUT - 10 - LABELS - "integration-tests" - ENVIRONMENT - "${PRELOAD_ENV};ATT_BUFFER_SIZE_MB=5120" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - ${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}) + COMMAND $ + DEPENDS thread-trace-api-agent-test + TIMEOUT 10 + LABELS "integration-tests" + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "ATT_BUFFER_SIZE_MB=5120" + DISABLED ${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}) # Test occupancy mode -add_test(NAME thread-trace-api-extra-args - COMMAND $) - -set_tests_properties( +rocprofiler_add_integration_execute_test( thread-trace-api-extra-args - PROPERTIES TIMEOUT - 10 - LABELS - "integration-tests" - ENVIRONMENT - "${PRELOAD_ENV};ATT_NODETAIL=1" - FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}" - DISABLED - ${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}) + COMMAND $ + DEPENDS thread-trace-api-agent-test + TIMEOUT 10 + PRELOAD "${PRELOAD_ENV}" + ENVIRONMENT "ATT_NODETAIL=1" + DISABLED ${ROCPROFILER_DISABLE_UNSTABLE_CTESTS}) diff --git a/projects/rocprofiler-sdk/tests/tools/json-tool.cpp b/projects/rocprofiler-sdk/tests/tools/json-tool.cpp index ed5cbf9452..95ea4dba18 100644 --- a/projects/rocprofiler-sdk/tests/tools/json-tool.cpp +++ b/projects/rocprofiler-sdk/tests/tools/json-tool.cpp @@ -2349,13 +2349,22 @@ write_json(call_stack_t* _call_stack) void write_perfetto() { + bool disable_perfetto = []() { + // set ROCPROFILER_TOOL_DISABLE_PERFETTO=1 to disable for CTest + // set ROCPROFILER_TOOL_ENABLE_PERFETTO=1 to override interactively + return (getenv("ROCPROFILER_TOOL_DISABLE_PERFETTO") != nullptr && + getenv("ROCPROFILER_TOOL_ENABLE_PERFETTO") == nullptr); + }(); + + if(disable_perfetto) return; + auto args = ::perfetto::TracingInitArgs{}; auto track_event_cfg = ::perfetto::protos::gen::TrackEventConfig{}; auto cfg = ::perfetto::TraceConfig{}; // Enabled by default, set this env to any value to disable bool enable_debug_annotations = []() { - return getenv("ROCPROFILER_DISABLE_PERFETTO_ANNOTATIONS") == nullptr; + return getenv("ROCPROFILER_TOOL_DISABLE_PERFETTO_ANNOTATIONS") == nullptr; }(); // environment settings diff --git a/projects/rocprofiler-sdk/tests/unit-tests/CMakeLists.txt b/projects/rocprofiler-sdk/tests/unit-tests/CMakeLists.txt new file mode 100644 index 0000000000..f3f67420b1 --- /dev/null +++ b/projects/rocprofiler-sdk/tests/unit-tests/CMakeLists.txt @@ -0,0 +1,15 @@ +# +# +# + +if(rocprofiler-sdk_BUILD_TREE OR rocprofiler-sdk-tests_BUILD_TREE) + # unit tests are directly added in rocprofiler-sdk build tree. + return() +endif() + +# this package is from the installation +find_package(rocprofiler-sdk-tests) + +if(rocprofiler-sdk-tests_FOUND) + rocprofiler_sdk_tests_add_tests() +endif()