Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-PLACET committed Dec 20, 2024
1 parent 35e3e10 commit 4fc5ae1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 48 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ jobs:
if: success() || failure()
with:
name: test_sparrow_lib_report_Linux_${{ matrix.sys.compiler }}_${{ matrix.sys.version }}_${{ matrix.sys.stdlib }}_${{ matrix.config.name }}_date-polyfill_${{ matrix.sys.date-polyfill}}
path: |
build/test/test_sparrow_lib_report_doctest.xml
build/test/test_sparrow_lib_report_catch2.xml
path: ./**/test*.xml
if-no-files-found: error

- name: Run all examples
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ jobs:
if: success() || failure()
with:
name: test_sparrow_lib_report_OSX_${{ matrix.os }}_${{ matrix.config.name }}_${{ matrix.compiler }}
path: |
build/test/test_sparrow_lib_report_doctest.xml
build/test/test_sparrow_lib_report_catch2.xml
path: ./**/test*.xml
if-no-files-found: error

- name: Run all examples
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/qemu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,5 @@ jobs:
if: success() || failure()
with:
name: test_sparrow_lib_report_Linux_${{matrix.target.distro}}_${{matrix.target.arch}}_${{matrix.config.name}}_date-polyfill_${{matrix.target.date-polyfill}}
path: |
build/test/test_sparrow_lib_report_doctest.xml
build/test/test_sparrow_lib_report_catch2.xml
path: ./**/test*.xml
if-no-files-found: error
4 changes: 1 addition & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ jobs:
if: success() || failure()
with:
name: test_sparrow_lib_report_Windows_${{ matrix.toolchain.compiler }}_${{ matrix.build-system.name }}_${{ matrix.config.name }}_${{ matrix.target-arch.name }}_date-polyfill_${{ matrix.toolchain.date-polyfill}}
path: |
build/test/test_sparrow_lib_report_doctest.xml
build/test/test_sparrow_lib_report_catch2.xml
path: ./**/test*.xml
if-no-files-found: error

- name: Tests coverage
Expand Down
76 changes: 40 additions & 36 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ endif()

if(NOT FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "ON")
find_package(doctest ${FIND_PACKAGE_OPTIONS})
find_package(Catch2 3 ${FIND_PACKAGE_OPTIONS})
# find_package(Catch2 3 ${FIND_PACKAGE_OPTIONS})
find_package(nanoarrow ${FIND_PACKAGE_OPTIONS})
endif()

Expand All @@ -54,18 +54,18 @@ if(FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "ON" OR FETCH_DEPENDENCIES_WITH_CMAKE
FetchContent_MakeAvailable(doctest)
endif()

if(NOT Catch2_FOUND)
message(STATUS "📦 Fetching Catch2 v3.7.1")
FetchContent_Declare(
Catch2
GIT_SHALLOW TRUE
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.7.1
GIT_PROGRESS TRUE
SYSTEM
EXCLUDE_FROM_ALL)
FetchContent_MakeAvailable(Catch2)
endif()
# if(NOT Catch2_FOUND)
# message(STATUS "📦 Fetching Catch2 v3.7.1")
# FetchContent_Declare(
# Catch2
# GIT_SHALLOW TRUE
# GIT_REPOSITORY https://github.com/catchorg/Catch2.git
# GIT_TAG v3.7.1
# GIT_PROGRESS TRUE
# SYSTEM
# EXCLUDE_FROM_ALL)
# FetchContent_MakeAvailable(Catch2)
# endif()

if(NOT nanoarrow_FOUND)
message(STATUS "📦 Fetching nanoarrow 0.6")
Expand Down Expand Up @@ -166,17 +166,17 @@ target_link_libraries(${test_target}
nanoarrow::nanoarrow
$<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_LIBRARIES}>)

set(test_target_catch2 "test_sparrow_lib_catch2")
# set(test_target_catch2 "test_sparrow_lib_catch2")

add_executable(${test_target_catch2})
target_link_libraries(${test_target_catch2}
PRIVATE
sparrow
Catch2::Catch2WithMain
$<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_LIBRARIES}>)
# add_executable(${test_target_catch2})
# target_link_libraries(${test_target_catch2}
# PRIVATE
# sparrow
# Catch2::Catch2WithMain
# $<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_LIBRARIES}>)

include(Catch)
catch_discover_tests(${test_target_catch2})
# include(Catch)
# catch_discover_tests(${test_target_catch2})

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(compiles_options
Expand Down Expand Up @@ -277,22 +277,24 @@ endif()
set_target_properties(${test_target} PROPERTIES CMAKE_CXX_EXTENSIONS OFF)
target_compile_features(${test_target} PRIVATE cxx_std_20)

target_compile_options(${test_target_catch2}
PRIVATE
${compiles_options}
$<$<BOOL:USE_SANITIZER>:${SANITIZER_COMPILE_OPTIONS}>
)
target_link_options(${test_target_catch2}
PRIVATE
$<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_OPTIONS}>)
# target_compile_options(${test_target_catch2}
# PRIVATE
# ${compiles_options}
# $<$<BOOL:USE_SANITIZER>:${SANITIZER_COMPILE_OPTIONS}>
# )
# target_link_options(${test_target_catch2}
# PRIVATE
# $<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_OPTIONS}>)
# We do not use non-standard C++
set_target_properties(${test_target_catch2} PROPERTIES CMAKE_CXX_EXTENSIONS OFF)
target_compile_features(${test_target_catch2} PRIVATE cxx_std_20)
# set_target_properties(${test_target_catch2} PROPERTIES CMAKE_CXX_EXTENSIONS OFF)
# target_compile_features(${test_target_catch2} PRIVATE cxx_std_20)

add_custom_target(run_tests
COMMAND ${test_target}
COMMAND ${test_target_catch2} -v high
DEPENDS ${test_target} ${test_target_catch2}
# COMMAND ${test_target_catch2} -v high
DEPENDS
${test_target}
# ${test_target_catch2}
COMMENT "Running tests for Doctest and Catch2"
USES_TERMINAL
)
Expand All @@ -304,8 +306,10 @@ set(JUNIT_REPORT_FILE_CATCH2 ${CMAKE_CURRENT_BINARY_DIR}/test_sparrow_lib_report

add_custom_target(run_tests_with_junit_report
COMMAND ${test_target} --reporters=better_junit --out=${JUNIT_REPORT_FILE_DOCTEST} --no-path-filenames=true
COMMAND ${test_target_catch2} --reporter JUnit -o ${JUNIT_REPORT_FILE_CATCH2}
DEPENDS ${test_target} ${test_target_catch2}
# COMMAND ${test_target_catch2} --reporter JUnit -o ${JUNIT_REPORT_FILE_CATCH2}
DEPENDS
${test_target}
# ${test_target_catch2}
COMMENT "Running tests with JUnit reports saved to: ${JUNIT_REPORT_FILE_DOCTEST} and ${JUNIT_REPORT_FILE_CATCH2}"
USES_TERMINAL
)
Expand Down

0 comments on commit 4fc5ae1

Please sign in to comment.