2020-09-27 21:49:55 +08:00
|
|
|
enable_language(CXX)
|
|
|
|
include(../cmake/compiler.cmake)
|
|
|
|
|
2021-04-19 22:44:04 +08:00
|
|
|
set(LIBMDBX_TEST_SOURCES
|
2022-11-08 21:17:14 +08: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-09 00:58:18 +08:00
|
|
|
fork.c++
|
2018-11-04 23:57:36 +08:00
|
|
|
)
|
2018-01-04 14:27:09 +08:00
|
|
|
|
2021-04-19 22:44:04 +08:00
|
|
|
if(NOT MDBX_BUILD_CXX)
|
2022-04-08 02:57:49 +08:00
|
|
|
probe_libcxx_filesystem()
|
2021-04-19 22:44:04 +08:00
|
|
|
list(APPEND LIBMDBX_TEST_SOURCES "${MDBX_SOURCE_DIR}/mdbx.c++" ../mdbx.h++)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(mdbx_test ${LIBMDBX_TEST_SOURCES})
|
|
|
|
|
2020-06-26 07:57:46 +08:00
|
|
|
if(MDBX_CXX_STANDARD)
|
|
|
|
set_target_properties(mdbx_test PROPERTIES
|
|
|
|
CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON)
|
|
|
|
endif()
|
|
|
|
|
2019-08-31 22:13:02 +08:00
|
|
|
set_target_properties(mdbx_test PROPERTIES
|
2020-06-26 07:57:46 +08:00
|
|
|
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>)
|
2020-04-15 22:09:37 +08:00
|
|
|
target_setup_options(mdbx_test)
|
2018-01-04 14:27:09 +08:00
|
|
|
|
2022-04-05 22:02:39 +08:00
|
|
|
if(NOT MDBX_BUILD_CXX AND LIBCXX_FILESYSTEM)
|
2022-04-23 04:03:58 +08:00
|
|
|
if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23
|
2022-04-05 23:34:37 +08:00
|
|
|
AND NOT CMAKE_VERSION VERSION_LESS 3.13)
|
|
|
|
target_link_options(mdbx_test PRIVATE "-Wl,--allow-multiple-definition")
|
|
|
|
endif()
|
2022-04-05 22:02:39 +08:00
|
|
|
target_link_libraries(mdbx_test ${LIBCXX_FILESYSTEM})
|
|
|
|
endif()
|
|
|
|
|
2022-11-08 04:37:27 +08: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 22:13:02 +08:00
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
|
|
target_link_libraries(mdbx_test winmm.lib)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(UNIX AND NOT SUBPROJECT)
|
2023-03-04 19:39:21 +08: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 18:08:52 +08: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-07 03:11:21 +08: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-03-30 18:08:52 +08:00
|
|
|
endif()
|
2019-08-31 22:13:02 +08:00
|
|
|
endif()
|
2022-04-22 00:49:57 +08:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
2022-04-22 01:25:04 +08: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-22 00:49:57 +08:00
|
|
|
|
2022-04-23 03:07:42 +08: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-22 01:25:04 +08:00
|
|
|
add_test(NAME smoke COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test
|
2022-04-22 14:32:47 +08:00
|
|
|
--loglevel=verbose
|
2022-04-23 03:07:42 +08:00
|
|
|
--keygen.seed=${test_seed}
|
2022-04-22 01:25:04 +08:00
|
|
|
--progress --console=no --pathname=smoke.db --dont-cleanup-after basic)
|
|
|
|
set_tests_properties(smoke PROPERTIES
|
|
|
|
TIMEOUT 600
|
|
|
|
RUN_SERIAL OFF)
|
2022-04-22 23:07:51 +08: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 06:42:14 +08:00
|
|
|
FAIL_REGULAR_EXPRESSION "cooperative mode"
|
2022-04-22 23:07:51 +08: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 06:42:14 +08:00
|
|
|
FAIL_REGULAR_EXPRESSION "cooperative mode"
|
2022-04-22 23:07:51 +08:00
|
|
|
REQUIRED_FILES smoke.db-copy)
|
|
|
|
endif()
|
2022-04-22 00:49:57 +08:00
|
|
|
|
2022-04-22 01:25:04 +08:00
|
|
|
add_test(NAME dupsort_writemap COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test
|
|
|
|
--loglevel=notice
|
2022-04-23 03:07:42 +08:00
|
|
|
--keygen.seed=${test_seed}
|
2022-04-22 01:25:04 +08:00
|
|
|
--table=+data.integer --keygen.split=29 --datalen.min=min --datalen.max=max --progress --console=no
|
|
|
|
--repeat=2 --pathname=dupsort_writemap.db --dont-cleanup-after basic)
|
|
|
|
set_tests_properties(dupsort_writemap PROPERTIES
|
|
|
|
TIMEOUT 600
|
|
|
|
RUN_SERIAL OFF)
|
2022-04-22 23:07:51 +08:00
|
|
|
if(MDBX_BUILD_TOOLS)
|
2023-01-12 06:42:14 +08:00
|
|
|
add_test(NAME dupsort_writemap_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvvwc dupsort_writemap.db)
|
2022-04-22 23:07:51 +08:00
|
|
|
set_tests_properties(dupsort_writemap_chk PROPERTIES
|
|
|
|
DEPENDS dupsort_writemap
|
|
|
|
TIMEOUT 60
|
|
|
|
REQUIRED_FILES dupsort_writemap.db)
|
2023-01-12 06:42:14 +08:00
|
|
|
add_test(NAME dupsort_writemap_chk_copy COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvvc dupsort_writemap.db-copy)
|
2022-04-22 23:07:51 +08:00
|
|
|
set_tests_properties(dupsort_writemap_chk_copy PROPERTIES
|
|
|
|
DEPENDS dupsort_writemap
|
|
|
|
TIMEOUT 60
|
2023-01-12 06:42:14 +08:00
|
|
|
FAIL_REGULAR_EXPRESSION "monopolistic mode"
|
2022-04-22 23:07:51 +08:00
|
|
|
REQUIRED_FILES dupsort_writemap.db-copy)
|
|
|
|
endif()
|
2022-04-22 01:25:04 +08: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 23:07:51 +08:00
|
|
|
if(MDBX_BUILD_TOOLS)
|
2023-01-12 06:42:14 +08:00
|
|
|
add_test(NAME uniq_nested_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvvw uniq_nested.db)
|
2022-04-22 23:07:51 +08:00
|
|
|
set_tests_properties(uniq_nested_chk PROPERTIES
|
|
|
|
DEPENDS uniq_nested
|
|
|
|
TIMEOUT 60
|
2023-01-12 06:42:14 +08:00
|
|
|
FAIL_REGULAR_EXPRESSION "cooperative mode"
|
2022-04-22 23:07:51 +08: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 06:42:14 +08:00
|
|
|
FAIL_REGULAR_EXPRESSION "cooperative mode"
|
2022-04-22 23:07:51 +08:00
|
|
|
REQUIRED_FILES uniq_nested.db-copy)
|
|
|
|
endif()
|
2022-04-22 01:25:04 +08:00
|
|
|
|
2023-10-07 14:08:34 +08:00
|
|
|
if(UNIX AND NOT SUBPROJECT)
|
|
|
|
add_test(NAME extra_upsert_alldups COMMAND test_extra_upsert_alldups)
|
|
|
|
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)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-04-22 01:25:04 +08:00
|
|
|
endif()
|