Add test for using an external client
This commit is contained in:
parent
e4a55908ff
commit
75f8725392
|
@ -119,6 +119,12 @@ if(NOT WIN32)
|
|||
target_link_libraries(fdb_c90_test PRIVATE fdb_c)
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libfdb_c.so COMMAND
|
||||
${CMAKE_COMMAND} -E copy $<TARGET_FILE:fdb_c> ${CMAKE_CURRENT_BINARY_DIR}/libfdb_c.so
|
||||
COMMENT "Copy libfdb_c to use as external client for test")
|
||||
add_custom_target(external_client DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libfdb_c.so)
|
||||
add_dependencies(fdb_c_unit_tests external_client)
|
||||
|
||||
add_fdbclient_test(
|
||||
NAME fdb_c_setup_tests
|
||||
COMMAND $<TARGET_FILE:fdb_c_setup_tests>)
|
||||
|
@ -127,6 +133,13 @@ if(NOT WIN32)
|
|||
COMMAND $<TARGET_FILE:fdb_c_unit_tests>
|
||||
@CLUSTER_FILE@
|
||||
fdb)
|
||||
add_fdbclient_test(
|
||||
NAME fdb_c_external_client_unit_tests
|
||||
COMMAND $<TARGET_FILE:fdb_c_unit_tests>
|
||||
@CLUSTER_FILE@
|
||||
fdb
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libfdb_c.so
|
||||
)
|
||||
endif()
|
||||
|
||||
set(c_workloads_srcs
|
||||
|
|
|
@ -2112,16 +2112,23 @@ TEST_CASE("block_from_callback") {
|
|||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc != 3) {
|
||||
if (argc != 3 && argc != 4) {
|
||||
std::cout << "Unit tests for the FoundationDB C API.\n"
|
||||
<< "Usage: fdb_c_unit_tests /path/to/cluster_file key_prefix"
|
||||
<< std::endl;
|
||||
<< "Usage: fdb_c_unit_tests /path/to/cluster_file key_prefix [externalClient]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
fdb_check(fdb_select_api_version(700));
|
||||
if (argc == 4) {
|
||||
std::string externalClientLibrary = argv[3];
|
||||
fdb_check(fdb_network_set_option(FDBNetworkOption::FDB_NET_OPTION_DISABLE_LOCAL_CLIENT,
|
||||
reinterpret_cast<const uint8_t*>(""), 0));
|
||||
fdb_check(fdb_network_set_option(FDBNetworkOption::FDB_NET_OPTION_EXTERNAL_CLIENT_LIBRARY,
|
||||
reinterpret_cast<const uint8_t*>(externalClientLibrary.c_str()),
|
||||
externalClientLibrary.size()));
|
||||
}
|
||||
|
||||
doctest::Context context;
|
||||
|
||||
fdb_check(fdb_select_api_version(700));
|
||||
fdb_check(fdb_setup_network());
|
||||
std::thread network_thread{ &fdb_run_network };
|
||||
|
||||
|
|
|
@ -401,6 +401,7 @@ function(add_fdbclient_test)
|
|||
--build-dir ${CMAKE_BINARY_DIR}
|
||||
--
|
||||
${T_COMMAND})
|
||||
set_tests_properties("${T_NAME}" PROPERTIES TIMEOUT 60)
|
||||
endfunction()
|
||||
|
||||
function(add_java_test)
|
||||
|
@ -412,10 +413,10 @@ function(add_java_test)
|
|||
return()
|
||||
endif()
|
||||
if(NOT T_NAME)
|
||||
message(FATAL_ERROR "NAME is a required argument for add_fdbclient_test")
|
||||
message(FATAL_ERROR "NAME is a required argument for add_java_test")
|
||||
endif()
|
||||
if(NOT T_CLASS)
|
||||
message(FATAL_ERROR "CLASS is a required argument for add_fdbclient_test")
|
||||
message(FATAL_ERROR "CLASS is a required argument for add_java_test")
|
||||
endif()
|
||||
set(cp "")
|
||||
set(separator ":")
|
||||
|
|
Loading…
Reference in New Issue