Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

434 rivejä
14 KiB
CMake

# MIT License
#
# Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
2025-07-29 02:44:40 -04:00
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
2025-07-29 02:44:40 -04:00
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2025-07-29 02:44:40 -04:00
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
2023-06-14 11:55:22 -05:00
# -------------------------------------------------------------------------------------- #
#
# Contains tests for executables
#
# -------------------------------------------------------------------------------------- #
2022-03-07 20:40:48 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-instrument-help
TARGET rocprofiler-systems-instrument
2022-03-07 20:40:48 -06:00
ARGS --help
LABELS rocprofiler-systems-instrument
2022-04-05 00:24:34 -05:00
TIMEOUT 45
2022-04-25 17:00:52 -05:00
PASS_REGEX
".*\\\[rocprof-sys-instrument\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[MODE OPTIONS\\\].*\\\[LIBRARY OPTIONS\\\].*\\\[SYMBOL SELECTION OPTIONS\\\].*\\\[RUNTIME OPTIONS\\\].*\\\[GRANULARITY OPTIONS\\\].*\\\[DYNINST OPTIONS\\\].*"
2025-06-22 10:44:33 -04:00
)
2022-03-07 20:40:48 -06:00
2023-03-07 06:04:19 -06:00
# on RedHat, /usr/bin/ls is a script for `coreutils --coreutils-prog=ls`
if(EXISTS /usr/bin/coreutils)
set(LS_NAME "coreutils")
set(LS_ARGS "--coreutils-prog=ls")
else()
set(LS_NAME ls)
set(LS_ARGS)
endif()
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-instrument-simulate-ls
TARGET rocprofiler-systems-instrument
2022-04-05 00:24:34 -05:00
ARGS --simulate
--print-format
json
txt
xml
-v
2022-07-21 01:15:41 -05:00
2
--all-functions
2022-04-05 00:24:34 -05:00
--
2023-03-07 06:04:19 -06:00
${LS_NAME}
${LS_ARGS}
LABELS "simulate"
2025-06-22 10:44:33 -04:00
TIMEOUT 240
)
2022-03-07 20:40:48 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-instrument-simulate-ls-check
DEPENDS rocprofiler-systems-instrument-simulate-ls
COMMAND
ls
rocprof-sys-tests-output/rocprofiler-systems-instrument-simulate-ls/instrumentation
2022-04-05 00:24:34 -05:00
TIMEOUT 60
2022-04-25 17:00:52 -05:00
PASS_REGEX
2022-08-31 01:24:31 -05:00
".*available.json.*available.txt.*available.xml.*excluded.json.*excluded.txt.*excluded.xml.*instrumented.json.*instrumented.txt.*instrumented.xml.*overlapping.json.*overlapping.txt.*overlapping.xml.*"
2025-06-22 10:44:33 -04:00
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX"
)
2022-03-07 20:40:48 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-instrument-simulate-lib
TARGET rocprofiler-systems-instrument
ARGS --print-available functions -v 2 --
$<TARGET_FILE:rocprofiler-systems-user-library>
2022-07-21 01:15:41 -05:00
LABELS "simulate"
TIMEOUT 120
PASS_REGEX
"\\\[rocprof-sys\\\]\\\[exe\\\] Runtime instrumentation is not possible!(.*)\n(.*)\\\[rocprof-sys\\\]\\\[exe\\\] Switching to binary rewrite mode and assuming '--simulate --all-functions'"
2025-06-22 10:44:33 -04:00
)
2022-07-21 01:15:41 -05:00
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp)
2023-03-07 06:04:19 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-instrument-simulate-lib-basename
TARGET rocprofiler-systems-instrument
2023-03-07 06:04:19 -06:00
ARGS --print-available
functions
-v
2
-o
${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/rocprof-sys-instrument-simulate-lib-basename/${CMAKE_SHARED_LIBRARY_PREFIX}$<TARGET_FILE_BASE_NAME:rocprofiler-systems-user-library>${CMAKE_SHARED_LIBRARY_SUFFIX}
2023-03-07 06:04:19 -06:00
--
${CMAKE_SHARED_LIBRARY_PREFIX}$<TARGET_FILE_BASE_NAME:rocprofiler-systems-user-library>${CMAKE_SHARED_LIBRARY_SUFFIX}
2023-03-07 06:04:19 -06:00
LABELS "simulate"
TIMEOUT 120
2025-06-22 10:44:33 -04:00
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp
)
2023-03-07 06:04:19 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-instrument-write-log
TARGET rocprofiler-systems-instrument
2023-03-07 06:04:19 -06:00
ARGS --print-instrumented
functions
-v
1
--log-file
user.log
--
${LS_NAME}
${LS_ARGS}
2022-09-21 13:58:14 -05:00
LABELS "log"
TIMEOUT 120
2025-06-22 10:44:33 -04:00
PASS_REGEX "Opening .*/instrumentation/user.log"
)
2022-09-21 13:58:14 -05:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-instrument-write-log-check
DEPENDS rocprofiler-systems-instrument-write-log
COMMAND
ls
rocprof-sys-tests-output/rocprofiler-systems-instrument-write-log/instrumentation/user.log
2022-09-21 13:58:14 -05:00
LABELS "log"
TIMEOUT 60
PASS_REGEX "user.log"
2025-06-22 10:44:33 -04:00
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX"
)
2022-09-21 13:58:14 -05:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-help
TARGET rocprofiler-systems-avail
2022-03-07 20:40:48 -06:00
ARGS --help
LABELS "rocprofiler-systems-avail"
2022-04-05 00:24:34 -05:00
TIMEOUT 45
2022-04-25 17:00:52 -05:00
PASS_REGEX
".*\\\[rocprof-sys-avail\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[INFO OPTIONS\\\].*\\\[FILTER OPTIONS\\\].*\\\[COLUMN OPTIONS\\\].*\\\[DISPLAY OPTIONS\\\].*\\\[OUTPUT OPTIONS\\\].*"
2025-06-22 10:44:33 -04:00
)
2022-03-07 20:40:48 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-all
TARGET rocprofiler-systems-avail
ARGS --all
LABELS "rocprofiler-systems-avail"
2025-06-22 10:44:33 -04:00
TIMEOUT 45
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-all-expand-keys
TARGET rocprofiler-systems-avail
2022-11-13 10:42:14 -06:00
ARGS --all --expand-keys
LABELS "rocprofiler-systems-avail"
2022-11-13 10:42:14 -06:00
TIMEOUT 45
2025-06-22 10:44:33 -04:00
FAIL_REGEX "%[a-zA-Z_]%|ROCPROFSYS_ABORT_FAIL_REGEX"
)
2022-11-13 10:42:14 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-all-only-available-alphabetical
TARGET rocprofiler-systems-avail
2022-11-13 10:42:14 -06:00
ARGS --all --available --alphabetical --debug --output
${CMAKE_CURRENT_BINARY_DIR}/rocprof-sys-avail-all-only-available-alphabetical.log
LABELS "rocprofiler-systems-avail"
2022-11-13 10:42:14 -06:00
TIMEOUT 45
PROPERTIES
ATTACHED_FILES
2025-06-22 10:44:33 -04:00
${CMAKE_CURRENT_BINARY_DIR}/rocprof-sys-avail-all-only-available-alphabetical.log
)
2022-11-13 10:42:14 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-all-csv
TARGET rocprofiler-systems-avail
2022-06-06 23:23:40 -05:00
ARGS --all --csv --csv-separator "#"
LABELS "rocprofiler-systems-avail"
2022-06-06 23:23:40 -05:00
TIMEOUT 45
PASS_REGEX
2023-03-30 15:06:29 -05:00
"COMPONENT#AVAILABLE#VALUE_TYPE#STRING_IDS#FILENAME#DESCRIPTION#CATEGORY#.*ENVIRONMENT VARIABLE#VALUE#DATA TYPE#DESCRIPTION#CATEGORIES#.*HARDWARE COUNTER#DEVICE#AVAILABLE#DESCRIPTION#"
2025-06-22 10:44:33 -04:00
)
2022-06-06 23:23:40 -05:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-filter-wall-clock-available
TARGET rocprofiler-systems-avail
2022-03-07 20:40:48 -06:00
ARGS -r wall_clock -C --available
LABELS "rocprofiler-systems-avail"
2022-04-05 00:24:34 -05:00
TIMEOUT 45
2022-04-25 17:00:52 -05:00
PASS_REGEX
2024-01-10 20:00:46 -06:00
"\\\|[-]+\\\|\n\\\|[ ]+COMPONENT[ ]+\\\|\n\\\|[-]+\\\|\n\\\| (wall_clock)[ ]+\\\|\n\\\|[-]+\\\|"
2025-06-22 10:44:33 -04:00
)
2022-03-07 20:40:48 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-category-filter-rocprofiler-systems
TARGET rocprofiler-systems-avail
ARGS --categories settings::rocprofsys --brief
LABELS "rocprofiler-systems-avail"
2022-04-05 00:24:34 -05:00
TIMEOUT 45
PASS_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE|OUTPUT_PREFIX)"
2022-04-25 17:00:52 -05:00
FAIL_REGEX
"ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)|ROCPROFSYS_ABORT_FAIL_REGEX"
2025-06-22 10:44:33 -04:00
)
2022-03-07 20:40:48 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-category-filter-timemory
TARGET rocprofiler-systems-avail
ARGS --categories settings::timemory --brief --advanced
LABELS "rocprofiler-systems-avail"
2022-04-05 00:24:34 -05:00
TIMEOUT 45
2022-04-25 17:00:52 -05:00
PASS_REGEX
"ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)"
2025-06-22 10:44:33 -04:00
FAIL_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE)|ROCPROFSYS_ABORT_FAIL_REGEX"
)
2022-06-06 23:23:40 -05:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-regex-negation
TARGET rocprofiler-systems-avail
2022-06-06 23:23:40 -05:00
ARGS -R
rocprofsys
2022-06-06 23:23:40 -05:00
~timemory
-r
_P
~PERFETTO
2022-07-22 14:17:27 -05:00
~PROCESS_SAMPLING
2023-01-24 18:53:23 -06:00
~KOKKOSP
2025-07-29 02:44:40 -04:00
~PAGE
2022-06-06 23:23:40 -05:00
--csv
--brief
--advanced
LABELS "rocprofiler-systems-avail"
2022-06-06 23:23:40 -05:00
TIMEOUT 45
2022-08-31 01:24:31 -05:00
PASS_REGEX
"ENVIRONMENT VARIABLE,[ \n]+ROCPROFSYS_CI_SKIP_PUSH_POP_CHECK,[ \n]+ROCPROFSYS_THREAD_POOL_SIZE,[ \n]+ROCPROFSYS_USE_PID,[ \n]+"
FAIL_REGEX "ROCPROFSYS_TRACE|ROCPROFSYS_ABORT_FAIL_REGEX"
2025-06-22 10:44:33 -04:00
)
2022-06-28 01:36:04 -05:00
string(
REPLACE
2025-06-22 10:44:33 -04:00
"+"
"\\\+"
_AVAIL_CFG_PATH
"${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-"
)
2022-11-13 10:42:14 -06:00
# use of TWD == Test Working Directory (added by function)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-write-config
TARGET rocprofiler-systems-avail
2022-11-13 10:42:14 -06:00
ARGS -G
%env{TWD}%/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-test.cfg
2022-11-13 10:42:14 -06:00
-F
txt
json
xml
--force
--all
-c
rocprofsys
2022-06-28 01:36:04 -05:00
TIMEOUT 45
LABELS "rocprofiler-systems-avail"
2022-06-28 01:36:04 -05:00
PASS_REGEX
"Outputting JSON configuration file '${_AVAIL_CFG_PATH}test\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}test\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}test\\\.cfg'(.*)"
2025-06-22 10:44:33 -04:00
)
2022-06-28 01:36:04 -05:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-write-config-tweak
TARGET rocprofiler-systems-avail
ARGS -G %env{TWD}%/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-tweak.cfg -F
txt json xml --force
2022-06-28 01:36:04 -05:00
TIMEOUT 45
LABELS "rocprofiler-systems-avail"
ENVIRONMENT "ROCPROFSYS_TRACE=OFF;ROCPROFSYS_PROFILE=ON"
2022-06-28 01:36:04 -05:00
PASS_REGEX
"Outputting JSON configuration file '${_AVAIL_CFG_PATH}tweak\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}tweak\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}tweak\\\.cfg'(.*)"
2025-06-22 10:44:33 -04:00
)
2022-11-13 10:42:14 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-list-keys
TARGET rocprofiler-systems-avail
2022-11-13 10:42:14 -06:00
ARGS --list-keys --expand-keys
TIMEOUT 45
LABELS "rocprofiler-systems-avail"
2025-06-22 10:44:33 -04:00
PASS_REGEX "Output Keys:\n(.*)%argv%(.*)%argv_hash%"
)
2022-11-13 10:42:14 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-list-keys-markdown
TARGET rocprofiler-systems-avail
2022-11-13 10:42:14 -06:00
ARGS --list-keys --expand-keys --markdown
TIMEOUT 45
LABELS "rocprofiler-systems-avail;markdown"
2025-06-22 10:44:33 -04:00
PASS_REGEX "(.*)`%argv%`(.*)`%argv_hash%`"
)
2022-11-13 10:42:14 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-list-categories
TARGET rocprofiler-systems-avail
2022-11-13 10:42:14 -06:00
ARGS --list-categories
TIMEOUT 45
LABELS "rocprofiler-systems-avail"
2025-06-22 10:44:33 -04:00
PASS_REGEX " component::(.*) hw_counters::(.*) settings::"
)
2022-11-13 10:42:14 -06:00
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-core-categories
TARGET rocprofiler-systems-avail
2022-11-13 10:42:14 -06:00
ARGS -c core
TIMEOUT 45
LABELS "rocprofiler-systems-avail"
2022-11-13 10:42:14 -06:00
PASS_REGEX
"ROCPROFSYS_CONFIG_FILE(.*)ROCPROFSYS_ENABLED(.*)ROCPROFSYS_SUPPRESS_CONFIG(.*)ROCPROFSYS_SUPPRESS_PARSING(.*)ROCPROFSYS_VERBOSE"
2025-06-22 10:44:33 -04:00
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-run-help
TARGET rocprofiler-systems-run
ARGS --help
TIMEOUT 45
2025-06-22 10:44:33 -04:00
LABELS "rocprofiler-systems-run"
)
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/rocprof-sys-tests-config")
file(
WRITE "${PROJECT_BINARY_DIR}/rocprof-sys-tests-config/empty.cfg"
"
#
# empty config file
#
2025-06-22 10:44:33 -04:00
"
)
find_program(SLEEP_CMD NAMES sleep)
if(SLEEP_CMD)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-run-args
TARGET rocprofiler-systems-run
ARGS --monochrome
--debug=false
-v
1
-c
%env{TWD}%/rocprof-sys-tests-config/empty.cfg
-o
rocprof-sys-tests-output
rocprofiler-systems-run-args-output/
-TPHD
-S
cputime
realtime
--trace-wait=1.0e-12
--trace-duration=5.0
--wait=1.0
--duration=3.0
--trace-file=perfetto-run-args-trace.proto
--trace-buffer-size=100
--trace-fill-policy=ring_buffer
--profile-format
console
json
text
--process-freq
1000
--process-wait
0.0
--process-duration
10
--cpus
0-4
--gpus
0
-f
1000
--sampling-wait
1.0
--sampling-duration
10
-t
0-3
--sample-cputime
1000
1.0
0-3
--sample-realtime
10
0.5
0-3
-I
all
-E
mutex-locks
rw-locks
spin-locks
-C
perf::INSTRUCTIONS
--inlines
--hsa-interrupt
0
--use-causal=false
--use-kokkosp
--num-threads-hint=4
--sampling-allocator-size=32
--ci
--dl-verbose=3
--perfetto-annotations=off
--kokkosp-kernel-logger
--kokkosp-name-length-max=1024
--kokkosp-prefix="[kokkos]"
--tmpdir
${CMAKE_BINARY_DIR}/rocprof-sys-tests-config/tmpdir
--perfetto-backend
inprocess
--use-pid
false
--time-output
off
--thread-pool-size
0
--timemory-components
wall_clock
cpu_clock
peak_rss
page_rss
--fork
--
${SLEEP_CMD}
5
TIMEOUT 45
LABELS "rocprofiler-systems-run"
)
else()
rocprofiler_systems_message(WARNING "Sleep command not found. Disabling rocprofiler-systems-run-args ctest...")
endif()