Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions bindings/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,34 @@ else()
add_library(fdb_c SHARED ${FDB_C_SRCS} ${fdb_c_apiversion_file} ${asm_file})
strip_debug_symbols(fdb_c)
endif()

function(ensure_doctest)
find_package(doctest 2.4.8 CONFIG)
if(NOT doctest_FOUND)
message(STATUS "doctest not found locally, downloading it from github...")
include(ExternalProject)
find_package(Git REQUIRED)

ExternalProject_Add(
doctest_proj
PREFIX ${CMAKE_BINARY_DIR}/doctest
GIT_REPOSITORY https://github.com/onqtam/doctest.git
GIT_TAG 7b9885133108ae301ddd16e2651320f54cafeba7 # v2.4.8
TIMEOUT 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems super fragile, like 10 second timeouts can happen for all kinds of normal reasons (e.g. random wifi drops in Apple Park) and failing a build for normal failures is not desired. I guess I assume the block of code inside ExternalProject_Add does not retry periodically (because how does the caller know if the error is retriable or not?). However I do not have any better ideas.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe my suggestion is: use a larger timeout. I don't think there is any cost to saying "1000" or "3600" here.

CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
)

ExternalProject_Get_Property(doctest_proj source_dir)

add_library(doctest::doctest INTERFACE IMPORTED)
add_dependencies(doctest::doctest doctest_proj)
set_target_properties(doctest::doctest PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${source_dir}")
endif()
endfunction()

add_dependencies(fdb_c fdb_c_generated fdb_c_options)
add_dependencies(fdbclient fdb_c_options)
add_dependencies(fdbclient_sampling fdb_c_options)
Expand Down Expand Up @@ -119,7 +147,6 @@ if(NOT WIN32)
test/mako/time.hpp
test/mako/utils.cpp
test/mako/utils.hpp)
add_subdirectory(test/unit/third_party)
find_package(Threads REQUIRED)
set(UNIT_TEST_SRCS
test/unit/unit_tests.cpp
Expand Down Expand Up @@ -209,13 +236,15 @@ if(NOT WIN32)
endif()
target_link_libraries(fdb_c_api_tester_impl PRIVATE SimpleOpt)

ensure_doctest()

target_include_directories(fdb_c_unit_tests_impl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/)
target_include_directories(fdb_c_unit_tests_version_510 PUBLIC ${CMAKE_BINARY_DIR}/flow/include)
target_link_libraries(fdb_c_setup_tests PRIVATE fdb_c Threads::Threads doctest)
target_link_libraries(fdb_c_unit_tests_impl PRIVATE fdb_c Threads::Threads fdbclient rapidjson doctest)
target_link_libraries(fdb_c_unit_tests_version_510 PRIVATE fdb_c Threads::Threads doctest)
target_link_libraries(trace_partial_file_suffix_test PRIVATE fdb_c Threads::Threads flow doctest)
target_link_libraries(disconnected_timeout_unit_tests PRIVATE fdb_c Threads::Threads doctest)
target_link_libraries(fdb_c_setup_tests PRIVATE fdb_c Threads::Threads doctest::doctest)
target_link_libraries(fdb_c_unit_tests_impl PRIVATE fdb_c Threads::Threads fdbclient rapidjson doctest::doctest)
target_link_libraries(fdb_c_unit_tests_version_510 PRIVATE fdb_c Threads::Threads doctest::doctest)
target_link_libraries(trace_partial_file_suffix_test PRIVATE fdb_c Threads::Threads flow doctest::doctest)
target_link_libraries(disconnected_timeout_unit_tests PRIVATE fdb_c Threads::Threads doctest::doctest)
target_link_libraries(fdb_c_client_config_tester PRIVATE SimpleOpt fdb_cpp fdb_c fdbclient Threads::Threads fmt::fmt)
target_include_directories(fdb_c_client_config_tester PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/)

Expand Down
2 changes: 1 addition & 1 deletion bindings/c/test/unit/disconnected_timeout_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <thread>

#define DOCTEST_CONFIG_IMPLEMENT
#include "doctest.h"
#include "doctest/doctest.h"
#include "fdb_api.hpp"

void fdb_check(fdb_error_t e) {
Expand Down
2 changes: 1 addition & 1 deletion bindings/c/test/unit/setup_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <thread>

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"
#include "doctest/doctest.h"

void fdb_check(fdb_error_t e) {
if (e) {
Expand Down
33 changes: 0 additions & 33 deletions bindings/c/test/unit/third_party/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion bindings/c/test/unit/unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

#define DOCTEST_CONFIG_IMPLEMENT
#include <rapidjson/document.h>
#include "doctest.h"
#include "doctest/doctest.h"
#include "fdbclient/Tuple.h"

#include "flow/config.h"
Expand Down
2 changes: 1 addition & 1 deletion bindings/c/test/unit/unit_tests_version_510.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static_assert(FDB_API_VERSION == 510, "Don't change this! This test intentionall
#include <foundationdb/fdb_c.h>

#define DOCTEST_CONFIG_IMPLEMENT
#include "doctest.h"
#include "doctest/doctest.h"

#include "flow/config.h"

Expand Down
1 change: 0 additions & 1 deletion fdbclient/vexillographer/vexillographer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
Expand Down