mdbx-cmake: add a few smoke-like tests.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-04-21 19:49:57 +03:00
parent e875d2128e
commit 03f9ed8820
3 changed files with 58 additions and 2 deletions

View File

@ -112,7 +112,10 @@ else()
endif() endif()
endif() endif()
if(MDBX_AMALGAMATED_SOURCE AND DEFINED MDBX_ENABLE_TESTS AND MDBX_ENABLE_TESTS) if(NOT MDBX_AMALGAMATED_SOURCE)
include(CTest)
option(MDBX_ENABLE_TESTS "Build libmdbx tests." ${BUILD_TESTING})
elseif(DEFINED MDBX_ENABLE_TESTS AND MDBX_ENABLE_TESTS)
message(WARNING "MDBX_ENABLE_TESTS=${MDBX_ENABLE_TESTS}: But amalgamated source code don't includes tests.") message(WARNING "MDBX_ENABLE_TESTS=${MDBX_ENABLE_TESTS}: But amalgamated source code don't includes tests.")
set(MDBX_ENABLE_TESTS OFF) set(MDBX_ENABLE_TESTS OFF)
endif() endif()

View File

@ -392,7 +392,7 @@ smoke: build-test
@echo ' SMOKE `mdbx_test basic`...' @echo ' SMOKE `mdbx_test basic`...'
$(QUIET)rm -f $(TEST_DB) $(TEST_LOG).gz && (set -o pipefail; \ $(QUIET)rm -f $(TEST_DB) $(TEST_LOG).gz && (set -o pipefail; \
(./mdbx_test --table=+data.integer --keygen.split=29 --datalen.min=min --datalen.max=max --progress --console=no --repeat=$(TEST_ITER) --pathname=$(TEST_DB) --dont-cleanup-after $(MDBX_SMOKE_EXTRA) basic && \ (./mdbx_test --table=+data.integer --keygen.split=29 --datalen.min=min --datalen.max=max --progress --console=no --repeat=$(TEST_ITER) --pathname=$(TEST_DB) --dont-cleanup-after $(MDBX_SMOKE_EXTRA) basic && \
./mdbx_test --mode=-writemap,-nosync-safe,-lifo --progress --console=no --repeat=12 --pathname=$(TEST_DB) --dont-cleanup-after $(MDBX_SMOKE_EXTRA) basic) \ ./mdbx_test --mode=-writemap,-nosync-safe,-lifo --progress --console=no --repeat=$(TEST_ITER) --pathname=$(TEST_DB) --dont-cleanup-after $(MDBX_SMOKE_EXTRA) basic) \
| tee >(gzip --stdout >$(TEST_LOG).gz) | tail -n 42) \ | tee >(gzip --stdout >$(TEST_LOG).gz) | tail -n 42) \
&& ./mdbx_chk -vvn $(TEST_DB) && ./mdbx_chk -vvn $(TEST_DB)-copy && ./mdbx_chk -vvn $(TEST_DB) && ./mdbx_chk -vvn $(TEST_DB)-copy

View File

@ -64,3 +64,56 @@ if(UNIX AND NOT SUBPROJECT)
target_include_directories(pcrf_test PRIVATE "${PROJECT_SOURCE_DIR}") target_include_directories(pcrf_test PRIVATE "${PROJECT_SOURCE_DIR}")
target_link_libraries(pcrf_test ${TOOL_MDBX_LIB}) target_link_libraries(pcrf_test ${TOOL_MDBX_LIB})
endif() endif()
################################################################################
add_test(NAME smoke COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test
--progress --console=no --pathname=smoke.db --dont-cleanup-after basic)
set_tests_properties(smoke PROPERTIES
TIMEOUT 600
RUN_SERIAL OFF)
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)
add_test(NAME dupsort_writemap COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test
--loglevel=notice
--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)
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)
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)
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)