CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
98 lines
4.3 KiB
CMake
98 lines
4.3 KiB
CMake
# Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
# Relocatable hipFile unit-test discovery, evaluated by ctest at run time.
|
|
#
|
|
# This file is include()'d from share/hipfile/test/CTestTestfile.cmake. ctest
|
|
# evaluates an include()'d file in full scripting mode, so execute_process()/
|
|
# foreach()/if() all run here (unlike the top-level CTestTestfile, which only
|
|
# honors add_test/subdirs/include/set_tests_properties).
|
|
#
|
|
# All paths are resolved RELATIVE to this script's own location, so the tree is
|
|
# fully relocatable. Generated from hipfile_discover.cmake.in by AISInstallTests.
|
|
|
|
# Locate ourselves: <test_dir>/script/hipfile_discover.cmake -> <test_dir>.
|
|
file(REAL_PATH "${CMAKE_CURRENT_LIST_FILE}" _hipfile_self)
|
|
get_filename_component(_hipfile_script_dir "${_hipfile_self}" DIRECTORY)
|
|
file(REAL_PATH "${_hipfile_script_dir}/.." _hipfile_test_dir)
|
|
|
|
# Runtime library path, relative to the test dir:
|
|
# <test_dir> = <prefix>/share/hipfile/test -> <prefix>/lib is three up.
|
|
# The bundled sysdeps (e.g. librocm_sysdeps_mount.so.1) live under
|
|
# lib/rocm_sysdeps/lib in TheRock-style installs; harmless if absent elsewhere.
|
|
set(_hipfile_libdir "${_hipfile_test_dir}/../../../lib")
|
|
set(_hipfile_ld "${_hipfile_libdir}:${_hipfile_libdir}/rocm_sysdeps/lib")
|
|
|
|
# Enumerate one binary's GoogleTest cases and register each as an isolated test.
|
|
macro(_hipfile_discover_binary _bin_name _label_suffix)
|
|
set(_bin "${_hipfile_test_dir}/${_bin_name}")
|
|
if(NOT EXISTS "${_bin}")
|
|
message(FATAL_ERROR "hipFile: test binary not found: ${_bin}")
|
|
endif()
|
|
|
|
# The discovery launch needs the libraries on the path too. ctest evaluates
|
|
# this script with CMAKE_COMMAND unset, so `cmake -E env` is unavailable;
|
|
# set(ENV{...}) is the only lever. Save and restore the prior value so this
|
|
# script does not leave the ctest process environment mutated (each test's
|
|
# own ENVIRONMENT property, set below, governs the actual test runs).
|
|
#
|
|
# Track whether LD_LIBRARY_PATH was originally set: restoring an unset
|
|
# variable to "" leaves an empty path element, which the loader treats as the
|
|
# current directory. Unset it instead of blanking it.
|
|
if(DEFINED ENV{LD_LIBRARY_PATH})
|
|
set(_ld_was_set TRUE)
|
|
set(_saved_ld_library_path "$ENV{LD_LIBRARY_PATH}")
|
|
else()
|
|
set(_ld_was_set FALSE)
|
|
endif()
|
|
set(ENV{LD_LIBRARY_PATH} "${_hipfile_ld}")
|
|
execute_process(
|
|
COMMAND "${_bin}" --gtest_list_tests
|
|
WORKING_DIRECTORY "${_hipfile_test_dir}"
|
|
OUTPUT_VARIABLE _listing
|
|
RESULT_VARIABLE _rc
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
)
|
|
if(_ld_was_set)
|
|
set(ENV{LD_LIBRARY_PATH} "${_saved_ld_library_path}")
|
|
else()
|
|
unset(ENV{LD_LIBRARY_PATH})
|
|
endif()
|
|
if(NOT _rc EQUAL 0)
|
|
message(FATAL_ERROR "hipFile: failed to list tests in ${_bin} (exit ${_rc})")
|
|
endif()
|
|
|
|
# --gtest_list_tests prints a suite header per line ("Suite.") followed by
|
|
# its cases indented two spaces, each optionally trailed by a
|
|
# " # GetParam() = ..." annotation we discard. The full filter name is the
|
|
# suite header concatenated with the case name.
|
|
#
|
|
# Split the output into a list of lines. A literal ';' in the output (e.g.
|
|
# inside a GetParam() value) would otherwise be treated as a CMake list
|
|
# separator and corrupt the split, so escape ';' -> '\;' BEFORE turning
|
|
# newlines into the ';' separator (the same ordering CMake's own
|
|
# GoogleTestAddTests.cmake uses).
|
|
string(REPLACE ";" "\\;" _listing "${_listing}")
|
|
string(REPLACE "\n" ";" _lines "${_listing}")
|
|
set(_suite "")
|
|
foreach(_line IN LISTS _lines)
|
|
string(REGEX REPLACE " +#.*$" "" _line "${_line}")
|
|
if(_line MATCHES "^[^ ].*\\.$")
|
|
string(STRIP "${_line}" _suite)
|
|
elseif(_line MATCHES "^ +[^ ]")
|
|
string(STRIP "${_line}" _case)
|
|
set(_test "${_suite}${_case}")
|
|
add_test("${_test}" "${_bin}" "--gtest_filter=${_test}")
|
|
set_tests_properties("${_test}" PROPERTIES
|
|
TIMEOUT 300
|
|
LABELS "unit;${_label_suffix}"
|
|
ENVIRONMENT "LD_LIBRARY_PATH=${_hipfile_ld}"
|
|
)
|
|
endif()
|
|
endforeach()
|
|
endmacro()
|
|
|
|
# Per-binary discovery calls, baked in by AISInstallTests at configure time.
|
|
@_discover_blocks@
|