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
90 lines
2.2 KiB
CMake
90 lines
2.2 KiB
CMake
include(FetchContent)
|
|
|
|
if(${CMAKE_VERSION} VERSION_LESS "3.24.0")
|
|
FetchContent_Declare(
|
|
googletest
|
|
URL https://github.com/google/googletest/archive/41fe6be7d738237d1ca53070bd6ddebb73190b58.zip
|
|
)
|
|
else()
|
|
FetchContent_Declare(
|
|
googletest
|
|
URL https://github.com/google/googletest/archive/41fe6be7d738237d1ca53070bd6ddebb73190b58.zip
|
|
FIND_PACKAGE_ARGS NAMES GTest
|
|
DOWNLOAD_EXTRACT_TIMESTAMP = TRUE
|
|
)
|
|
endif()
|
|
|
|
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
|
|
|
FetchContent_MakeAvailable(googletest)
|
|
|
|
enable_testing()
|
|
|
|
# Find all the binary files used for testing and copy them into the build
|
|
# directory. This allows the test to be run from the build directory
|
|
|
|
# First, create an elf_examples folder under the current build directory
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/elf_examples)
|
|
|
|
# Second, glob all files under elf_examples
|
|
file(GLOB elf_examples
|
|
LIST_DIRECTORIES
|
|
false
|
|
CONFIGURE_DEPENDS
|
|
elf_examples/*)
|
|
|
|
# Third, copy each file globbed to the elf_examples folder under the current
|
|
# build directory
|
|
foreach(example ${elf_examples})
|
|
configure_file(${example} ${CMAKE_CURRENT_BINARY_DIR}/elf_examples COPYONLY)
|
|
endforeach()
|
|
|
|
# Lastly, copy the script to run the tests
|
|
configure_file(runELFtests ${CMAKE_CURRENT_BINARY_DIR}/runELFtests COPYONLY)
|
|
|
|
add_executable(
|
|
ELFIOTest
|
|
ELFIOTest.cpp
|
|
ELFIOTest1.cpp
|
|
ELFIOTest2.cpp)
|
|
|
|
target_link_libraries(
|
|
ELFIOTest
|
|
PRIVATE
|
|
elfio::elfio
|
|
gtest_main
|
|
GTest::gtest_main)
|
|
|
|
add_test(
|
|
NAME
|
|
ELFIOTest
|
|
COMMAND
|
|
${CMAKE_CURRENT_BINARY_DIR}/ELFIOTest
|
|
WORKING_DIRECTORY
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
add_executable(
|
|
elfio_fuzzer
|
|
elfio_fuzzer.cpp)
|
|
|
|
target_link_libraries(
|
|
elfio_fuzzer
|
|
PRIVATE
|
|
elfio::elfio)
|
|
|
|
target_compile_options(elfio_fuzzer
|
|
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize=fuzzer,address>
|
|
)
|
|
|
|
target_link_libraries(elfio_fuzzer
|
|
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize=fuzzer,address>
|
|
)
|
|
endif()
|
|
|
|
add_dependencies(check ELFIOTest)
|
|
|
|
include(GoogleTest)
|
|
gtest_discover_tests(ELFIOTest)
|