Files
TheRock/rocm-systems/projects/rocprof-trace-decoder/test/python_api_install_test.cmake.in
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

79 lines
3.0 KiB
CMake

set(stage_dir "@CMAKE_CURRENT_BINARY_DIR@/python-api-install")
file(REMOVE_RECURSE "${stage_dir}")
execute_process(
COMMAND "@CMAKE_COMMAND@" --install "@CMAKE_BINARY_DIR@" --prefix "${stage_dir}"
--component runtime
RESULT_VARIABLE install_result
OUTPUT_VARIABLE install_stdout
ERROR_VARIABLE install_stderr)
if(NOT install_result EQUAL 0)
message("${install_stdout}")
message("${install_stderr}")
message(FATAL_ERROR "Runtime install failed: ${install_result}")
endif()
set(pythonpath "${stage_dir}/@ROCPROF_TRACE_DECODER_PYTHON_INSTALL_DIR@")
set(libdir "${stage_dir}/@CMAKE_INSTALL_LIBDIR@")
set(libpath
"${libdir}/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-trace-decoder@CMAKE_SHARED_LIBRARY_SUFFIX@")
execute_process(
COMMAND
"@CMAKE_COMMAND@" -E env "PYTHONPATH=${pythonpath}" "ROCM_PATH=${stage_dir}"
"LD_LIBRARY_PATH=${libdir}:@PYTHON_API_LD_LIBRARY_PATH@:$ENV{LD_LIBRARY_PATH}"
"@Python3_EXECUTABLE@" "@CMAKE_CURRENT_SOURCE_DIR@/python_api_test.py" --lib
"${libpath}"
RESULT_VARIABLE import_result
OUTPUT_VARIABLE import_stdout
ERROR_VARIABLE import_stderr)
if(NOT import_result EQUAL 0)
message("${import_stdout}")
message("${import_stderr}")
message(FATAL_ERROR "Installed Python API import failed: ${import_result}")
endif()
execute_process(
COMMAND
"@CMAKE_COMMAND@" -E env "PYTHONPATH=${pythonpath}" "ROCM_PATH=${stage_dir}"
"LD_LIBRARY_PATH=${libdir}:@PYTHON_API_DEP_LIBRARY_PATH@:$ENV{LD_LIBRARY_PATH}"
"@Python3_EXECUTABLE@" "@CMAKE_CURRENT_SOURCE_DIR@/python_api_test.py"
RESULT_VARIABLE prefix_result
OUTPUT_VARIABLE prefix_stdout
ERROR_VARIABLE prefix_stderr)
if(NOT prefix_result EQUAL 0)
message("${prefix_stdout}")
message("${prefix_stderr}")
message(FATAL_ERROR "Installed Python API prefix lookup failed: ${prefix_result}")
endif()
set(fake_site "${stage_dir}/fake-site")
set(fake_core "${fake_site}/_rocm_sdk_core")
file(REMOVE_RECURSE "${fake_site}")
file(MAKE_DIRECTORY "${fake_core}/lib")
file(WRITE "${fake_core}/__init__.py" "")
set(versioned_libpath "${fake_core}/lib/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-trace-decoder")
string(APPEND versioned_libpath
"@CMAKE_SHARED_LIBRARY_SUFFIX@.@VERSION_MAJOR@.@VERSION_MINOR@")
file(COPY_FILE "${libpath}" "${versioned_libpath}")
execute_process(
COMMAND
"@CMAKE_COMMAND@" -E env "PYTHONPATH=${pythonpath}:${fake_site}"
"ROCM_PATH=${stage_dir}/missing" "ROCM_HOME=${stage_dir}/missing"
"ROCPROF_TRACE_DECODER_LIB="
"LD_LIBRARY_PATH=@PYTHON_API_DEP_LIBRARY_PATH@:$ENV{LD_LIBRARY_PATH}" "@Python3_EXECUTABLE@"
"@CMAKE_CURRENT_SOURCE_DIR@/python_api_test.py"
RESULT_VARIABLE therock_result
OUTPUT_VARIABLE therock_stdout
ERROR_VARIABLE therock_stderr)
if(NOT therock_result EQUAL 0)
message("${therock_stdout}")
message("${therock_stderr}")
message(FATAL_ERROR "Installed Python API TheRock lookup failed: ${therock_result}")
endif()