From 54dfc1f16de825896b0325ecfe50fe4c028d26b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Wed, 18 Sep 2024 08:01:14 +0300 Subject: [PATCH] =?UTF-8?q?mdbx-testing:=20=D1=83=D0=BD=D0=B8=D1=84=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0=D1=86=D0=B8=D1=8F=20extra-=D1=82=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B8=20=D0=B8=D0=BD=D1=82=D0=B5=D0=B3=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B2=20ctest.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/CMakeLists.txt | 34 ++++++++++++++++------------ test/extra/crunched_delete.c++ | 6 ++--- test/extra/dbi.c++ | 8 +++---- test/extra/doubtless_positioning.c++ | 7 +++--- test/extra/dupfix_multiple.c++ | 8 +++---- test/extra/hex_base64_base58.c++ | 1 - test/extra/maindb_ordinal.c++ | 10 ++++---- 7 files changed, 36 insertions(+), 38 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c5537f87..77004853 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -75,19 +75,20 @@ if(WIN32) target_link_libraries(mdbx_test winmm.lib) endif() -if(UNIX AND NOT SUBPROJECT) - add_executable(test_extra_pcrf extra/pcrf/pcrf_test.c) - target_include_directories(test_extra_pcrf PRIVATE "${PROJECT_SOURCE_DIR}") - target_link_libraries(test_extra_pcrf ${TOOL_MDBX_LIB}) +if(NOT SUBPROJECT) + if(UNIX) + add_executable(test_extra_pcrf extra/pcrf/pcrf_test.c) + target_include_directories(test_extra_pcrf PRIVATE "${PROJECT_SOURCE_DIR}") + target_link_libraries(test_extra_pcrf ${TOOL_MDBX_LIB}) - add_executable(test_extra_upsert_alldups extra/upsert_alldups.c) - target_include_directories(test_extra_upsert_alldups PRIVATE "${PROJECT_SOURCE_DIR}") - target_link_libraries(test_extra_upsert_alldups ${TOOL_MDBX_LIB}) - - add_executable(test_extra_dupfix_addodd extra/dupfix_addodd.c) - target_include_directories(test_extra_dupfix_addodd PRIVATE "${PROJECT_SOURCE_DIR}") - target_link_libraries(test_extra_dupfix_addodd ${TOOL_MDBX_LIB}) + add_executable(test_extra_upsert_alldups extra/upsert_alldups.c) + target_include_directories(test_extra_upsert_alldups PRIVATE "${PROJECT_SOURCE_DIR}") + target_link_libraries(test_extra_upsert_alldups ${TOOL_MDBX_LIB}) + add_executable(test_extra_dupfix_addodd extra/dupfix_addodd.c) + target_include_directories(test_extra_dupfix_addodd PRIVATE "${PROJECT_SOURCE_DIR}") + target_link_libraries(test_extra_dupfix_addodd ${TOOL_MDBX_LIB}) + endif() if(MDBX_BUILD_CXX) add_executable(test_extra_maindb_ordinal extra/maindb_ordinal.c++) target_include_directories(test_extra_maindb_ordinal PRIVATE "${PROJECT_SOURCE_DIR}") @@ -210,10 +211,12 @@ else() REQUIRED_FILES uniq_nested.db-copy) endif() - if(UNIX AND NOT SUBPROJECT) - add_test(NAME extra_upsert_alldups COMMAND test_extra_upsert_alldups) - add_test(NAME extra_dupfix_addodd COMMAND test_extra_dupfix_addodd) - if(MDBX_BUILD_CXX) + if(NOT SUBPROJECT) + if(UNIX) + add_test(NAME extra_upsert_alldups COMMAND test_extra_upsert_alldups) + add_test(NAME extra_dupfix_addodd COMMAND test_extra_dupfix_addodd) + endif() + if(MDBX_BUILD_CXX AND NOT (WIN32 AND MDBX_BUILD_SHARED_LIBRARY)) add_test(NAME extra_maindb_ordinal COMMAND test_extra_maindb_ordinal) add_test(NAME extra_dupfix_multiple COMMAND test_extra_dupfix_multiple) add_test(NAME extra_hex_base64_base58 COMMAND test_extra_hex_base64_base58) @@ -222,6 +225,7 @@ else() set_tests_properties(extra_doubtless_positioning PROPERTIES TIMEOUT 10800) endif() add_test(NAME extra_crunched_delete COMMAND test_extra_crunched_delete) + add_test(NAME extra_dbi COMMAND test_extra_dbi) endif() endif() diff --git a/test/extra/crunched_delete.c++ b/test/extra/crunched_delete.c++ index 2158f33a..89952ddf 100644 --- a/test/extra/crunched_delete.c++ +++ b/test/extra/crunched_delete.c++ @@ -377,8 +377,8 @@ int main(int argc, const char *argv[]) { mdbx_setup_debug_nofmt(MDBX_LOG_NOTICE, MDBX_DBG_ASSERT, logger_nofmt, log_buffer, sizeof(log_buffer)); - const char *filename = "test-crunched-del"; - mdbx::env::remove(filename); + mdbx::path db_filename = "test-crunched-del"; + mdbx::env::remove(db_filename); std::vector testset; // Там ключи разной длины - от 1 до 64 байт. @@ -394,7 +394,7 @@ int main(int argc, const char *argv[]) { testset.emplace_back(8, 8, 1, 5, 10); testset.emplace_back(8, 8, 32, 36, 9); - mdbx::env_managed env(filename, mdbx::env_managed::create_parameters(), + mdbx::env_managed env(db_filename, mdbx::env_managed::create_parameters(), mdbx::env::operate_parameters(42)); if (!simple(env) || !next_prev_current(env) || !outofrange_prev(env)) return EXIT_FAILURE; diff --git a/test/extra/dbi.c++ b/test/extra/dbi.c++ index 86dd0c4d..2a12be6a 100644 --- a/test/extra/dbi.c++ +++ b/test/extra/dbi.c++ @@ -18,19 +18,19 @@ int main(int argc, const char *argv[]) { mdbx_setup_debug_nofmt(MDBX_LOG_NOTICE, MDBX_DBG_ASSERT, logger_nofmt, log_buffer, sizeof(log_buffer)); - mdbx::path path = "test-dbi"; - mdbx::env::remove(path); + mdbx::path db_filename = "test-dbi"; + mdbx::env::remove(db_filename); mdbx::env::operate_parameters operateParameters(100, 10); mdbx::env_managed::create_parameters createParameters; { - mdbx::env_managed env2(path, createParameters, operateParameters); + mdbx::env_managed env2(db_filename, createParameters, operateParameters); mdbx::txn_managed txn2 = env2.start_write(false); /* mdbx::map_handle testHandle2 = */ txn2.create_map( "fap1", mdbx::key_mode::reverse, mdbx::value_mode::single); txn2.commit(); } - mdbx::env_managed env(path, createParameters, operateParameters); + mdbx::env_managed env(db_filename, createParameters, operateParameters); mdbx::txn_managed txn = env.start_write(false); /* mdbx::map_handle testHandle = */ txn.create_map( "fap1", mdbx::key_mode::usual, mdbx::value_mode::single); diff --git a/test/extra/doubtless_positioning.c++ b/test/extra/doubtless_positioning.c++ index e1f070b1..4cf710cd 100644 --- a/test/extra/doubtless_positioning.c++ +++ b/test/extra/doubtless_positioning.c++ @@ -6,7 +6,6 @@ #include #include #include -#include static ::std::ostream &operator<<(::std::ostream &out, const mdbx::cursor::move_operation op) { @@ -233,9 +232,9 @@ int main(int argc, const char *argv[]) { (void)argc; (void)argv; - unlink("." MDBX_DATANAME); - unlink("." MDBX_LOCKNAME); - mdbx::env_managed env(".", mdbx::env_managed::create_parameters(), + mdbx::path db_filename = "test-posi"; + mdbx::env_managed::remove(db_filename); + mdbx::env_managed env(db_filename, mdbx::env_managed::create_parameters(), mdbx::env::operate_parameters(3)); auto txn = env.start_write(); diff --git a/test/extra/dupfix_multiple.c++ b/test/extra/dupfix_multiple.c++ index 2686feea..3e1d323e 100644 --- a/test/extra/dupfix_multiple.c++ +++ b/test/extra/dupfix_multiple.c++ @@ -4,16 +4,14 @@ #include "mdbx.h++" #include #include -#include int main(int argc, const char *argv[]) { (void)argc; (void)argv; - unlink("." MDBX_DATANAME); - unlink("." MDBX_LOCKNAME); - - mdbx::env_managed env(".", mdbx::env_managed::create_parameters(), + mdbx::path db_filename = "test-dupfix-multiple"; + mdbx::env_managed::remove(db_filename); + mdbx::env_managed env(db_filename, mdbx::env_managed::create_parameters(), mdbx::env::operate_parameters()); using buffer = diff --git a/test/extra/hex_base64_base58.c++ b/test/extra/hex_base64_base58.c++ index 096c5821..f2419ebd 100644 --- a/test/extra/hex_base64_base58.c++ +++ b/test/extra/hex_base64_base58.c++ @@ -4,7 +4,6 @@ #include "mdbx.h++" #include #include -#include #include #include diff --git a/test/extra/maindb_ordinal.c++ b/test/extra/maindb_ordinal.c++ index b38c04ef..dc3fd597 100644 --- a/test/extra/maindb_ordinal.c++ +++ b/test/extra/maindb_ordinal.c++ @@ -3,16 +3,14 @@ #include "mdbx.h++" #include -#include int main(int argc, const char *argv[]) { (void)argc; (void)argv; - unlink("." MDBX_DATANAME); - unlink("." MDBX_LOCKNAME); - - mdbx::env_managed env(".", mdbx::env_managed::create_parameters(), + mdbx::path db_filename = "test-dupfix-multiple"; + mdbx::env_managed::remove(db_filename); + mdbx::env_managed env(db_filename, mdbx::env_managed::create_parameters(), mdbx::env::operate_parameters()); using buffer = @@ -23,7 +21,7 @@ int main(int argc, const char *argv[]) { #if 0 /* workaround */ txn.commit(); env.close(); - env = mdbx::env_managed(".", mdbx::env_managed::create_parameters(), + env = mdbx::env_managed(db_filename, mdbx::env_managed::create_parameters(), mdbx::env::operate_parameters()); txn = env.start_write(); #endif