2020-09-27 16:49:55 +03:00
|
|
|
enable_language(CXX)
|
|
|
|
include(../cmake/compiler.cmake)
|
|
|
|
|
2021-04-19 17:44:04 +03:00
|
|
|
set(LIBMDBX_TEST_SOURCES
|
2022-11-08 16:17:14 +03:00
|
|
|
base.h++
|
|
|
|
cases.c++
|
|
|
|
chrono.c++
|
|
|
|
chrono.h++
|
|
|
|
config.c++
|
|
|
|
config.h++
|
|
|
|
copy.c++
|
|
|
|
dead.c++
|
|
|
|
hill.c++
|
|
|
|
jitter.c++
|
|
|
|
keygen.c++
|
|
|
|
keygen.h++
|
|
|
|
log.c++
|
|
|
|
log.h++
|
|
|
|
main.c++
|
|
|
|
osal.h++
|
|
|
|
osal-unix.c++
|
|
|
|
osal-windows.c++
|
|
|
|
test.c++
|
|
|
|
test.h++
|
|
|
|
try.c++
|
|
|
|
utils.c++
|
|
|
|
utils.h++
|
|
|
|
append.c++
|
|
|
|
ttl.c++
|
|
|
|
nested.c++
|
2023-11-08 19:58:18 +03:00
|
|
|
fork.c++
|
2018-11-04 18:57:36 +03:00
|
|
|
)
|
2018-01-04 09:27:09 +03:00
|
|
|
|
2021-04-19 17:44:04 +03:00
|
|
|
if(NOT MDBX_BUILD_CXX)
|
2022-04-07 21:57:49 +03:00
|
|
|
probe_libcxx_filesystem()
|
2021-04-19 17:44:04 +03:00
|
|
|
list(APPEND LIBMDBX_TEST_SOURCES "${MDBX_SOURCE_DIR}/mdbx.c++" ../mdbx.h++)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(mdbx_test ${LIBMDBX_TEST_SOURCES})
|
|
|
|
|
2020-06-26 02:57:46 +03:00
|
|
|
if(MDBX_CXX_STANDARD)
|
|
|
|
set_target_properties(mdbx_test PROPERTIES
|
|
|
|
CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON)
|
|
|
|
endif()
|
|
|
|
|
2019-08-31 17:13:02 +03:00
|
|
|
set_target_properties(mdbx_test PROPERTIES
|
2020-06-26 02:57:46 +03:00
|
|
|
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>)
|
2020-04-15 17:09:37 +03:00
|
|
|
target_setup_options(mdbx_test)
|
2018-01-04 09:27:09 +03:00
|
|
|
|
2022-04-05 17:02:39 +03:00
|
|
|
if(NOT MDBX_BUILD_CXX AND LIBCXX_FILESYSTEM)
|
2022-04-22 23:03:58 +03:00
|
|
|
if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23
|
2022-04-05 18:34:37 +03:00
|
|
|
AND NOT CMAKE_VERSION VERSION_LESS 3.13)
|
|
|
|
target_link_options(mdbx_test PRIVATE "-Wl,--allow-multiple-definition")
|
|
|
|
endif()
|
2022-04-05 17:02:39 +03:00
|
|
|
target_link_libraries(mdbx_test ${LIBCXX_FILESYSTEM})
|
|
|
|
endif()
|
|
|
|
|
2022-11-07 23:37:27 +03:00
|
|
|
if(CMAKE_VERSION VERSION_LESS 3.1)
|
|
|
|
target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
else()
|
|
|
|
target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} Threads::Threads)
|
|
|
|
endif()
|
2019-08-31 17:13:02 +03:00
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
|
|
target_link_libraries(mdbx_test winmm.lib)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(UNIX AND NOT SUBPROJECT)
|
2023-03-04 14:39:21 +03:00
|
|
|
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})
|
2023-03-30 13:08:52 +03:00
|
|
|
|
2024-02-20 11:20:09 +03:00
|
|
|
add_executable(test_extra_dupfixed_addodd extra/dupfixed_addodd.c)
|
|
|
|
target_include_directories(test_extra_dupfixed_addodd PRIVATE "${PROJECT_SOURCE_DIR}")
|
|
|
|
target_link_libraries(test_extra_dupfixed_addodd ${TOOL_MDBX_LIB})
|
|
|
|
|
2023-03-30 13:08:52 +03:00
|
|
|
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}")
|
|
|
|
target_link_libraries(test_extra_maindb_ordinal ${TOOL_MDBX_LIB})
|
|
|
|
if(MDBX_CXX_STANDARD)
|
|
|
|
set_target_properties(test_extra_maindb_ordinal PROPERTIES
|
|
|
|
CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON)
|
|
|
|
endif()
|
2023-10-06 22:11:21 +03:00
|
|
|
add_executable(test_extra_dupfixed_multiple extra/dupfixed_multiple.c++)
|
|
|
|
target_include_directories(test_extra_dupfixed_multiple PRIVATE "${PROJECT_SOURCE_DIR}")
|
|
|
|
target_link_libraries(test_extra_dupfixed_multiple ${TOOL_MDBX_LIB})
|
|
|
|
if(MDBX_CXX_STANDARD)
|
|
|
|
set_target_properties(test_extra_dupfixed_multiple PROPERTIES
|
|
|
|
CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON)
|
|
|
|
endif()
|
2023-11-24 14:11:41 +03:00
|
|
|
add_executable(test_extra_hex_base64_base58 extra/hex_base64_base58.c++)
|
|
|
|
target_include_directories(test_extra_hex_base64_base58 PRIVATE "${PROJECT_SOURCE_DIR}")
|
|
|
|
target_link_libraries(test_extra_hex_base64_base58 ${TOOL_MDBX_LIB})
|
|
|
|
if(MDBX_CXX_STANDARD)
|
|
|
|
set_target_properties(test_extra_hex_base64_base58 PROPERTIES
|
|
|
|
CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON)
|
|
|
|
endif()
|
2023-11-15 23:38:31 +03:00
|
|
|
add_executable(test_extra_doubtless_positioning extra/doubtless_positioning.c++)
|
|
|
|
target_include_directories(test_extra_doubtless_positioning PRIVATE "${PROJECT_SOURCE_DIR}")
|
|
|
|
target_link_libraries(test_extra_doubtless_positioning ${TOOL_MDBX_LIB})
|
|
|
|
if(MDBX_CXX_STANDARD)
|
|
|
|
set_target_properties(test_extra_doubtless_positioning PROPERTIES
|
|
|
|
CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON)
|
|
|
|
endif()
|
2023-03-30 13:08:52 +03:00
|
|
|
endif()
|
2019-08-31 17:13:02 +03:00
|
|
|
endif()
|
2022-04-21 19:49:57 +03:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
2022-04-21 20:25:04 +03:00
|
|
|
if (CMAKE_CROSSCOMPILING AND NOT CMAKE_CROSSCOMPILING_EMULATOR)
|
|
|
|
message(WARNING "No emulator to run cross-compiled tests")
|
|
|
|
add_test(NAME fake_since_no_crosscompiling_emulator COMMAND ${CMAKE_COMMAND} -E
|
|
|
|
echo "No emulator to run cross-compiled tests")
|
|
|
|
else()
|
2022-04-21 19:49:57 +03:00
|
|
|
|
2022-04-22 22:07:42 +03:00
|
|
|
string(RANDOM LENGTH 9 ALPHABET "1234567890" test_seed)
|
|
|
|
message(STATUS "The ${test_seed} will be used for seeding tests. Re-run cmake to re-seed it.")
|
|
|
|
|
2022-04-21 20:25:04 +03:00
|
|
|
add_test(NAME smoke COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test
|
2022-04-22 09:32:47 +03:00
|
|
|
--loglevel=verbose
|
2024-03-03 17:38:23 +03:00
|
|
|
--prng-seed=${test_seed}
|
2022-04-21 20:25:04 +03:00
|
|
|
--progress --console=no --pathname=smoke.db --dont-cleanup-after basic)
|
|
|
|
set_tests_properties(smoke PROPERTIES
|
|
|
|
TIMEOUT 600
|
|
|
|
RUN_SERIAL OFF)
|
2022-04-22 18:07:51 +03:00
|
|
|
if(MDBX_BUILD_TOOLS)
|
|
|
|
add_test(NAME smoke_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv smoke.db)
|
|
|
|
set_tests_properties(smoke_chk PROPERTIES
|
|
|
|
DEPENDS smoke
|
|
|
|
TIMEOUT 60
|
2023-01-12 01:42:14 +03:00
|
|
|
FAIL_REGULAR_EXPRESSION "cooperative mode"
|
2022-04-22 18:07:51 +03:00
|
|
|
REQUIRED_FILES smoke.db)
|
|
|
|
add_test(NAME smoke_chk_copy COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv smoke.db-copy)
|
|
|
|
set_tests_properties(smoke_chk_copy PROPERTIES
|
|
|
|
DEPENDS smoke
|
|
|
|
TIMEOUT 60
|
2023-01-12 01:42:14 +03:00
|
|
|
FAIL_REGULAR_EXPRESSION "cooperative mode"
|
2022-04-22 18:07:51 +03:00
|
|
|
REQUIRED_FILES smoke.db-copy)
|
|
|
|
endif()
|
2022-04-21 19:49:57 +03:00
|
|
|
|
2022-04-21 20:25:04 +03:00
|
|
|
add_test(NAME dupsort_writemap COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test
|
|
|
|
--loglevel=notice
|
2024-03-03 17:38:23 +03:00
|
|
|
--prng-seed=${test_seed}
|
2024-03-06 11:27:22 +03:00
|
|
|
--table=+data.fixed --keygen.split=29 --datalen=rnd --progress --console=no
|
2022-04-21 20:25:04 +03:00
|
|
|
--repeat=2 --pathname=dupsort_writemap.db --dont-cleanup-after basic)
|
|
|
|
set_tests_properties(dupsort_writemap PROPERTIES
|
2023-11-27 13:23:06 +03:00
|
|
|
TIMEOUT 3600
|
2022-04-21 20:25:04 +03:00
|
|
|
RUN_SERIAL OFF)
|
2022-04-22 18:07:51 +03:00
|
|
|
if(MDBX_BUILD_TOOLS)
|
2023-01-12 01:42:14 +03:00
|
|
|
add_test(NAME dupsort_writemap_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvvwc dupsort_writemap.db)
|
2022-04-22 18:07:51 +03:00
|
|
|
set_tests_properties(dupsort_writemap_chk PROPERTIES
|
|
|
|
DEPENDS dupsort_writemap
|
|
|
|
TIMEOUT 60
|
|
|
|
REQUIRED_FILES dupsort_writemap.db)
|
2023-01-12 01:42:14 +03:00
|
|
|
add_test(NAME dupsort_writemap_chk_copy COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvvc dupsort_writemap.db-copy)
|
2022-04-22 18:07:51 +03:00
|
|
|
set_tests_properties(dupsort_writemap_chk_copy PROPERTIES
|
|
|
|
DEPENDS dupsort_writemap
|
|
|
|
TIMEOUT 60
|
2023-01-12 01:42:14 +03:00
|
|
|
FAIL_REGULAR_EXPRESSION "monopolistic mode"
|
2022-04-22 18:07:51 +03:00
|
|
|
REQUIRED_FILES dupsort_writemap.db-copy)
|
|
|
|
endif()
|
2022-04-21 20:25:04 +03:00
|
|
|
|
|
|
|
add_test(NAME uniq_nested COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test
|
|
|
|
--loglevel=notice
|
|
|
|
--mode=-writemap,-nosync-safe,-lifo --progress --console=no --repeat=2 --pathname=uniq_nested.db --dont-cleanup-after basic)
|
|
|
|
set_tests_properties(uniq_nested PROPERTIES
|
|
|
|
TIMEOUT 1800
|
|
|
|
RUN_SERIAL OFF)
|
2022-04-22 18:07:51 +03:00
|
|
|
if(MDBX_BUILD_TOOLS)
|
2023-01-12 01:42:14 +03:00
|
|
|
add_test(NAME uniq_nested_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvvw uniq_nested.db)
|
2022-04-22 18:07:51 +03:00
|
|
|
set_tests_properties(uniq_nested_chk PROPERTIES
|
|
|
|
DEPENDS uniq_nested
|
|
|
|
TIMEOUT 60
|
2023-01-12 01:42:14 +03:00
|
|
|
FAIL_REGULAR_EXPRESSION "cooperative mode"
|
2022-04-22 18:07:51 +03:00
|
|
|
REQUIRED_FILES uniq_nested.db)
|
|
|
|
add_test(NAME uniq_nested_chk_copy COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv uniq_nested.db-copy)
|
|
|
|
set_tests_properties(uniq_nested_chk_copy PROPERTIES
|
|
|
|
DEPENDS uniq_nested
|
|
|
|
TIMEOUT 60
|
2023-01-12 01:42:14 +03:00
|
|
|
FAIL_REGULAR_EXPRESSION "cooperative mode"
|
2022-04-22 18:07:51 +03:00
|
|
|
REQUIRED_FILES uniq_nested.db-copy)
|
|
|
|
endif()
|
2022-04-21 20:25:04 +03:00
|
|
|
|
2023-10-07 09:08:34 +03:00
|
|
|
if(UNIX AND NOT SUBPROJECT)
|
|
|
|
add_test(NAME extra_upsert_alldups COMMAND test_extra_upsert_alldups)
|
2024-02-20 11:20:09 +03:00
|
|
|
add_test(NAME extra_dupfixed_addodd COMMAND test_extra_dupfixed_addodd)
|
2023-10-07 09:08:34 +03:00
|
|
|
if(MDBX_BUILD_CXX)
|
|
|
|
add_test(NAME extra_maindb_ordinal COMMAND test_extra_maindb_ordinal)
|
|
|
|
add_test(NAME extra_dupfixed_multiple COMMAND test_extra_dupfixed_multiple)
|
2023-11-24 14:11:41 +03:00
|
|
|
add_test(NAME extra_hex_base64_base58 COMMAND test_extra_hex_base64_base58)
|
2023-11-15 23:38:31 +03:00
|
|
|
add_test(NAME extra_doubtless_positioning COMMAND test_extra_doubtless_positioning)
|
2023-11-27 12:52:40 +03:00
|
|
|
if (ENABLE_MEMCHECK)
|
|
|
|
set_tests_properties(extra_doubtless_positioning PROPERTIES TIMEOUT 10800)
|
|
|
|
endif()
|
2023-10-07 09:08:34 +03:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-04-21 20:25:04 +03:00
|
|
|
endif()
|