Skip to content

Commit 12664b6

Browse files
committed
Add support for Catch2
Makes Catch2 available for C++ unit tests; Adds GPM script availability to CMake. Adds rudimentary test for rgw_hex. Signed-off-by: Jesse F. Williamson <[email protected]>
1 parent e9525ee commit 12664b6

File tree

6 files changed

+1439
-1
lines changed

6 files changed

+1439
-1
lines changed

CMakeLists.txt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,28 @@ if(WITH_JAEGER)
517517
set(HAVE_JAEGER TRUE)
518518
endif()
519519

520+
# Catch2 C++ Unit Test support:
521+
# This needs to come before any tests using Catch2.
522+
option(WITH_CATCH2 "Enable Catch2 unit tests" ON)
523+
option(WITH_SYSTEM_CATCH2 "Enable Catch2 unit tests (require system packages)" OFF)
524+
525+
if(WITH_CATCH2)
526+
# Save pre-existing definitions (if any):
527+
set(ORIG_CPM_LOCAL_PACKAGES_ONLY ${CPM_USE_LOCAL_PACKAGES_ONLY})
528+
529+
if(WITH_SYSTEM_CATCH2)
530+
set(CPM_LOCAL_PACKAGES_ONLY ON)
531+
endif()
532+
533+
include(${CMAKE_MODULE_PATH}/CPM.cmake)
534+
CPMAddPackage("gh:catchorg/[email protected]")
535+
536+
# Restore the original CPM settings in case someone else wants to use the module:
537+
set(CPM_USE_LOCAL_PACKAGES_ONLY, ${ORIG_CPM_USE_LOCAL_PACKAGES_ONLY})
538+
539+
message("-- Enabled Catch2 support")
540+
endif()
541+
520542
#option for RGW
521543
option(WITH_RADOSGW "RADOS Gateway is enabled" ON)
522544
option(WITH_RADOSGW_BEAST_OPENSSL "RADOS Gateway's Beast frontend uses OpenSSL" ON)
@@ -527,7 +549,7 @@ option(WITH_RADOSGW_DBSTORE "DBStore backend for RADOS Gateway" ON)
527549
option(WITH_RADOSGW_MOTR "CORTX-Motr backend for RADOS Gateway" OFF)
528550
option(WITH_RADOSGW_DAOS "DAOS backend for RADOS Gateway" OFF)
529551
option(WITH_RADOSGW_D4N "D4N wrapper for RADOS Gateway" ON)
530-
option(WITH_RADOSGW_POSIX "POSIX backend for Rados Gateway" ON)
552+
option(WITH_RADOSGW_POSIX "POSIX backend for RADOS Gateway" ON)
531553
option(WITH_RADOSGW_SELECT_PARQUET "Support for s3 select on parquet objects" ON)
532554
option(WITH_RADOSGW_ARROW_FLIGHT "Build arrow flight when not using system-provided arrow" OFF)
533555
option(WITH_RADOSGW_BACKTRACE_LOGGING "Enable backtraces in rgw logs" OFF)
@@ -835,3 +857,4 @@ add_tags(ctags
835857
EXCLUDE_OPTS ${CTAG_EXCLUDES}
836858
EXCLUDES "*.js" "*.css" ".tox" "python-common/build")
837859
add_custom_target(tags DEPENDS ctags)
860+

0 commit comments

Comments
 (0)