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
71 lines
2.2 KiB
CMake
71 lines
2.2 KiB
CMake
add_custom_target(OpenMPUnitTests)
|
|
set_target_properties(OpenMPUnitTests PROPERTIES FOLDER "OpenMP/Tests")
|
|
|
|
if(WIN32 OR STUBS_LIBRARY)
|
|
message(WARNING "OpenMP unittests disabled due to stub library or Windows")
|
|
return()
|
|
endif()
|
|
|
|
# Make the targets default_gtest and default_gtest_main available.
|
|
if ("openmp" IN_LIST LLVM_ENABLE_PROJECTS)
|
|
# llvm_gtest should already exist
|
|
else ()
|
|
# LLVM_ENABLE_RUNTIMES build
|
|
build_gtest()
|
|
endif ()
|
|
|
|
# Build a testing version of libomp that exports all symbols for unit tests.
|
|
# This library uses the same compiled objects as libomp, but with all symbols
|
|
# exported to allow testing internal functions.
|
|
|
|
libomp_get_ldflags(LIBOMP_TEST_LDFLAGS FOR_UNITTESTS)
|
|
libomp_get_libflags(LIBOMP_TEST_LIBFLAGS)
|
|
|
|
# Create the testing library from the same objects as libomp.
|
|
add_library(omp_testing SHARED $<TARGET_OBJECTS:obj.omp>)
|
|
set_property(TARGET omp_testing PROPERTY FOLDER "OpenMP/Libraries")
|
|
target_link_libraries(omp_testing PUBLIC default_gtest)
|
|
target_link_libraries(omp_testing PUBLIC ${LIBOMP_TEST_LIBFLAGS} ${LIBOMP_DL_LIBS})
|
|
set_target_properties(omp_testing PROPERTIES
|
|
PREFIX ""
|
|
SUFFIX ""
|
|
OUTPUT_NAME "libomp_testing${LIBOMP_LIBRARY_SUFFIX}"
|
|
LINK_FLAGS "${LIBOMP_TEST_LDFLAGS}"
|
|
LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE}
|
|
EXCLUDE_FROM_ALL TRUE # Don't build by default, only when tests need it
|
|
)
|
|
target_include_directories(omp_testing PUBLIC
|
|
${LIBOMP_INCLUDE_DIR}
|
|
${LIBOMP_SRC_DIR}
|
|
)
|
|
|
|
function(add_openmp_unittest test_name)
|
|
add_unittest(OpenMPUnitTests ${test_name} ${ARGN})
|
|
|
|
# Link against the testing library which exports all symbols.
|
|
target_link_libraries(${test_name} PRIVATE omp_testing)
|
|
|
|
if(TARGET default_gtest)
|
|
target_link_libraries(${test_name} PRIVATE default_gtest_main default_gtest)
|
|
else ()
|
|
target_link_libraries(${test_name} PRIVATE llvm_gtest_main llvm_gtest)
|
|
endif ()
|
|
endfunction()
|
|
|
|
configure_lit_site_cfg(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../test/Unit/lit.site.cfg.py.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
|
|
MAIN_CONFIG
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../test/Unit/lit.cfg.py
|
|
)
|
|
|
|
add_openmp_testsuite(
|
|
check-libomp-unit
|
|
"Running libomp unit tests"
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
EXCLUDE_FROM_CHECK_ALL
|
|
DEPENDS OpenMPUnitTests
|
|
)
|
|
|
|
add_subdirectory(String)
|