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
|
2018-11-04 23:57:36 +08:00
|
|
|
base.h
|
|
|
|
cases.cc
|
|
|
|
chrono.cc
|
|
|
|
chrono.h
|
|
|
|
config.cc
|
|
|
|
config.h
|
|
|
|
copy.cc
|
|
|
|
dead.cc
|
|
|
|
hill.cc
|
|
|
|
jitter.cc
|
|
|
|
keygen.cc
|
|
|
|
keygen.h
|
|
|
|
log.cc
|
|
|
|
log.h
|
|
|
|
main.cc
|
|
|
|
osal.h
|
2020-04-15 22:09:37 +08:00
|
|
|
osal-unix.cc
|
|
|
|
osal-windows.cc
|
2018-11-04 23:57:36 +08:00
|
|
|
test.cc
|
|
|
|
test.h
|
|
|
|
try.cc
|
|
|
|
utils.cc
|
|
|
|
utils.h
|
2019-02-04 03:37:57 +08:00
|
|
|
append.cc
|
2019-06-22 03:42:45 +08:00
|
|
|
ttl.cc
|
2019-10-10 04:38:44 +08:00
|
|
|
nested.cc
|
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-05 23:34:37 +08:00
|
|
|
if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.26.0
|
|
|
|
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()
|
|
|
|
|
2020-04-15 22:09:37 +08:00
|
|
|
target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} ${CMAKE_THREAD_LIBS_INIT})
|
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)
|
2020-04-15 22:09:37 +08:00
|
|
|
add_executable(pcrf_test pcrf/pcrf_test.c)
|
|
|
|
target_include_directories(pcrf_test PRIVATE "${PROJECT_SOURCE_DIR}")
|
|
|
|
target_link_libraries(pcrf_test ${TOOL_MDBX_LIB})
|
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
|
|
|
|
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
|
|
|
|
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)
|
|
|
|
add_test(NAME dupsort_writemap_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv dupsort_writemap.db)
|
|
|
|
set_tests_properties(dupsort_writemap_chk PROPERTIES
|
|
|
|
DEPENDS dupsort_writemap
|
|
|
|
TIMEOUT 60
|
|
|
|
REQUIRED_FILES dupsort_writemap.db)
|
|
|
|
add_test(NAME dupsort_writemap_chk_copy COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv dupsort_writemap.db-copy)
|
|
|
|
set_tests_properties(dupsort_writemap_chk_copy PROPERTIES
|
|
|
|
DEPENDS dupsort_writemap
|
|
|
|
TIMEOUT 60
|
|
|
|
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)
|
|
|
|
add_test(NAME uniq_nested_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv uniq_nested.db)
|
|
|
|
set_tests_properties(uniq_nested_chk PROPERTIES
|
|
|
|
DEPENDS uniq_nested
|
|
|
|
TIMEOUT 60
|
|
|
|
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
|
|
|
|
REQUIRED_FILES uniq_nested.db-copy)
|
|
|
|
endif()
|
2022-04-22 01:25:04 +08:00
|
|
|
|
|
|
|
endif()
|