Files
TheRock/rocm-systems/projects/hip-tests/catch/config/CMakeLists.txt
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

86 lines
3.3 KiB
CMake

# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
#
# SPDX-License-Identifier: MIT
find_package(Python3 COMPONENTS Interpreter REQUIRED)
# Check for PyYAML
execute_process(
COMMAND "${Python3_EXECUTABLE}" -c "import yaml"
RESULT_VARIABLE PY_YAML_RESULT
ERROR_QUIET
)
if(NOT PY_YAML_RESULT EQUAL 0)
message(FATAL_ERROR "PyYAML is required in order to read the configuration file. Please install it")
endif()
if(WIN32)
set(CONFIG_OS "windows")
set(CONFIG_ARCH "windows")
else()
set(CONFIG_OS "linux")
if (HIP_PLATFORM MATCHES "amd")
# TODO multiple arch support
foreach(ARCH ${HIP_GPU_ARCH_LIST})
set(CONFIG_ARCH ${ARCH})
endforeach()
else()
set(CONFIG_ARCH "linux")
endif()
endif()
set(HIP_TESTS_CONFIGS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/configs)
set(CONFIG_COMMON_MODULE ${CMAKE_CURRENT_SOURCE_DIR}/common.py)
set(CONFIG_PARSER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/parse_config.py)
set(CONFIG_CHECK_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/check_config.py)
set(SOURCES_CHECK_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/check_sources.py)
set(HIP_TEST_CONFIG_HEADER ${CATCH_INCLUDE_BINARY_DIR}/hip_test_config.hh)
set(HIP_TEST_PARAMETERS_HEADER ${CATCH_INCLUDE_BINARY_DIR}/hip_test_parameters.hh)
file(GLOB HIP_TESTS_GROUP_CONFIGS CONFIGURE_DEPENDS ${HIP_TESTS_CONFIGS_DIR}/*.yaml)
file(GLOB HIP_TESTS_UNIT_CONFIGS CONFIGURE_DEPENDS ${HIP_TESTS_CONFIGS_DIR}/unit/*.yaml)
# When building with Address Sanitizer, pass --asan so the parser skips test
# cases that list 'asan' in their 'disabled' field.
set(CONFIG_ASAN_FLAG)
if(ENABLE_ADDRESS_SANITIZER OR THEROCK_SANITIZER STREQUAL "ASAN" OR THEROCK_SANITIZER STREQUAL "HOST_ASAN")
set(CONFIG_ASAN_FLAG "--asan")
endif()
if(ENABLE_YAML_TAGS)
add_custom_target(check_hip_tests_config ALL
COMMAND "${Python3_EXECUTABLE}" "${CONFIG_CHECK_SCRIPT}" "${HIP_TESTS_CONFIGS_DIR}"
COMMENT "Validating hip-tests YAML configurations"
)
add_custom_target(check_hip_tests_sources ALL
COMMAND "${Python3_EXECUTABLE}" "${SOURCES_CHECK_SCRIPT}" "${HIP_TESTS_CONFIGS_DIR}" "${CMAKE_SOURCE_DIR}"
COMMENT "Checking hip-tests sources for missing YAML configurations"
)
endif()
# Generate both test definitions and parameter headers from YAML
# - hip_test_config.hh: TEST_CASE macros with tags
# - hip_test_parameters.hh: Compile-time constants for level parameters
add_custom_command(
OUTPUT ${HIP_TEST_CONFIG_HEADER} ${HIP_TEST_PARAMETERS_HEADER}
COMMAND "${Python3_EXECUTABLE}" "${CONFIG_PARSER_SCRIPT}"
"${HIP_TESTS_CONFIGS_DIR}"
"${HIP_PLATFORM}"
"${CONFIG_OS}"
"${CONFIG_ARCH}"
"${HIP_TEST_CONFIG_HEADER}"
"${HIP_TEST_PARAMETERS_HEADER}"
${CONFIG_ASAN_FLAG}
DEPENDS ${CONFIG_COMMON_MODULE} ${CONFIG_PARSER_SCRIPT} ${HIP_TESTS_UNIT_CONFIGS} ${HIP_TESTS_GROUP_CONFIGS}
COMMENT "Generating hip_test_config.hh and hip_test_parameters.hh"
)
# Ensure the generated header files are built before the main target
add_custom_target(hip_tests_config DEPENDS ${HIP_TEST_CONFIG_HEADER} ${HIP_TEST_PARAMETERS_HEADER})
if(ENABLE_YAML_TAGS)
add_dependencies(hip_tests_config check_hip_tests_config check_hip_tests_sources)
endif()
set_source_files_properties(${HIP_TEST_CONFIG_HEADER} ${HIP_TEST_PARAMETERS_HEADER} PROPERTIES GENERATED TRUE)