repertory/cmake/unittests.cmake
Scott E. Graves f43c41f88a
Some checks failed
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_windows/pipeline/head This commit looks good
BlockStorage/repertory/pipeline/head There was a failure building this commit
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
BlockStorage/repertory_osx_builds/pipeline/head There was a failure building this commit
2.0.0-rc (#9)
### Issues

* \#1 \[bug\] Unable to mount S3 due to 'item_not_found' exception
* \#2 Require bucket name for S3 mounts
* \#3 \[bug\] File size is not being updated in S3 mount
* \#4 Upgrade to libfuse-3.x.x
* \#5 Switch to renterd for Sia support
* \#6 Switch to cpp-httplib to further reduce dependencies
* \#7 Remove global_data and calculate used disk space per provider
* \#8 Switch to libcurl for S3 mount support

### Changes from v1.x.x

* Added read-only encrypt provider
  * Pass-through mount point that transparently encrypts source data using `XChaCha20-Poly1305`
* Added S3 encryption support via `XChaCha20-Poly1305`
* Added replay protection to remote mounts
* Added support base64 writes in remote FUSE
* Created static linked Linux binaries for `amd64` and `aarch64` using `musl-libc`
* Removed legacy Sia renter support
* Removed Skynet support
* Fixed multiple remote mount WinFSP API issues on \*NIX servers
* Implemented chunked read and write
  * Writes for non-cached files are performed in chunks of 8Mib
* Removed `repertory-ui` support
* Removed `FreeBSD` support
* Switched to `libsodium` over `CryptoPP`
* Switched to `XChaCha20-Poly1305` for remote mounts
* Updated `GoogleTest` to v1.14.0
* Updated `JSON for Modern C++` to v3.11.2
* Updated `OpenSSL` to v1.1.1w
* Updated `RocksDB` to v8.5.3
* Updated `WinFSP` to 2023
* Updated `boost` to v1.78.0
* Updated `cURL` to v8.3.0
* Updated `zlib` to v1.3
* Use `upload_manager` for all providers
  * Adds a delay to uploads to prevent excessive API calls
  * Supports re-upload after mount restart for incomplete uploads
  * NOTE: Uploads for all providers are full file (no resume support)
    * Multipart upload support is planned for S3

Reviewed-on: #9
2023-10-29 06:55:59 +00:00

111 lines
4.5 KiB
CMake

# Testing
if (REPERTORY_ENABLE_TESTING)
enable_testing()
set(GTEST_PROJECT_NAME gtest_${GTEST_VERSION})
set(GTEST_BUILD_ROOT ${EXTERNAL_BUILD_ROOT}/builds/${GTEST_PROJECT_NAME})
if (MSVC)
ExternalProject_Add(gtest_project
DOWNLOAD_NO_PROGRESS 1
URL https://github.com/google/googletest/archive/refs/tags/${GTEST_VERSION}.tar.gz
PREFIX ${GTEST_BUILD_ROOT}
CMAKE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}
-DCMAKE_BUILD_TYPE=${EXTERNAL_BUILD_TYPE}
-Dgtest_force_shared_crt=OFF
-DBUILD_SHARED_LIBS=ON
-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install step."
)
else()
if (MACOS)
set(GTEST_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(GTEST_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
else()
set(GTEST_C_FLAGS ${CMAKE_C_FLAGS})
set(GTEST_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif()
ExternalProject_Add(gtest_project
DOWNLOAD_NO_PROGRESS 1
URL https://github.com/google/googletest/archive/refs/tags/${GTEST_VERSION}.tar.gz
PREFIX ${GTEST_BUILD_ROOT}
CMAKE_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${GTEST_C_FLAGS}
-DCMAKE_CXX_FLAGS=${GTEST_CXX_FLAGS}
-DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}
-DCMAKE_BUILD_TYPE=${EXTERNAL_BUILD_TYPE}
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install step."
)
endif()
set(GTEST_INCLUDE_DIRS
${GTEST_BUILD_ROOT}/src/gtest_project/googletest/include
${GTEST_BUILD_ROOT}/src/gtest_project/googlemock/include
)
if (MSVC)
if (NOT CMAKE_GENERATOR_LOWER STREQUAL "nmake makefiles")
set (GTEST_PATH_EXTRA ${CMAKE_BUILD_TYPE}/)
endif()
set(GTEST_LIBRARIES
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gmock${DEBUG_EXTRA}.lib
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gmock_main${DEBUG_EXTRA}.lib
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gtest${DEBUG_EXTRA}.lib
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gtest_main${DEBUG_EXTRA}.lib
)
elseif (UNIX OR MINGW)
set(GTEST_LIBRARIES
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/libgmock.a
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/libgtest.a
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/libgtest_main.a
)
endif()
file(GLOB_RECURSE UNITTEST_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/tests/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/fixtures/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/mocks/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/utils/*.hpp
)
add_project_executable(unittests "${UNITTEST_SOURCES}")
add_dependencies(unittests gtest_project)
target_compile_definitions(unittests PUBLIC
GTEST_LINKED_AS_SHARED_LIBRARY=1
REPERTORY_TESTING
)
target_include_directories(unittests PUBLIC
${GTEST_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/tests
)
target_link_libraries(unittests PRIVATE ${GTEST_LIBRARIES})
if (MSVC)
add_custom_command(TARGET unittests
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gmock${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
)
add_custom_command(TARGET unittests
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gmock_main${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
)
add_custom_command(TARGET unittests
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gtest${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
)
add_custom_command(TARGET unittests
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gtest_main${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
)
endif()
if (CMAKE_GENERATOR_LOWER STREQUAL "nmake makefiles")
add_test(NAME AllTests COMMAND unittests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
else()
add_test(NAME AllTests COMMAND unittests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
endif()
endif()