mdbx-cmake: переформатирование cmake-скриптов.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2024-11-13 15:03:16 +03:00
parent 5862a4b542
commit a2984c604d
5 changed files with 1344 additions and 749 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
## Copyright (c) 2012-2024 Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> # Copyright (c) 2012-2024 Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru>
## SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if(CMAKE_VERSION VERSION_LESS 3.8.2) if(CMAKE_VERSION VERSION_LESS 3.8.2)
cmake_minimum_required(VERSION 3.0.2) cmake_minimum_required(VERSION 3.0.2)
@ -14,7 +14,7 @@ cmake_policy(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
unset(MEMCHECK_OPTION_NAME) unset(MEMCHECK_OPTION_NAME)
if(NOT DEFINED ENABLE_MEMCHECK) if(NOT DEFINED ENABLE_MEMCHECK)
if (DEFINED MDBX_USE_VALGRIND) if(DEFINED MDBX_USE_VALGRIND)
set(MEMCHECK_OPTION_NAME "MDBX_USE_VALGRIND") set(MEMCHECK_OPTION_NAME "MDBX_USE_VALGRIND")
elseif(DEFINED ENABLE_VALGRIND) elseif(DEFINED ENABLE_VALGRIND)
set(MEMCHECK_OPTION_NAME "ENABLE_VALGRIND") set(MEMCHECK_OPTION_NAME "ENABLE_VALGRIND")
@ -23,7 +23,7 @@ if(NOT DEFINED ENABLE_MEMCHECK)
endif() endif()
if(MEMCHECK_OPTION_NAME STREQUAL "ENABLE_MEMCHECK") if(MEMCHECK_OPTION_NAME STREQUAL "ENABLE_MEMCHECK")
option(ENABLE_MEMCHECK option(ENABLE_MEMCHECK
"Enable integration with valgrind, a memory analyzing tool" OFF) "Enable integration with valgrind, a memory analyzing tool" OFF)
elseif(${MEMCHECK_OPTION_NAME}) elseif(${MEMCHECK_OPTION_NAME})
set(ENABLE_MEMCHECK ON) set(ENABLE_MEMCHECK ON)
else() else()
@ -34,17 +34,20 @@ endif()
include(CheckLibraryExists) include(CheckLibraryExists)
check_library_exists(gcov __gcov_flush "" HAVE_GCOV) check_library_exists(gcov __gcov_flush "" HAVE_GCOV)
option(ENABLE_GCOV option(ENABLE_GCOV "Enable integration with gcov, a code coverage program" OFF)
"Enable integration with gcov, a code coverage program" OFF)
option(ENABLE_GPROF option(ENABLE_GPROF
"Enable integration with gprof, a performance analyzing tool" OFF) "Enable integration with gprof, a performance analyzing tool" OFF)
option(ENABLE_ASAN option(
"Enable AddressSanitizer, a fast memory error detector based on compiler instrumentation" OFF) ENABLE_ASAN
"Enable AddressSanitizer, a fast memory error detector based on compiler instrumentation"
OFF)
option(ENABLE_UBSAN option(
"Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector based on compiler instrumentation" OFF) ENABLE_UBSAN
"Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector based on compiler instrumentation"
OFF)
if(ENABLE_MEMCHECK) if(ENABLE_MEMCHECK)
if(CMAKE_CXX_COMPILER_LOADED) if(CMAKE_CXX_COMPILER_LOADED)
@ -55,7 +58,10 @@ if(ENABLE_MEMCHECK)
check_include_file(valgrind/memcheck.h HAVE_VALGRIND_MEMCHECK_H) check_include_file(valgrind/memcheck.h HAVE_VALGRIND_MEMCHECK_H)
endif() endif()
if(NOT HAVE_VALGRIND_MEMCHECK_H) if(NOT HAVE_VALGRIND_MEMCHECK_H)
message(FATAL_ERROR "${MEMCHECK_OPTION_NAME} option is set but valgrind/memcheck.h is not found") message(
FATAL_ERROR
"${MEMCHECK_OPTION_NAME} option is set but valgrind/memcheck.h is not found"
)
endif() endif()
endif() endif()

View File

@ -1,5 +1,5 @@
## Copyright (c) 2012-2024 Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> # Copyright (c) 2012-2024 Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru>
## SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if(CMAKE_VERSION VERSION_LESS 3.8.2) if(CMAKE_VERSION VERSION_LESS 3.8.2)
cmake_minimum_required(VERSION 3.0.2) cmake_minimum_required(VERSION 3.0.2)
@ -27,8 +27,10 @@ macro(add_compile_flags languages)
endmacro(add_compile_flags) endmacro(add_compile_flags)
macro(remove_flag varname flag) macro(remove_flag varname flag)
string(REGEX REPLACE "^(.*)( ${flag} )(.*)$" "\\1 \\3" ${varname} ${${varname}}) string(REGEX REPLACE "^(.*)( ${flag} )(.*)$" "\\1 \\3" ${varname}
string(REGEX REPLACE "^((.+ )*)(${flag})(( .+)*)$" "\\1\\4" ${varname} ${${varname}}) ${${varname}})
string(REGEX REPLACE "^((.+ )*)(${flag})(( .+)*)$" "\\1\\4" ${varname}
${${varname}})
endmacro(remove_flag) endmacro(remove_flag)
macro(remove_compile_flag languages flag) macro(remove_compile_flag languages flag)
@ -49,9 +51,9 @@ macro(set_source_files_compile_flags)
set(_lang "") set(_lang "")
if("${_file_ext}" STREQUAL ".m") if("${_file_ext}" STREQUAL ".m")
set(_lang OBJC) set(_lang OBJC)
# CMake believes that Objective C is a flavor of C++, not C, # CMake believes that Objective C is a flavor of C++, not C, and uses g++
# and uses g++ compiler for .m files. # compiler for .m files. LANGUAGE property forces CMake to use CC for
# LANGUAGE property forces CMake to use CC for ${file} # ${file}
set_source_files_properties(${file} PROPERTIES LANGUAGE C) set_source_files_properties(${file} PROPERTIES LANGUAGE C)
elseif("${_file_ext}" STREQUAL ".mm") elseif("${_file_ext}" STREQUAL ".mm")
set(_lang OBJCXX) set(_lang OBJCXX)
@ -65,15 +67,15 @@ macro(set_source_files_compile_flags)
set(_flags "${_flags} ${CMAKE_${_lang}_FLAGS}") set(_flags "${_flags} ${CMAKE_${_lang}_FLAGS}")
endif() endif()
# message(STATUS "Set (${file} ${_flags}") # message(STATUS "Set (${file} ${_flags}")
set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS "${_flags}")
"${_flags}")
endif() endif()
endforeach() endforeach()
unset(_file_ext) unset(_file_ext)
unset(_lang) unset(_lang)
endmacro(set_source_files_compile_flags) endmacro(set_source_files_compile_flags)
macro(fetch_version name source_root_directory parent_scope build_directory_for_json_output) macro(fetch_version name source_root_directory parent_scope
build_directory_for_json_output)
set(_version_4dot "") set(_version_4dot "")
set(_git_describe "") set(_git_describe "")
set(_git_timestamp "") set(_git_timestamp "")
@ -86,7 +88,8 @@ macro(fetch_version name source_root_directory parent_scope build_directory_for_
find_program(GIT git) find_program(GIT git)
if(GIT) if(GIT)
execute_process(COMMAND ${GIT} rev-parse --show-toplevel execute_process(
COMMAND ${GIT} rev-parse --show-toplevel
OUTPUT_VARIABLE _git_root OUTPUT_VARIABLE _git_root
ERROR_VARIABLE _git_root_error ERROR_VARIABLE _git_root_error
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
@ -94,9 +97,11 @@ macro(fetch_version name source_root_directory parent_scope build_directory_for_
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc OR _git_root STREQUAL "") if(_rc OR _git_root STREQUAL "")
if(EXISTS "${source_root_directory}/.git") if(EXISTS "${source_root_directory}/.git")
message(ERROR "`git rev-parse --show-toplevel` failed '${_git_root_error}'") message(ERROR
"`git rev-parse --show-toplevel` failed '${_git_root_error}'")
else() else()
message(VERBOSE "`git rev-parse --show-toplevel` failed '${_git_root_error}'") message(VERBOSE
"`git rev-parse --show-toplevel` failed '${_git_root_error}'")
endif() endif()
else() else()
set(_source_root "${source_root_directory}") set(_source_root "${source_root_directory}")
@ -105,7 +110,10 @@ macro(fetch_version name source_root_directory parent_scope build_directory_for_
cmake_path(NORMAL_PATH _source_root) cmake_path(NORMAL_PATH _source_root)
endif() endif()
if(_source_root STREQUAL _git_root AND EXISTS "${_git_root}/VERSION.json") if(_source_root STREQUAL _git_root AND EXISTS "${_git_root}/VERSION.json")
message(FATAL_ERROR "Несколько источников информации о версии, допустим только один из: репозиторий git, либо файл VERSION.json") message(
FATAL_ERROR
"Несколько источников информации о версии, допустим только один из: репозиторий git, либо файл VERSION.json"
)
endif() endif()
endif() endif()
endif() endif()
@ -114,9 +122,14 @@ macro(fetch_version name source_root_directory parent_scope build_directory_for_
set(_version_from "${source_root_directory}/VERSION.json") set(_version_from "${source_root_directory}/VERSION.json")
if(CMAKE_VERSION VERSION_LESS 3.19) if(CMAKE_VERSION VERSION_LESS 3.19)
message(FATAL_ERROR "Требуется CMake версии >= 3.19 для чтения VERSION.json") message(
FATAL_ERROR "Требуется CMake версии >= 3.19 для чтения VERSION.json")
endif() endif()
file(STRINGS "${_version_from}" _versioninfo_json NEWLINE_CONSUME LIMIT_COUNT 9 LIMIT_INPUT 999 ENCODING UTF-8) file(
STRINGS "${_version_from}" _versioninfo_json NEWLINE_CONSUME
LIMIT_COUNT 9
LIMIT_INPUT 999
ENCODING UTF-8)
string(JSON _git_describe GET ${_versioninfo_json} git_describe) string(JSON _git_describe GET ${_versioninfo_json} git_describe)
string(JSON _git_timestamp GET "${_versioninfo_json}" "git_timestamp") string(JSON _git_timestamp GET "${_versioninfo_json}" "git_timestamp")
string(JSON _git_tree GET "${_versioninfo_json}" "git_tree") string(JSON _git_tree GET "${_versioninfo_json}" "git_tree")
@ -126,7 +139,9 @@ macro(fetch_version name source_root_directory parent_scope build_directory_for_
string(REPLACE "." ";" _version_list "${_version_4dot}") string(REPLACE "." ";" _version_list "${_version_4dot}")
if(NOT _version_4dot) if(NOT _version_4dot)
message(ERROR "Unable to retrieve ${name} version from \"${_version_from}\" file.") message(
ERROR
"Unable to retrieve ${name} version from \"${_version_from}\" file.")
set(_version_list ${_git_version}) set(_version_list ${_git_version})
string(REPLACE ";" "." _version_4dot "${_git_version}") string(REPLACE ";" "." _version_4dot "${_git_version}")
else() else()
@ -136,158 +151,221 @@ macro(fetch_version name source_root_directory parent_scope build_directory_for_
elseif(_git_root AND _source_root STREQUAL _git_root) elseif(_git_root AND _source_root STREQUAL _git_root)
set(_version_from git) set(_version_from git)
execute_process(COMMAND ${GIT} show --no-patch --format=%cI HEAD execute_process(
COMMAND ${GIT} show --no-patch --format=%cI HEAD
OUTPUT_VARIABLE _git_timestamp OUTPUT_VARIABLE _git_timestamp
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc OR _git_timestamp STREQUAL "%cI") if(_rc OR _git_timestamp STREQUAL "%cI")
execute_process(COMMAND ${GIT} show --no-patch --format=%ci HEAD execute_process(
COMMAND ${GIT} show --no-patch --format=%ci HEAD
OUTPUT_VARIABLE _git_timestamp OUTPUT_VARIABLE _git_timestamp
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc OR _git_timestamp STREQUAL "%ci") if(_rc OR _git_timestamp STREQUAL "%ci")
message(FATAL_ERROR "Please install latest version of git (`show --no-patch --format=%cI HEAD` failed)") message(
FATAL_ERROR
"Please install latest version of git (`show --no-patch --format=%cI HEAD` failed)"
)
endif() endif()
endif() endif()
execute_process(COMMAND ${GIT} show --no-patch --format=%T HEAD execute_process(
COMMAND ${GIT} show --no-patch --format=%T HEAD
OUTPUT_VARIABLE _git_tree OUTPUT_VARIABLE _git_tree
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc OR _git_tree STREQUAL "") if(_rc OR _git_tree STREQUAL "")
message(FATAL_ERROR "Please install latest version of git (`show --no-patch --format=%T HEAD` failed)") message(
FATAL_ERROR
"Please install latest version of git (`show --no-patch --format=%T HEAD` failed)"
)
endif() endif()
execute_process(COMMAND ${GIT} show --no-patch --format=%H HEAD execute_process(
COMMAND ${GIT} show --no-patch --format=%H HEAD
OUTPUT_VARIABLE _git_commit OUTPUT_VARIABLE _git_commit
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc OR _git_commit STREQUAL "") if(_rc OR _git_commit STREQUAL "")
message(FATAL_ERROR "Please install latest version of git (`show --no-patch --format=%H HEAD` failed)") message(
FATAL_ERROR
"Please install latest version of git (`show --no-patch --format=%H HEAD` failed)"
)
endif() endif()
execute_process(COMMAND ${GIT} status --untracked-files=no --porcelain execute_process(
COMMAND ${GIT} status --untracked-files=no --porcelain
OUTPUT_VARIABLE _git_status OUTPUT_VARIABLE _git_status
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc) if(_rc)
message(FATAL_ERROR "Please install latest version of git (`status --untracked-files=no --porcelain` failed)") message(
FATAL_ERROR
"Please install latest version of git (`status --untracked-files=no --porcelain` failed)"
)
endif() endif()
if(NOT _git_status STREQUAL "") if(NOT _git_status STREQUAL "")
set(_git_commit "${_git_commit}-dirty") set(_git_commit "${_git_commit}-dirty")
endif() endif()
unset(_git_status) unset(_git_status)
execute_process(COMMAND ${GIT} rev-list --tags --count execute_process(
COMMAND ${GIT} rev-list --tags --count
OUTPUT_VARIABLE _tag_count OUTPUT_VARIABLE _tag_count
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc) if(_rc)
message(FATAL_ERROR "Please install latest version of git (`git rev-list --tags --count` failed)") message(
FATAL_ERROR
"Please install latest version of git (`git rev-list --tags --count` failed)"
)
endif() endif()
if(_tag_count EQUAL 0) if(_tag_count EQUAL 0)
execute_process(COMMAND ${GIT} rev-list --all --count execute_process(
COMMAND ${GIT} rev-list --all --count
OUTPUT_VARIABLE _whole_count OUTPUT_VARIABLE _whole_count
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc) if(_rc)
message(FATAL_ERROR "Please install latest version of git (`git rev-list --all --count` failed)") message(
FATAL_ERROR
"Please install latest version of git (`git rev-list --all --count` failed)"
)
endif() endif()
if(_whole_count GREATER 42) if(_whole_count GREATER 42)
message(FATAL_ERROR "Please fetch tags (no any tags for ${_whole_count} commits)") message(
FATAL_ERROR
"Please fetch tags (no any tags for ${_whole_count} commits)")
endif() endif()
set(_git_version "0;0;0") set(_git_version "0;0;0")
execute_process(COMMAND ${GIT} rev-list --count --all --no-merges execute_process(
COMMAND ${GIT} rev-list --count --all --no-merges
OUTPUT_VARIABLE _git_revision OUTPUT_VARIABLE _git_revision
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc OR _git_revision STREQUAL "") if(_rc OR _git_revision STREQUAL "")
message(FATAL_ERROR "Please install latest version of git (`rev-list --count --all --no-merges` failed)") message(
FATAL_ERROR
"Please install latest version of git (`rev-list --count --all --no-merges` failed)"
)
endif() endif()
else(_tag_count EQUAL 0) else(_tag_count EQUAL 0)
execute_process(COMMAND ${GIT} describe --tags --long --dirty=-dirty "--match=v[0-9]*" execute_process(
COMMAND ${GIT} describe --tags --long --dirty=-dirty "--match=v[0-9]*"
OUTPUT_VARIABLE _git_describe OUTPUT_VARIABLE _git_describe
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc OR _git_describe STREQUAL "") if(_rc OR _git_describe STREQUAL "")
execute_process(COMMAND ${GIT} rev-list --all --count execute_process(
COMMAND ${GIT} rev-list --all --count
OUTPUT_VARIABLE _whole_count OUTPUT_VARIABLE _whole_count
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc) if(_rc)
message(FATAL_ERROR "Please install latest version of git (`git rev-list --all --count` failed)") message(
FATAL_ERROR
"Please install latest version of git (`git rev-list --all --count` failed)"
)
endif() endif()
if(_whole_count GREATER 42) if(_whole_count GREATER 42)
message(FATAL_ERROR "Please fetch tags (`describe --tags --long --dirty --match=v[0-9]*` failed)") message(
FATAL_ERROR
"Please fetch tags (`describe --tags --long --dirty --match=v[0-9]*` failed)"
)
else() else()
execute_process(COMMAND ${GIT} describe --all --long --dirty=-dirty execute_process(
COMMAND ${GIT} describe --all --long --dirty=-dirty
OUTPUT_VARIABLE _git_describe OUTPUT_VARIABLE _git_describe
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc OR _git_describe STREQUAL "") if(_rc OR _git_describe STREQUAL "")
message(FATAL_ERROR "Please install latest version of git (`git rev-list --tags --count` and/or `git rev-list --all --count` failed)") message(
FATAL_ERROR
"Please install latest version of git (`git rev-list --tags --count` and/or `git rev-list --all --count` failed)"
)
endif() endif()
endif() endif()
endif() endif()
execute_process(COMMAND ${GIT} describe --tags --abbrev=0 "--match=v[0-9]*" execute_process(
COMMAND ${GIT} describe --tags --abbrev=0 "--match=v[0-9]*"
OUTPUT_VARIABLE _last_release_tag OUTPUT_VARIABLE _last_release_tag
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc) if(_rc)
message(FATAL_ERROR "Please install latest version of git (`describe --tags --abbrev=0 --match=v[0-9]*` failed)") message(
FATAL_ERROR
"Please install latest version of git (`describe --tags --abbrev=0 --match=v[0-9]*` failed)"
)
endif() endif()
if (_last_release_tag) if(_last_release_tag)
set(_git_revlist_arg "${_last_release_tag}..HEAD") set(_git_revlist_arg "${_last_release_tag}..HEAD")
else() else()
execute_process(COMMAND ${GIT} tag --sort=-version:refname execute_process(
COMMAND ${GIT} tag --sort=-version:refname
OUTPUT_VARIABLE _tag_list OUTPUT_VARIABLE _tag_list
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc) if(_rc)
message(FATAL_ERROR "Please install latest version of git (`tag --sort=-version:refname` failed)") message(
FATAL_ERROR
"Please install latest version of git (`tag --sort=-version:refname` failed)"
)
endif() endif()
string(REGEX REPLACE "\n" ";" _tag_list "${_tag_list}") string(REGEX REPLACE "\n" ";" _tag_list "${_tag_list}")
set(_git_revlist_arg "HEAD") set(_git_revlist_arg "HEAD")
foreach(_tag IN LISTS _tag_list) foreach(_tag IN LISTS _tag_list)
if(NOT _last_release_tag) if(NOT _last_release_tag)
string(REGEX MATCH "^v[0-9]+(\.[0-9]+)+" _last_release_tag "${_tag}") string(REGEX MATCH "^v[0-9]+(\.[0-9]+)+" _last_release_tag
"${_tag}")
set(_git_revlist_arg "${_tag}..HEAD") set(_git_revlist_arg "${_tag}..HEAD")
endif() endif()
endforeach(_tag) endforeach(_tag)
endif() endif()
execute_process(COMMAND ${GIT} rev-list --count "${_git_revlist_arg}" execute_process(
COMMAND ${GIT} rev-list --count "${_git_revlist_arg}"
OUTPUT_VARIABLE _git_revision OUTPUT_VARIABLE _git_revision
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${source_root_directory} WORKING_DIRECTORY ${source_root_directory}
RESULT_VARIABLE _rc) RESULT_VARIABLE _rc)
if(_rc OR _git_revision STREQUAL "") if(_rc OR _git_revision STREQUAL "")
message(FATAL_ERROR "Please install latest version of git (`rev-list --count ${_git_revlist_arg}` failed)") message(
FATAL_ERROR
"Please install latest version of git (`rev-list --count ${_git_revlist_arg}` failed)"
)
endif() endif()
string(REGEX MATCH "^(v)?([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" _git_version_valid "${_git_describe}") string(REGEX MATCH "^(v)?([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?"
_git_version_valid "${_git_describe}")
if(_git_version_valid) if(_git_version_valid)
string(REGEX REPLACE "^(v)?([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" "\\2;\\3;\\4" _git_version ${_git_describe}) string(REGEX REPLACE "^(v)?([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?"
"\\2;\\3;\\4" _git_version ${_git_describe})
else() else()
string(REGEX MATCH "^(v)?([0-9]+)\\.([0-9]+)(.*)?" _git_version_valid "${_git_describe}") string(REGEX MATCH "^(v)?([0-9]+)\\.([0-9]+)(.*)?" _git_version_valid
"${_git_describe}")
if(_git_version_valid) if(_git_version_valid)
string(REGEX REPLACE "^(v)?([0-9]+)\\.([0-9]+)(.*)?" "\\2;\\3;0" _git_version ${_git_describe}) string(REGEX REPLACE "^(v)?([0-9]+)\\.([0-9]+)(.*)?" "\\2;\\3;0"
_git_version ${_git_describe})
else() else()
message(AUTHOR_WARNING "Bad ${name} version \"${_git_describe}\"; falling back to 0.0.0 (have you made an initial release?)") message(
AUTHOR_WARNING
"Bad ${name} version \"${_git_describe}\"; falling back to 0.0.0 (have you made an initial release?)"
)
set(_git_version "0;0;0") set(_git_version "0;0;0")
endif() endif()
endif() endif()
@ -298,7 +376,10 @@ macro(fetch_version name source_root_directory parent_scope build_directory_for_
string(REPLACE ";" "." _version_4dot "${_version_list}") string(REPLACE ";" "." _version_4dot "${_version_list}")
elseif(GIT) elseif(GIT)
message(FATAL_ERROR "Нет источника информации о версии (${source_root_directory}), требуется один из: репозиторий git, либо VERSION.json") message(
FATAL_ERROR
"Нет источника информации о версии (${source_root_directory}), требуется один из: репозиторий git, либо VERSION.json"
)
else() else()
message(FATAL_ERROR "Требуется git для получения информации о версии") message(FATAL_ERROR "Требуется git для получения информации о версии")
endif() endif()
@ -309,24 +390,53 @@ macro(fetch_version name source_root_directory parent_scope build_directory_for_
list(GET _version_list 2 _version_release) list(GET _version_list 2 _version_release)
list(GET _version_list 3 _version_revision) list(GET _version_list 3 _version_revision)
if(NOT _git_describe OR NOT _git_timestamp OR NOT _git_tree OR NOT _git_commit OR _git_revision STREQUAL "" OR NOT _version_list_length EQUAL 4 OR _version_major STREQUAL "" OR _version_minor STREQUAL "" OR _version_release STREQUAL "" OR _version_revision STREQUAL "") if(NOT _git_describe
OR NOT _git_timestamp
OR NOT _git_tree
OR NOT _git_commit
OR _git_revision STREQUAL ""
OR NOT _version_list_length EQUAL 4
OR _version_major STREQUAL ""
OR _version_minor STREQUAL ""
OR _version_release STREQUAL ""
OR _version_revision STREQUAL "")
message(ERROR "Unable to retrieve ${name} version from ${_version_from}.") message(ERROR "Unable to retrieve ${name} version from ${_version_from}.")
else() else()
list(APPEND _git_version "${_git_revision}") list(APPEND _git_version "${_git_revision}")
endif() endif()
if(${parent_scope}) if(${parent_scope})
set(${name}_VERSION_MAJOR "${_version_major}" PARENT_SCOPE) set(${name}_VERSION_MAJOR
set(${name}_VERSION_MINOR "${_version_minor}" PARENT_SCOPE) "${_version_major}"
set(${name}_VERSION_RELEASE "${_version_release}" PARENT_SCOPE) PARENT_SCOPE)
set(${name}_VERSION_REVISION "${_version_revision}" PARENT_SCOPE) set(${name}_VERSION_MINOR
set(${name}_VERSION "${_version_4dot}" PARENT_SCOPE) "${_version_minor}"
PARENT_SCOPE)
set(${name}_VERSION_RELEASE
"${_version_release}"
PARENT_SCOPE)
set(${name}_VERSION_REVISION
"${_version_revision}"
PARENT_SCOPE)
set(${name}_VERSION
"${_version_4dot}"
PARENT_SCOPE)
set(${name}_GIT_DESCRIBE "${_git_describe}" PARENT_SCOPE) set(${name}_GIT_DESCRIBE
set(${name}_GIT_TIMESTAMP "${_git_timestamp}" PARENT_SCOPE) "${_git_describe}"
set(${name}_GIT_TREE "${_git_tree}" PARENT_SCOPE) PARENT_SCOPE)
set(${name}_GIT_COMMIT "${_git_commit}" PARENT_SCOPE) set(${name}_GIT_TIMESTAMP
set(${name}_GIT_REVISION "${_git_revision}" PARENT_SCOPE) "${_git_timestamp}"
PARENT_SCOPE)
set(${name}_GIT_TREE
"${_git_tree}"
PARENT_SCOPE)
set(${name}_GIT_COMMIT
"${_git_commit}"
PARENT_SCOPE)
set(${name}_GIT_REVISION
"${_git_revision}"
PARENT_SCOPE)
else() else()
set(${name}_VERSION_MAJOR "${_version_major}") set(${name}_VERSION_MAJOR "${_version_major}")
set(${name}_VERSION_MINOR "${_version_minor}") set(${name}_VERSION_MINOR "${_version_minor}")
@ -342,13 +452,18 @@ macro(fetch_version name source_root_directory parent_scope build_directory_for_
endif() endif()
if(_version_from STREQUAL "git") if(_version_from STREQUAL "git")
string(CONFIGURE "{ string(
CONFIGURE
"{
\"git_describe\" : \"@_git_describe@\", \"git_describe\" : \"@_git_describe@\",
\"git_timestamp\" : \"@_git_timestamp@\", \"git_timestamp\" : \"@_git_timestamp@\",
\"git_tree\" : \"@_git_tree@\", \"git_tree\" : \"@_git_tree@\",
\"git_commit\" : \"@_git_commit@\", \"git_commit\" : \"@_git_commit@\",
\"version_4dot\" : \"@_version_4dot@\"\n}" _versioninfo_json @ONLY ESCAPE_QUOTES) \"version_4dot\" : \"@_version_4dot@\"\n}"
file(WRITE "${build_directory_for_json_output}/VERSION.json" "${_versioninfo_json}") _versioninfo_json
@ONLY ESCAPE_QUOTES)
file(WRITE "${build_directory_for_json_output}/VERSION.json"
"${_versioninfo_json}")
endif() endif()
endmacro(fetch_version) endmacro(fetch_version)

View File

@ -1,38 +1,37 @@
## Copyright (c) 2020-2024 Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> # Copyright (c) 2020-2024 Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru>
## SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
enable_language(CXX) enable_language(CXX)
include(../cmake/compiler.cmake) include(../cmake/compiler.cmake)
set(LIBMDBX_TEST_SOURCES set(LIBMDBX_TEST_SOURCES
base.h++ base.h++
cases.c++ cases.c++
chrono.c++ chrono.c++
chrono.h++ chrono.h++
config.c++ config.c++
config.h++ config.h++
copy.c++ copy.c++
dead.c++ dead.c++
hill.c++ hill.c++
jitter.c++ jitter.c++
keygen.c++ keygen.c++
keygen.h++ keygen.h++
log.c++ log.c++
log.h++ log.h++
main.c++ main.c++
osal.h++ osal.h++
osal-unix.c++ osal-unix.c++
osal-windows.c++ osal-windows.c++
test.c++ test.c++
test.h++ test.h++
try.c++ try.c++
utils.c++ utils.c++
utils.h++ utils.h++
append.c++ append.c++
ttl.c++ ttl.c++
nested.c++ nested.c++
fork.c++ fork.c++)
)
if(NOT MDBX_BUILD_CXX) if(NOT MDBX_BUILD_CXX)
probe_libcxx_filesystem() probe_libcxx_filesystem()
@ -43,12 +42,13 @@ add_executable(mdbx_test ${LIBMDBX_TEST_SOURCES})
target_compile_definitions(mdbx_test PRIVATE MDBX_BUILD_TEST=1 MDBX_BUILD_CXX=1) target_compile_definitions(mdbx_test PRIVATE MDBX_BUILD_TEST=1 MDBX_BUILD_CXX=1)
if(MDBX_CXX_STANDARD) if(MDBX_CXX_STANDARD)
set_target_properties(mdbx_test PROPERTIES set_target_properties(mdbx_test PROPERTIES CXX_STANDARD ${MDBX_CXX_STANDARD}
CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON) CXX_STANDARD_REQUIRED ON)
endif() endif()
set_target_properties(mdbx_test PROPERTIES set_target_properties(
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>) mdbx_test PROPERTIES INTERPROCEDURAL_OPTIMIZATION
$<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>)
target_setup_options(mdbx_test) target_setup_options(mdbx_test)
if(NOT MDBX_BUILD_CXX) if(NOT MDBX_BUILD_CXX)
@ -59,15 +59,17 @@ if(NOT MDBX_BUILD_CXX)
endif() endif()
if(NOT MDBX_BUILD_CXX AND LIBCXX_FILESYSTEM) if(NOT MDBX_BUILD_CXX AND LIBCXX_FILESYSTEM)
if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23 if(CMAKE_COMPILER_IS_ELBRUSCXX
AND NOT CMAKE_VERSION VERSION_LESS 3.13) AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23
AND NOT CMAKE_VERSION VERSION_LESS 3.13)
target_link_options(mdbx_test PRIVATE "-Wl,--allow-multiple-definition") target_link_options(mdbx_test PRIVATE "-Wl,--allow-multiple-definition")
endif() endif()
target_link_libraries(mdbx_test ${LIBCXX_FILESYSTEM}) target_link_libraries(mdbx_test ${LIBCXX_FILESYSTEM})
endif() endif()
if(CMAKE_VERSION VERSION_LESS 3.1) if(CMAKE_VERSION VERSION_LESS 3.1)
target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH}
${CMAKE_THREAD_LIBS_INIT})
else() else()
target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} Threads::Threads) target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} Threads::Threads)
endif() endif()
@ -79,10 +81,14 @@ function(add_extra_test name)
set(options DISABLED) set(options DISABLED)
set(oneValueArgs TIMEOUT) set(oneValueArgs TIMEOUT)
set(multiValueArgs SOURCE LIBRARY DEPEND DLLPATH) set(multiValueArgs SOURCE LIBRARY DEPEND DLLPATH)
cmake_parse_arguments(params "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) cmake_parse_arguments(params "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(params_UNPARSED_ARGUMENTS) if(params_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to add_extra_test(): \"${params_UNPARSED_ARGUMENTS}\".") message(
FATAL_ERROR
"Unknown keywords given to add_extra_test(): \"${params_UNPARSED_ARGUMENTS}\"."
)
endif() endif()
macro(oops) macro(oops)
@ -97,13 +103,12 @@ function(add_extra_test name)
add_executable(${target} ${params_SOURCE}) add_executable(${target} ${params_SOURCE})
target_include_directories(${target} PRIVATE "${PROJECT_SOURCE_DIR}") target_include_directories(${target} PRIVATE "${PROJECT_SOURCE_DIR}")
target_link_libraries(${target} ${TOOL_MDBX_LIB}) target_link_libraries(${target} ${TOOL_MDBX_LIB})
set_target_properties(${target} PROPERTIES set_target_properties(${target} PROPERTIES SKIP_BUILD_RPATH FALSE
SKIP_BUILD_RPATH FALSE BUILD_WITH_INSTALL_RPATH FALSE)
BUILD_WITH_INSTALL_RPATH FALSE)
if(MDBX_BUILD_CXX AND MDBX_CXX_STANDARD) if(MDBX_BUILD_CXX AND MDBX_CXX_STANDARD)
set_target_properties(${target} PROPERTIES set_target_properties(${target} PROPERTIES CXX_STANDARD ${MDBX_CXX_STANDARD}
CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON) CXX_STANDARD_REQUIRED ON)
endif() endif()
if(params_DEPEND) if(params_DEPEND)
@ -115,26 +120,32 @@ function(add_extra_test name)
foreach(dep IN LISTS params_LIBRARY) foreach(dep IN LISTS params_LIBRARY)
get_target_property(type ${dep} TYPE) get_target_property(type ${dep} TYPE)
if(type STREQUAL SHARED_LIBRARY) if(type STREQUAL SHARED_LIBRARY)
# Windows don't have RPATH feature, # Windows don't have RPATH feature, therefore we should prepare PATH or
# therefore we should prepare PATH or copy DLL(s)... # copy DLL(s)...
if(CMAKE_CONFIGURATION_TYPES) if(CMAKE_CONFIGURATION_TYPES)
# Could not provide static ENVIRONMENT property with configuration-depended path # Could not provide static ENVIRONMENT property with
# configuration-depended path
set(dir FALSE) set(dir FALSE)
else(CMAKE_CONFIGURATION_TYPES) else(CMAKE_CONFIGURATION_TYPES)
get_target_property(filename ${dep} IMPORTED_LOCATION_${CMAKE_BUILD_TYPE_UPPERCASE}) get_target_property(filename ${dep}
IMPORTED_LOCATION_${CMAKE_BUILD_TYPE_UPPERCASE})
if(NOT filename) if(NOT filename)
get_target_property(filename ${dep} IMPORTED_LOCATION) get_target_property(filename ${dep} IMPORTED_LOCATION)
endif() endif()
get_target_property(filename ${dep} LOCATION_${CMAKE_BUILD_TYPE_UPPERCASE}) get_target_property(filename ${dep}
LOCATION_${CMAKE_BUILD_TYPE_UPPERCASE})
if(NOT filename) if(NOT filename)
get_target_property(filename ${dep} LOCATION) get_target_property(filename ${dep} LOCATION)
endif() endif()
if(filename) if(filename)
get_filename_component(dir ${filename} DIRECTORY) get_filename_component(dir ${filename} DIRECTORY)
else(filename) else(filename)
get_target_property(dir ${dep} LIBRARY_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE_UPPERCASE}) get_target_property(
dir ${dep} LIBRARY_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE_UPPERCASE})
if(NOT dir) if(NOT dir)
get_target_property(dir ${dep} RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE_UPPERCASE}) get_target_property(
dir ${dep}
RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE_UPPERCASE})
endif() endif()
if(NOT dir) if(NOT dir)
get_target_property(dir ${dep} LIBRARY_OUTPUT_DIRECTORY) get_target_property(dir ${dep} LIBRARY_OUTPUT_DIRECTORY)
@ -148,23 +159,35 @@ function(add_extra_test name)
list(APPEND params_DLLPATH ${dir}) list(APPEND params_DLLPATH ${dir})
else(dir) else(dir)
# Path is configuration-depended or not available, should copy dll # Path is configuration-depended or not available, should copy dll
add_custom_command(TARGET ${target} POST_BUILD add_custom_command(
COMMAND if exist "$<TARGET_PDB_FILE:${dep}>" TARGET ${target}
${CMAKE_COMMAND} -E copy_if_different "$<TARGET_PDB_FILE:${dep}>" "$<TARGET_FILE_DIR:${target}>") POST_BUILD
add_custom_command(TARGET ${target} POST_BUILD COMMAND
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:${dep}>" "$<TARGET_FILE_DIR:${target}>" if exist "$<TARGET_PDB_FILE:${dep}>" ${CMAKE_COMMAND} -E
COMMENT "${TOOL_MDBX_DLLCRUTCH}: Copy shared library ${dep} for test ${target}") copy_if_different "$<TARGET_PDB_FILE:${dep}>"
"$<TARGET_FILE_DIR:${target}>")
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:${dep}>" "$<TARGET_FILE_DIR:${target}>"
COMMENT
"${TOOL_MDBX_DLLCRUTCH}: Copy shared library ${dep} for test ${target}"
)
endif(dir) endif(dir)
endif() endif()
endforeach(dep) endforeach(dep)
endif(TOOL_MDBX_DLLCRUTCH) endif(TOOL_MDBX_DLLCRUTCH)
if(NOT params_DISABLED AND NOT (CMAKE_CROSSCOMPILING AND NOT CMAKE_CROSSCOMPILING_EMULATOR)) if(NOT params_DISABLED AND NOT (CMAKE_CROSSCOMPILING
AND NOT CMAKE_CROSSCOMPILING_EMULATOR))
add_test(extra_${name} ${MDBX_OUTPUT_DIR}/${target}) add_test(extra_${name} ${MDBX_OUTPUT_DIR}/${target})
if(params_TIMEOUT) if(params_TIMEOUT)
if(MEMORYCHECK_COMMAND OR CMAKE_MEMORYCHECK_COMMAND OR ENABLE_MEMCHECK) if(MEMORYCHECK_COMMAND
# FIXME: unless there are any other ideas how to fix the OR CMAKE_MEMORYCHECK_COMMAND
# timeouts problem when testing under Valgrind. OR ENABLE_MEMCHECK)
# FIXME: unless there are any other ideas how to fix the timeouts
# problem when testing under Valgrind.
math(EXPR params_TIMEOUT "${params_TIMEOUT} * 42") math(EXPR params_TIMEOUT "${params_TIMEOUT} * 42")
endif() endif()
set_tests_properties(extra_${name} PROPERTIES TIMEOUT ${params_TIMEOUT}) set_tests_properties(extra_${name} PROPERTIES TIMEOUT ${params_TIMEOUT})
@ -183,7 +206,8 @@ function(add_extra_test name)
else() else()
string(REPLACE ";" ":" params_DLLPATH_ENV "${params_DLLPATH_ENV}") string(REPLACE ";" ":" params_DLLPATH_ENV "${params_DLLPATH_ENV}")
endif() endif()
set_tests_properties(extra_${name} PROPERTIES ENVIRONMENT "PATH=${params_DLLPATH_ENV}") set_tests_properties(extra_${name}
PROPERTIES ENVIRONMENT "PATH=${params_DLLPATH_ENV}")
endif() endif()
endif() endif()
endfunction(add_extra_test) endfunction(add_extra_test)
@ -196,80 +220,116 @@ if(NOT SUBPROJECT)
endif() endif()
endif() endif()
################################################################################ # ##############################################################################
if (CMAKE_CROSSCOMPILING AND NOT CMAKE_CROSSCOMPILING_EMULATOR) if(CMAKE_CROSSCOMPILING AND NOT CMAKE_CROSSCOMPILING_EMULATOR)
message(WARNING "No emulator to run cross-compiled tests") message(WARNING "No emulator to run cross-compiled tests")
add_test(NAME fake_since_no_crosscompiling_emulator COMMAND ${CMAKE_COMMAND} -E add_test(NAME fake_since_no_crosscompiling_emulator
echo "No emulator to run cross-compiled tests") COMMAND ${CMAKE_COMMAND} -E echo
"No emulator to run cross-compiled tests")
else() else()
string(RANDOM LENGTH 9 ALPHABET "1234567890" test_seed) string(
message(STATUS "The ${test_seed} will be used for seeding tests. Re-run cmake to re-seed it.") 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."
)
add_test(NAME smoke COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test add_test(
--loglevel=verbose NAME smoke
--prng-seed=${test_seed} COMMAND
--progress --console=no --pathname=smoke.db --dont-cleanup-after basic) ${MDBX_OUTPUT_DIR}/mdbx_test --loglevel=verbose --prng-seed=${test_seed}
set_tests_properties(smoke PROPERTIES --progress --console=no --pathname=smoke.db --dont-cleanup-after basic)
TIMEOUT 600 set_tests_properties(smoke PROPERTIES TIMEOUT 600 RUN_SERIAL OFF)
RUN_SERIAL OFF)
if(MDBX_BUILD_TOOLS) if(MDBX_BUILD_TOOLS)
add_test(NAME smoke_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv smoke.db) add_test(NAME smoke_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv smoke.db)
set_tests_properties(smoke_chk PROPERTIES set_tests_properties(
DEPENDS smoke smoke_chk
TIMEOUT 60 PROPERTIES DEPENDS
FAIL_REGULAR_EXPRESSION "cooperative mode" smoke
REQUIRED_FILES smoke.db) TIMEOUT
add_test(NAME smoke_chk_copy COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv smoke.db-copy) 60
set_tests_properties(smoke_chk_copy PROPERTIES FAIL_REGULAR_EXPRESSION
DEPENDS smoke "cooperative mode"
TIMEOUT 60 REQUIRED_FILES
FAIL_REGULAR_EXPRESSION "cooperative mode" smoke.db)
REQUIRED_FILES smoke.db-copy) 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
FAIL_REGULAR_EXPRESSION
"cooperative mode"
REQUIRED_FILES
smoke.db-copy)
endif() endif()
add_test(NAME dupsort_writemap COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test add_test(
--loglevel=notice NAME dupsort_writemap
--prng-seed=${test_seed} COMMAND
--table=+data.fixed --keygen.split=29 --datalen=rnd --progress --console=no ${MDBX_OUTPUT_DIR}/mdbx_test --loglevel=notice --prng-seed=${test_seed}
--repeat=2 --pathname=dupsort_writemap.db --dont-cleanup-after basic) --table=+data.fixed --keygen.split=29 --datalen=rnd --progress
set_tests_properties(dupsort_writemap PROPERTIES --console=no --repeat=2 --pathname=dupsort_writemap.db
TIMEOUT 3600 --dont-cleanup-after basic)
RUN_SERIAL OFF) set_tests_properties(dupsort_writemap PROPERTIES TIMEOUT 3600 RUN_SERIAL OFF)
if(MDBX_BUILD_TOOLS) if(MDBX_BUILD_TOOLS)
add_test(NAME dupsort_writemap_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvvwc dupsort_writemap.db) add_test(NAME dupsort_writemap_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk
set_tests_properties(dupsort_writemap_chk PROPERTIES -nvvwc dupsort_writemap.db)
DEPENDS dupsort_writemap set_tests_properties(
TIMEOUT 60 dupsort_writemap_chk PROPERTIES DEPENDS dupsort_writemap TIMEOUT 60
REQUIRED_FILES dupsort_writemap.db) REQUIRED_FILES dupsort_writemap.db)
add_test(NAME dupsort_writemap_chk_copy COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvvc dupsort_writemap.db-copy) add_test(NAME dupsort_writemap_chk_copy
set_tests_properties(dupsort_writemap_chk_copy PROPERTIES COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvvc dupsort_writemap.db-copy)
DEPENDS dupsort_writemap set_tests_properties(
TIMEOUT 60 dupsort_writemap_chk_copy
FAIL_REGULAR_EXPRESSION "monopolistic mode" PROPERTIES DEPENDS
REQUIRED_FILES dupsort_writemap.db-copy) dupsort_writemap
TIMEOUT
60
FAIL_REGULAR_EXPRESSION
"monopolistic mode"
REQUIRED_FILES
dupsort_writemap.db-copy)
endif() endif()
add_test(NAME uniq_nested COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test add_test(
--loglevel=notice NAME uniq_nested
--mode=-writemap,-nosync-safe,-lifo --progress --console=no --repeat=2 --pathname=uniq_nested.db --dont-cleanup-after basic) COMMAND
set_tests_properties(uniq_nested PROPERTIES ${MDBX_OUTPUT_DIR}/mdbx_test --loglevel=notice
TIMEOUT 1800 --mode=-writemap,-nosync-safe,-lifo --progress --console=no --repeat=2
RUN_SERIAL OFF) --pathname=uniq_nested.db --dont-cleanup-after basic)
set_tests_properties(uniq_nested PROPERTIES TIMEOUT 1800 RUN_SERIAL OFF)
if(MDBX_BUILD_TOOLS) if(MDBX_BUILD_TOOLS)
add_test(NAME uniq_nested_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvvw uniq_nested.db) add_test(NAME uniq_nested_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvvw
set_tests_properties(uniq_nested_chk PROPERTIES uniq_nested.db)
DEPENDS uniq_nested set_tests_properties(
TIMEOUT 60 uniq_nested_chk
FAIL_REGULAR_EXPRESSION "cooperative mode" PROPERTIES DEPENDS
REQUIRED_FILES uniq_nested.db) uniq_nested
add_test(NAME uniq_nested_chk_copy COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv uniq_nested.db-copy) TIMEOUT
set_tests_properties(uniq_nested_chk_copy PROPERTIES 60
DEPENDS uniq_nested FAIL_REGULAR_EXPRESSION
TIMEOUT 60 "cooperative mode"
FAIL_REGULAR_EXPRESSION "cooperative mode" REQUIRED_FILES
REQUIRED_FILES uniq_nested.db-copy) 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
FAIL_REGULAR_EXPRESSION
"cooperative mode"
REQUIRED_FILES
uniq_nested.db-copy)
endif() endif()
if(NOT SUBPROJECT) if(NOT SUBPROJECT)