2019-01-23 06:25:20 +08:00
|
|
|
# This configures the fdb testing system in cmake. Currently this simply means
|
|
|
|
# that it will get a list of all test files and store this list in a parent scope
|
|
|
|
# so that we can later verify that all of them were assigned to a test.
|
|
|
|
#
|
|
|
|
# - TEST_DIRECTORY The directory where all the tests are
|
|
|
|
# - ERROR_ON_ADDITIONAL_FILES if this is passed verify_fdb_tests will print
|
|
|
|
# an error if there are any .txt files in the test directory that do not
|
|
|
|
# correspond to a test or are not ignore by a pattern
|
|
|
|
# - IGNORE_PATTERNS regular expressions. All files that match any of those
|
2024-02-05 05:59:37 +08:00
|
|
|
# expressions don't need to be associated with a test
|
2019-01-23 06:25:20 +08:00
|
|
|
function(configure_testing)
|
|
|
|
set(options ERROR_ON_ADDITIONAL_FILES)
|
|
|
|
set(oneValueArgs TEST_DIRECTORY)
|
|
|
|
set(multiValueArgs IGNORE_PATTERNS)
|
|
|
|
cmake_parse_arguments(CONFIGURE_TESTING "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
|
|
|
set(no_tests YES)
|
|
|
|
if(CONFIGURE_TESTING_ERROR_ON_ADDITIONAL_FILES)
|
|
|
|
file(GLOB_RECURSE candidates "${CONFIGURE_TESTING_TEST_DIRECTORY}/*.txt")
|
2020-07-13 05:41:12 +08:00
|
|
|
file(GLOB_RECURSE toml_candidates "${CONFIGURE_TESTING_TEST_DIRECTORY}/*.toml")
|
|
|
|
list(APPEND candidates ${toml_candidates})
|
2019-01-23 06:25:20 +08:00
|
|
|
foreach(candidate IN LISTS candidates)
|
|
|
|
set(candidate_is_test YES)
|
|
|
|
foreach(pattern IN LISTS CONFIGURE_TESTING_IGNORE_PATTERNS)
|
|
|
|
if("${candidate}" MATCHES "${pattern}")
|
|
|
|
set(candidate_is_test NO)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
if(candidate_is_test)
|
|
|
|
if(no_tests)
|
|
|
|
set(no_tests NO)
|
|
|
|
set(fdb_test_files "${candidate}")
|
|
|
|
else()
|
|
|
|
set(fdb_test_files "${fdb_test_files};${candidate}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
set(fdb_test_files "${fdb_test_files}" PARENT_SCOPE)
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(verify_testing)
|
|
|
|
foreach(test_file IN LISTS fdb_test_files)
|
|
|
|
message(SEND_ERROR "${test_file} found but it is not associated with a test")
|
|
|
|
endforeach()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# This will add a test that can be run by ctest. This macro can be called
|
|
|
|
# with the following arguments:
|
|
|
|
#
|
|
|
|
# - UNIT will run the test as a unit test (it won't bring up a whole simulated system)
|
|
|
|
# - TEST_NAME followed the name of the test
|
|
|
|
# - TIMEOUT followed by a timeout - reaching the timeout makes the test fail (default is
|
|
|
|
# 3600 seconds). The timeout will be reached whenever it ran either too long in simulated
|
|
|
|
# time or in real time - whatever is smaller.
|
|
|
|
# - TEST_FILES followed by typically one test file. The test runner will run
|
|
|
|
# all these tests in serialized order and within the same directory. This is
|
|
|
|
# useful for restart tests
|
|
|
|
function(add_fdb_test)
|
2022-10-12 06:28:07 +08:00
|
|
|
set(options UNIT IGNORE LONG_RUNNING)
|
2019-01-23 06:25:20 +08:00
|
|
|
set(oneValueArgs TEST_NAME TIMEOUT)
|
|
|
|
set(multiValueArgs TEST_FILES)
|
|
|
|
cmake_parse_arguments(ADD_FDB_TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
|
|
|
set(this_test_timeout ${ADD_FDB_TEST_TIMEOUT})
|
|
|
|
if(NOT this_test_timeout)
|
|
|
|
set(this_test_timeout 3600)
|
2019-08-16 02:48:37 +08:00
|
|
|
if(USE_VALGRIND_FOR_CTEST)
|
|
|
|
set(this_test_timeout 36000)
|
|
|
|
endif()
|
2019-01-23 06:25:20 +08:00
|
|
|
endif()
|
|
|
|
set(test_type "simulation")
|
|
|
|
set(fdb_test_files_ "${fdb_test_files}")
|
|
|
|
foreach(test_file IN LISTS ADD_FDB_TEST_TEST_FILES)
|
|
|
|
list(REMOVE_ITEM fdb_test_files_ "${CMAKE_CURRENT_SOURCE_DIR}/${test_file}")
|
|
|
|
endforeach()
|
|
|
|
set(fdb_test_files "${fdb_test_files_}" PARENT_SCOPE)
|
|
|
|
list(LENGTH ADD_FDB_TEST_TEST_FILES NUM_TEST_FILES)
|
|
|
|
if(ADD_FDB_TEST_IGNORE AND NOT RUN_IGNORED_TESTS)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
if(ADD_FDB_TEST_UNIT)
|
|
|
|
set(test_type "test")
|
|
|
|
endif()
|
|
|
|
list(GET ADD_FDB_TEST_TEST_FILES 0 first_file)
|
2020-07-13 10:53:44 +08:00
|
|
|
string(REGEX REPLACE "^(.*)\\.(txt|toml)$" "\\1" test_name ${first_file})
|
2019-01-23 06:25:20 +08:00
|
|
|
if("${test_name}" MATCHES "(-\\d)$")
|
|
|
|
string(REGEX REPLACE "(.*)(-\\d)$" "\\1" test_name_1 ${test_name})
|
|
|
|
message(STATUS "new testname ${test_name_1}")
|
|
|
|
endif()
|
|
|
|
if (NOT "${ADD_FDB_TEST_TEST_NAME}" STREQUAL "")
|
|
|
|
set(test_name ${ADD_FDB_TEST_TEST_NAME})
|
|
|
|
endif()
|
2020-04-29 00:19:04 +08:00
|
|
|
if((NOT test_name MATCHES "${TEST_INCLUDE}") OR (test_name MATCHES "${TEST_EXCLUDE}"))
|
|
|
|
return()
|
|
|
|
endif()
|
2022-02-04 08:52:41 +08:00
|
|
|
# We shouldn't run downgrade tests under valgrind: https://github.com/apple/foundationdb/issues/6322
|
|
|
|
if(USE_VALGRIND AND ${test_name} MATCHES .*to_.*)
|
|
|
|
return()
|
|
|
|
endif()
|
2019-07-16 05:52:24 +08:00
|
|
|
math(EXPR test_idx "${CURRENT_TEST_INDEX} + ${NUM_TEST_FILES}")
|
2019-02-17 02:27:13 +08:00
|
|
|
set(CURRENT_TEST_INDEX "${test_idx}" PARENT_SCOPE)
|
|
|
|
# set(<var> <value> PARENT_SCOPE) doesn't set the
|
|
|
|
# value in this scope (only in the parent scope). So
|
|
|
|
# if the value was undefined before, it will still be
|
|
|
|
# undefined.
|
2019-07-16 05:52:24 +08:00
|
|
|
math(EXPR assigned_id "${test_idx} - ${NUM_TEST_FILES}")
|
2019-01-23 06:25:20 +08:00
|
|
|
if(ADD_FDB_TEST_UNIT)
|
|
|
|
message(STATUS
|
2019-02-17 02:27:13 +08:00
|
|
|
"ADDING UNIT TEST ${assigned_id} ${test_name}")
|
2022-10-12 06:28:07 +08:00
|
|
|
elseif(ADD_FDB_TEST_LONG_RUNNING)
|
|
|
|
message(STATUS
|
|
|
|
"ADDING LONG RUNNING TEST ${assigned_id} ${test_name}")
|
2019-01-23 06:25:20 +08:00
|
|
|
else()
|
|
|
|
message(STATUS
|
2019-02-17 02:27:13 +08:00
|
|
|
"ADDING SIMULATOR TEST ${assigned_id} ${test_name}")
|
2019-01-23 06:25:20 +08:00
|
|
|
endif()
|
|
|
|
set(test_files "")
|
|
|
|
foreach(curr_test_file ${ADD_FDB_TEST_TEST_FILES})
|
|
|
|
set(test_files "${test_files} ${curr_test_file}")
|
|
|
|
endforeach()
|
|
|
|
set(BUGGIFY_OPTION "")
|
|
|
|
if (ENABLE_BUGGIFY)
|
|
|
|
set(BUGGIFY_OPTION "-B")
|
|
|
|
endif()
|
2019-07-03 00:15:05 +08:00
|
|
|
set(VALGRIND_OPTION "")
|
2019-08-16 02:48:37 +08:00
|
|
|
if (USE_VALGRIND_FOR_CTEST)
|
2019-07-03 00:15:05 +08:00
|
|
|
set(VALGRIND_OPTION "--use-valgrind")
|
|
|
|
endif()
|
2019-01-23 06:25:20 +08:00
|
|
|
list(TRANSFORM ADD_FDB_TEST_TEST_FILES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/")
|
2021-07-28 01:38:25 +08:00
|
|
|
if (ENABLE_SIMULATION_TESTS)
|
|
|
|
add_test(NAME ${test_name}
|
2022-07-30 02:04:10 +08:00
|
|
|
COMMAND $<TARGET_FILE:Python3::Interpreter> ${TestRunner}
|
2021-07-28 01:38:25 +08:00
|
|
|
-n ${test_name}
|
|
|
|
-b ${PROJECT_BINARY_DIR}
|
|
|
|
-t ${test_type}
|
2022-03-04 23:22:49 +08:00
|
|
|
-O ${OLD_FDBSERVER_BINARY}
|
2021-08-24 03:52:58 +08:00
|
|
|
--config "@CTEST_CONFIGURATION_TYPE@"
|
2021-07-28 01:38:25 +08:00
|
|
|
--crash
|
|
|
|
--aggregate-traces ${TEST_AGGREGATE_TRACES}
|
|
|
|
--log-format ${TEST_LOG_FORMAT}
|
|
|
|
--keep-logs ${TEST_KEEP_LOGS}
|
|
|
|
--keep-simdirs ${TEST_KEEP_SIMDIR}
|
|
|
|
--seed ${SEED}
|
|
|
|
--test-number ${assigned_id}
|
|
|
|
${BUGGIFY_OPTION}
|
|
|
|
${VALGRIND_OPTION}
|
|
|
|
${ADD_FDB_TEST_TEST_FILES}
|
|
|
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
2022-08-13 01:23:32 +08:00
|
|
|
set_tests_properties("${test_name}" PROPERTIES ENVIRONMENT "${SANITIZER_OPTIONS}")
|
2021-07-28 01:38:25 +08:00
|
|
|
get_filename_component(test_dir_full ${first_file} DIRECTORY)
|
|
|
|
if(NOT ${test_dir_full} STREQUAL "")
|
|
|
|
get_filename_component(test_dir ${test_dir_full} NAME)
|
|
|
|
set_tests_properties(${test_name} PROPERTIES TIMEOUT ${this_test_timeout} LABELS "${test_dir}")
|
|
|
|
endif()
|
2019-11-09 05:39:21 +08:00
|
|
|
endif()
|
|
|
|
# set variables used for generating test packages
|
2022-10-12 06:28:07 +08:00
|
|
|
if(ADD_FDB_TEST_LONG_RUNNING)
|
|
|
|
set(LONG_RUNNING_TEST_NAMES ${LONG_RUNNING_TEST_NAMES} ${test_name} PARENT_SCOPE)
|
|
|
|
set(LONG_RUNNING_TEST_FILES_${test_name} ${ADD_FDB_TEST_TEST_FILES} PARENT_SCOPE)
|
|
|
|
set(LONG_RUNNING_TEST_TYPE_${test_name} ${test_type} PARENT_SCOPE)
|
|
|
|
else()
|
|
|
|
set(TEST_NAMES ${TEST_NAMES} ${test_name} PARENT_SCOPE)
|
|
|
|
set(TEST_FILES_${test_name} ${ADD_FDB_TEST_TEST_FILES} PARENT_SCOPE)
|
|
|
|
set(TEST_TYPE_${test_name} ${test_type} PARENT_SCOPE)
|
|
|
|
endif()
|
2019-11-09 05:39:21 +08:00
|
|
|
endfunction()
|
|
|
|
|
2019-11-09 06:21:47 +08:00
|
|
|
if(NOT WIN32)
|
|
|
|
set(TEST_PACKAGE_INCLUDE ".*" CACHE STRING "A regex of all tests that should be included in the test package")
|
|
|
|
set(TEST_PACKAGE_EXCLUDE ".^" CACHE STRING "A regex of all tests that shouldn't be added to the test package")
|
|
|
|
set(TEST_PACKAGE_ADD_DIRECTORIES "" CACHE STRING "A ;-separated list of directories. All files within each directory will be added to the test package")
|
|
|
|
endif()
|
2019-11-09 05:39:21 +08:00
|
|
|
|
2020-05-22 04:35:54 +08:00
|
|
|
# This sets up a directory with the correctness files common to all correctness packages.
|
|
|
|
# This function should be called with the following arguments:
|
|
|
|
#
|
|
|
|
# - OUT_DIR the directory where files will be staged
|
|
|
|
# - CONTEXT the type of correctness package being built (e.g. 'valgrind correctness')
|
|
|
|
function(stage_correctness_package)
|
2022-10-12 06:28:07 +08:00
|
|
|
set(options LONG_RUNNING)
|
2020-10-23 03:53:03 +08:00
|
|
|
set(oneValueArgs OUT_DIR CONTEXT OUT_FILES)
|
2022-10-12 06:28:07 +08:00
|
|
|
set(multiValueArgs TEST_LIST)
|
|
|
|
cmake_parse_arguments(STAGE "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
2020-05-23 01:10:34 +08:00
|
|
|
file(MAKE_DIRECTORY ${STAGE_OUT_DIR}/bin)
|
2022-10-12 06:28:07 +08:00
|
|
|
foreach(test IN LISTS STAGE_TEST_LIST)
|
2022-08-06 02:28:53 +08:00
|
|
|
if((${test} MATCHES ${TEST_PACKAGE_INCLUDE}) AND
|
2019-11-09 05:39:21 +08:00
|
|
|
(NOT ${test} MATCHES ${TEST_PACKAGE_EXCLUDE}))
|
2022-10-12 06:28:07 +08:00
|
|
|
string(LENGTH "${CMAKE_SOURCE_DIR}/tests/" base_length)
|
|
|
|
if(STAGE_LONG_RUNNING)
|
|
|
|
set(TEST_FILES_PREFIX "LONG_RUNNING_TEST_FILES")
|
|
|
|
else()
|
|
|
|
set(TEST_FILES_PREFIX "TEST_FILES")
|
|
|
|
endif()
|
|
|
|
foreach(file IN LISTS ${TEST_FILES_PREFIX}_${test})
|
2019-11-09 05:39:21 +08:00
|
|
|
string(SUBSTRING ${file} ${base_length} -1 rel_out_file)
|
2020-05-22 04:35:54 +08:00
|
|
|
set(out_file ${STAGE_OUT_DIR}/tests/${rel_out_file})
|
|
|
|
list(APPEND test_files ${out_file})
|
2019-11-09 05:39:21 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${out_file}
|
|
|
|
DEPENDS ${file}
|
2020-05-22 04:35:54 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${file} ${out_file}
|
|
|
|
COMMENT "Copying ${STAGE_CONTEXT} test file ${rel_out_file}"
|
|
|
|
)
|
2019-11-09 05:39:21 +08:00
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2019-11-09 06:15:38 +08:00
|
|
|
foreach(dir IN LISTS TEST_PACKAGE_ADD_DIRECTORIES)
|
|
|
|
file(GLOB_RECURSE files ${dir}/*)
|
|
|
|
string(LENGTH ${dir} dir_len)
|
|
|
|
foreach(file IN LISTS files)
|
|
|
|
get_filename_component(src_dir ${file} DIRECTORY)
|
2019-11-09 07:13:32 +08:00
|
|
|
# We need to make sure that ${src_dir} is at least
|
|
|
|
# as long as ${dir}. Otherwise the later call to
|
|
|
|
# SUBSTRING will fail
|
|
|
|
set(src_dir "${src_dir}/")
|
2019-11-09 06:15:38 +08:00
|
|
|
string(SUBSTRING ${src_dir} ${dir_len} -1 dest_dir)
|
2020-05-28 02:34:15 +08:00
|
|
|
string(SUBSTRING ${file} ${dir_len} -1 rel_out_file)
|
2022-08-17 01:31:37 +08:00
|
|
|
set(out_file ${STAGE_OUT_DIR}/${rel_out_file})
|
2020-05-28 02:34:15 +08:00
|
|
|
list(APPEND external_files ${out_file})
|
2022-08-17 01:31:37 +08:00
|
|
|
add_custom_command(
|
2020-05-28 02:34:15 +08:00
|
|
|
OUTPUT ${out_file}
|
2022-08-17 01:31:37 +08:00
|
|
|
DEPENDS ${file}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${file} ${out_file}
|
|
|
|
COMMENT "Copying ${STAGE_CONTEXT} external file ${file}"
|
|
|
|
)
|
2019-11-09 06:15:38 +08:00
|
|
|
endforeach()
|
|
|
|
endforeach()
|
2022-08-17 01:31:37 +08:00
|
|
|
|
2020-05-22 04:35:54 +08:00
|
|
|
list(APPEND package_files ${STAGE_OUT_DIR}/bin/fdbserver
|
2020-10-23 03:49:53 +08:00
|
|
|
${STAGE_OUT_DIR}/bin/coverage.fdbserver.xml
|
2020-10-23 04:51:10 +08:00
|
|
|
${STAGE_OUT_DIR}/bin/coverage.fdbclient.xml
|
|
|
|
${STAGE_OUT_DIR}/bin/coverage.fdbrpc.xml
|
|
|
|
${STAGE_OUT_DIR}/bin/coverage.flow.xml
|
2024-05-22 23:46:07 +08:00
|
|
|
# ${STAGE_OUT_DIR}/bin/TestHarness.exe
|
|
|
|
# ${STAGE_OUT_DIR}/bin/TraceLogHelper.dll
|
2020-05-22 04:35:54 +08:00
|
|
|
${STAGE_OUT_DIR}/CMakeCache.txt
|
|
|
|
)
|
2022-08-17 01:31:37 +08:00
|
|
|
|
2020-05-22 04:35:54 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${package_files}
|
|
|
|
DEPENDS ${CMAKE_BINARY_DIR}/CMakeCache.txt
|
|
|
|
${CMAKE_BINARY_DIR}/packages/bin/fdbserver
|
2020-10-23 03:49:53 +08:00
|
|
|
${CMAKE_BINARY_DIR}/bin/coverage.fdbserver.xml
|
2020-10-23 04:51:10 +08:00
|
|
|
${CMAKE_BINARY_DIR}/lib/coverage.fdbclient.xml
|
|
|
|
${CMAKE_BINARY_DIR}/lib/coverage.fdbrpc.xml
|
|
|
|
${CMAKE_BINARY_DIR}/lib/coverage.flow.xml
|
2024-05-22 23:46:07 +08:00
|
|
|
# ${CMAKE_BINARY_DIR}/packages/bin/TestHarness.exe
|
|
|
|
# ${CMAKE_BINARY_DIR}/packages/bin/TraceLogHelper.dll
|
2020-05-22 04:35:54 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/CMakeCache.txt ${STAGE_OUT_DIR}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/packages/bin/fdbserver
|
2020-10-23 03:49:53 +08:00
|
|
|
${CMAKE_BINARY_DIR}/bin/coverage.fdbserver.xml
|
2020-10-23 04:51:10 +08:00
|
|
|
${CMAKE_BINARY_DIR}/lib/coverage.fdbclient.xml
|
|
|
|
${CMAKE_BINARY_DIR}/lib/coverage.fdbrpc.xml
|
|
|
|
${CMAKE_BINARY_DIR}/lib/coverage.flow.xml
|
2024-05-22 23:46:07 +08:00
|
|
|
# ${CMAKE_BINARY_DIR}/packages/bin/TestHarness.exe
|
|
|
|
# ${CMAKE_BINARY_DIR}/packages/bin/TraceLogHelper.dll
|
2020-05-22 04:35:54 +08:00
|
|
|
${STAGE_OUT_DIR}/bin
|
|
|
|
COMMENT "Copying files for ${STAGE_CONTEXT} package"
|
|
|
|
)
|
2022-08-17 01:31:37 +08:00
|
|
|
|
|
|
|
set(test_harness_dir "${CMAKE_SOURCE_DIR}/contrib/TestHarness2")
|
|
|
|
file(GLOB_RECURSE test_harness2_files RELATIVE "${test_harness_dir}" CONFIGURE_DEPENDS "${test_harness_dir}/*.py")
|
|
|
|
foreach(file IN LISTS test_harness2_files)
|
|
|
|
set(src_file "${test_harness_dir}/${file}")
|
|
|
|
set(out_file "${STAGE_OUT_DIR}/${file}")
|
|
|
|
get_filename_component(dir "${out_file}" DIRECTORY)
|
|
|
|
file(MAKE_DIRECTORY "${dir}")
|
|
|
|
add_custom_command(OUTPUT ${out_file}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${src_file}" "${out_file}"
|
|
|
|
DEPENDS "${src_file}")
|
|
|
|
list(APPEND package_files "${out_file}")
|
|
|
|
endforeach()
|
|
|
|
|
Provide a tool that allows downloading logs when simulation RocksDB failures
A script, rocksdb_logtool.py, is available to upload/download generated
XML/JSON log files when test harness 2 detects that the test is failed,
and the script detects that the test is using RocksDB.
To upload, no actions is needed, using the regular
```
joshua start --tarball correctness.tgz
```
The build system will automatically pack the rocksdb_logtool.py into the
tarball and test harness 2 will call the script if it thinks the test is
failed.
To download, simply provide the ensemble id and test uid, e.g.
```
python3 rocksdb_logtool.py download --ensemble-id
20230222-204240-xiaogesu-cb6ea277a898f134 --test-uid
ab6fb792-088f-49d6-92d2-43bc4fb81668
```
Note the test UID can be retrieved by
```
joshua tail ensemble_id
```
output, it is in the field `TestUID` in <Test> element of test harness 2
generated XML.
For convenience, it is possible to do a
```
python3 rocksdb_logtool.py list --ensemble-id ensemble-id
```
to generate all possible download commands for failed tests. However,
the list subcommand will *NOT* verify if the test failure is coming from
RocksDB, i.e. other test failues may be included and it is the caller's
responsibility to verify. If the test is not RocksDB related, the
download would fail as nothing is uploaded.
2023-02-23 05:15:14 +08:00
|
|
|
add_custom_command(
|
2023-02-23 10:11:07 +08:00
|
|
|
OUTPUT "${STAGE_OUT_DIR}/joshua_logtool.py"
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/contrib/joshua_logtool.py" "${STAGE_OUT_DIR}/joshua_logtool.py"
|
|
|
|
DEPENDS "${CMAKE_SOURCE_DIR}/contrib/joshua_logtool.py"
|
Provide a tool that allows downloading logs when simulation RocksDB failures
A script, rocksdb_logtool.py, is available to upload/download generated
XML/JSON log files when test harness 2 detects that the test is failed,
and the script detects that the test is using RocksDB.
To upload, no actions is needed, using the regular
```
joshua start --tarball correctness.tgz
```
The build system will automatically pack the rocksdb_logtool.py into the
tarball and test harness 2 will call the script if it thinks the test is
failed.
To download, simply provide the ensemble id and test uid, e.g.
```
python3 rocksdb_logtool.py download --ensemble-id
20230222-204240-xiaogesu-cb6ea277a898f134 --test-uid
ab6fb792-088f-49d6-92d2-43bc4fb81668
```
Note the test UID can be retrieved by
```
joshua tail ensemble_id
```
output, it is in the field `TestUID` in <Test> element of test harness 2
generated XML.
For convenience, it is possible to do a
```
python3 rocksdb_logtool.py list --ensemble-id ensemble-id
```
to generate all possible download commands for failed tests. However,
the list subcommand will *NOT* verify if the test failure is coming from
RocksDB, i.e. other test failues may be included and it is the caller's
responsibility to verify. If the test is not RocksDB related, the
download would fail as nothing is uploaded.
2023-02-23 05:15:14 +08:00
|
|
|
)
|
|
|
|
|
2023-02-23 10:11:07 +08:00
|
|
|
list(APPEND package_files ${test_files} ${external_files} "${STAGE_OUT_DIR}/joshua_logtool.py")
|
2020-10-23 03:53:03 +08:00
|
|
|
if(STAGE_OUT_FILES)
|
|
|
|
set(${STAGE_OUT_FILES} ${package_files} PARENT_SCOPE)
|
|
|
|
endif()
|
2020-05-22 04:35:54 +08:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(create_correctness_package)
|
|
|
|
if(WIN32)
|
|
|
|
return()
|
2020-03-28 00:36:57 +08:00
|
|
|
endif()
|
2020-05-22 04:35:54 +08:00
|
|
|
set(out_dir "${CMAKE_BINARY_DIR}/correctness")
|
2022-10-12 06:28:07 +08:00
|
|
|
stage_correctness_package(OUT_DIR ${out_dir} CONTEXT "correctness" OUT_FILES package_files TEST_LIST "${TEST_NAMES}")
|
2021-11-24 01:35:30 +08:00
|
|
|
set(tar_file ${CMAKE_BINARY_DIR}/packages/correctness-${FDB_VERSION}.tar.gz)
|
2020-05-22 04:35:54 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${tar_file}
|
|
|
|
DEPENDS ${package_files}
|
|
|
|
${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/correctnessTest.sh
|
|
|
|
${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/correctnessTimeout.sh
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/correctnessTest.sh
|
|
|
|
${out_dir}/joshua_test
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/correctnessTimeout.sh
|
|
|
|
${out_dir}/joshua_timeout
|
2020-06-19 06:59:08 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E tar cfz ${tar_file} ${package_files}
|
|
|
|
${out_dir}/joshua_test
|
|
|
|
${out_dir}/joshua_timeout
|
2020-05-22 04:35:54 +08:00
|
|
|
WORKING_DIRECTORY ${out_dir}
|
|
|
|
COMMENT "Package correctness archive"
|
|
|
|
)
|
|
|
|
add_custom_target(package_tests ALL DEPENDS ${tar_file})
|
|
|
|
add_dependencies(package_tests strip_only_fdbserver TestHarness)
|
2021-06-30 05:40:59 +08:00
|
|
|
set(unversioned_tar_file "${CMAKE_BINARY_DIR}/packages/correctness.tar.gz")
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${unversioned_tar_file}"
|
|
|
|
DEPENDS "${tar_file}"
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${tar_file}" "${unversioned_tar_file}"
|
|
|
|
COMMENT "Copy correctness package to ${unversioned_tar_file}")
|
|
|
|
add_custom_target(package_tests_u DEPENDS "${unversioned_tar_file}")
|
|
|
|
add_dependencies(package_tests_u package_tests)
|
2020-05-22 04:35:54 +08:00
|
|
|
endfunction()
|
2020-03-27 05:02:21 +08:00
|
|
|
|
2022-10-12 06:28:07 +08:00
|
|
|
function(create_long_running_correctness_package)
|
|
|
|
if(WIN32)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
set(out_dir "${CMAKE_BINARY_DIR}/long_running_correctness")
|
|
|
|
stage_correctness_package(OUT_DIR ${out_dir} CONTEXT "long running correctness" OUT_FILES package_files TEST_LIST "${LONG_RUNNING_TEST_NAMES}" LONG_RUNNING)
|
|
|
|
set(tar_file ${CMAKE_BINARY_DIR}/packages/long-running-correctness-${FDB_VERSION}.tar.gz)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${tar_file}
|
|
|
|
DEPENDS ${package_files}
|
2022-10-22 02:11:11 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/longRunningCorrectnessTest.sh
|
|
|
|
${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/longRunningCorrectnessTimeout.sh
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/longRunningCorrectnessTest.sh
|
2022-10-12 06:28:07 +08:00
|
|
|
${out_dir}/joshua_test
|
2022-10-22 02:11:11 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/longRunningCorrectnessTimeout.sh
|
2022-10-12 06:28:07 +08:00
|
|
|
${out_dir}/joshua_timeout
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E tar cfz ${tar_file} ${package_files}
|
|
|
|
${out_dir}/joshua_test
|
|
|
|
${out_dir}/joshua_timeout
|
|
|
|
WORKING_DIRECTORY ${out_dir}
|
|
|
|
COMMENT "Package long running correctness archive"
|
|
|
|
)
|
|
|
|
add_custom_target(package_long_running_tests ALL DEPENDS ${tar_file})
|
|
|
|
add_dependencies(package_long_running_tests strip_only_fdbserver TestHarness)
|
|
|
|
set(unversioned_tar_file "${CMAKE_BINARY_DIR}/packages/long_running_correctness.tar.gz")
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${unversioned_tar_file}"
|
|
|
|
DEPENDS "${tar_file}"
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${tar_file}" "${unversioned_tar_file}"
|
|
|
|
COMMENT "Copy long running correctness package to ${unversioned_tar_file}")
|
|
|
|
add_custom_target(package_long_running_tests_u DEPENDS "${unversioned_tar_file}")
|
|
|
|
add_dependencies(package_long_running_tests_u package_long_running_tests)
|
|
|
|
endfunction()
|
|
|
|
|
2020-05-22 04:35:54 +08:00
|
|
|
function(create_valgrind_correctness_package)
|
|
|
|
if(WIN32)
|
|
|
|
return()
|
|
|
|
endif()
|
2020-03-28 00:38:20 +08:00
|
|
|
if(USE_VALGRIND)
|
2020-05-22 04:35:54 +08:00
|
|
|
set(out_dir "${CMAKE_BINARY_DIR}/valgrind_correctness")
|
2022-10-12 06:28:07 +08:00
|
|
|
stage_correctness_package(OUT_DIR ${out_dir} CONTEXT "valgrind correctness" OUT_FILES package_files TEST_LIST "${TEST_NAMES}")
|
2021-11-24 01:35:30 +08:00
|
|
|
set(tar_file ${CMAKE_BINARY_DIR}/packages/valgrind-${FDB_VERSION}.tar.gz)
|
2020-03-28 00:38:20 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${tar_file}
|
2020-05-22 04:35:54 +08:00
|
|
|
DEPENDS ${package_files}
|
2020-04-11 09:23:29 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/valgrindTest.sh
|
|
|
|
${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/valgrindTimeout.sh
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/valgrindTest.sh
|
2020-05-22 04:35:54 +08:00
|
|
|
${out_dir}/joshua_test
|
2020-04-11 09:23:29 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/valgrindTimeout.sh
|
2020-05-22 04:35:54 +08:00
|
|
|
${out_dir}/joshua_timeout
|
2020-06-19 06:59:08 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E tar cfz ${tar_file} ${package_files}
|
|
|
|
${out_dir}/joshua_test
|
|
|
|
${out_dir}/joshua_timeout
|
2020-05-22 04:35:54 +08:00
|
|
|
WORKING_DIRECTORY ${out_dir}
|
|
|
|
COMMENT "Package valgrind correctness archive"
|
2020-03-28 00:38:20 +08:00
|
|
|
)
|
|
|
|
add_custom_target(package_valgrind_tests ALL DEPENDS ${tar_file})
|
|
|
|
add_dependencies(package_valgrind_tests strip_only_fdbserver TestHarness)
|
2021-06-30 05:40:59 +08:00
|
|
|
set(unversioned_tar_file "${CMAKE_BINARY_DIR}/packages/valgrind.tar.gz")
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${unversioned_tar_file}"
|
|
|
|
DEPENDS "${tar_file}"
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${tar_file}" "${unversioned_tar_file}"
|
|
|
|
COMMENT "Copy valgrind package to ${unversioned_tar_file}")
|
|
|
|
add_custom_target(package_valgrind_tests_u DEPENDS "${unversioned_tar_file}")
|
|
|
|
add_dependencies(package_valgrind_tests_u package_valgrind_tests)
|
2020-03-28 00:36:38 +08:00
|
|
|
endif()
|
2020-03-27 07:01:58 +08:00
|
|
|
endfunction()
|
|
|
|
|
2023-01-24 09:56:23 +08:00
|
|
|
function(prepare_binding_test_files build_directory target_name target_dependency)
|
|
|
|
add_custom_target(${target_name} DEPENDS ${target_dependency})
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${target_name}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:fdb_flow_tester> ${build_directory}/tests/flow/bin/fdb_flow_tester
|
|
|
|
COMMENT "Copy Flow tester for bindingtester")
|
|
|
|
|
2023-02-27 23:46:01 +08:00
|
|
|
set(generated_binding_files python/fdb/fdboptions.py python/fdb/apiversion.py)
|
2023-01-24 09:56:23 +08:00
|
|
|
if(WITH_JAVA_BINDING)
|
|
|
|
if(NOT FDB_RELEASE)
|
|
|
|
set(not_fdb_release_string "-SNAPSHOT")
|
|
|
|
else()
|
|
|
|
set(not_fdb_release_string "")
|
|
|
|
endif()
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${target_name}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${CMAKE_BINARY_DIR}/packages/fdb-java-${FDB_VERSION}${not_fdb_release_string}.jar
|
|
|
|
${build_directory}/tests/java/foundationdb-client.jar
|
|
|
|
COMMENT "Copy Java bindings for bindingtester")
|
|
|
|
add_dependencies(${target_name} fat-jar)
|
|
|
|
add_dependencies(${target_name} foundationdb-tests)
|
|
|
|
set(generated_binding_files ${generated_binding_files} java/foundationdb-tests.jar)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_GO_BINDING)
|
|
|
|
add_dependencies(${target_name} fdb_go_tester fdb_go)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${target_name}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bindings/go/bin/_stacktester ${build_directory}/tests/go/build/bin/_stacktester
|
2023-01-27 16:03:47 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${build_directory}/tests/go/src/fdb/
|
2023-01-24 09:56:23 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
Introduce initial Swift support in fdbserver (#10156)
* [fdbserver] workaround the FRT type layout issue to get Swfit getVersion working
* MasterData.actor.h: fix comment typo
* masterserver.swift: some tweaks
* masterserver.swift: remove getVersion function, use the method
* masterserver.swift: print replied version to output for tracing
* [swift] add radar links for C++ interop issues found in getVersion bringup
* Update fdbserver.actor.cpp
* Migrate MasterData closer to full reference type
This removes the workaround for the FRT type layout issue, and gets us closer to making MasterData a full reference type
* [interop] require a new toolchain (>= Oct 19th) to build
* [Swift] fix computation of toAdd for getVersion Swift implementation
* add Swift to FDBClient and add async `atLeast` to NotifiedVersion
* fix
* use new atLeast API in master server
* =build fixup link dependencies in swift fdbclient
* clocks
* +clock implement Clock using Flow's notion of time
* [interop] workaround the immortal retain/release issue
* [swift] add script to get latest centos toolchain
* always install swift hooks; not only in "test" mode
* simulator - first thing running WIP
* cleanups
* more cleanup
* working snapshot
* remove sim debug printlns
* added convenience for whenAtLeast
* try Alex's workaround
* annotate nonnull
* cleanup clock a little bit
* fix missing impls after rebase
* Undo the swift_lookup_Map_UID_CommitProxyVersionReplies workaround
No longer needed - the issue was retain/release
* [flow][swift] add Swift version of BUGGIFY
* [swiftication] add CounterValue type to provide value semantics for Counter types on the Swift side
* remove extraneous requestingProxyUID local
* masterserver: initial Swift state prototype
* [interop] make the Swiftied getVersion work
* masterserver - remove the C++ implementation (it can't be supported as state is now missing)
* Remove unnecessary SWIFT_CXX_REF_IMMORTAL annotations from Flow types
* Remove C++ implementation of CommitProxyVersionReplies - it's in Swift now
* [swift interop] remove more SWIFT_CXX_REF_IMMORTAL
* [swift interop] add SWIFT_CXX_IMMORTAL_SINGLETON_TYPE annotation for semanticly meaningful immortal uses
* rename SWIFT_CXX_REF_IMMORTAL -> UNSAFE_SWIFT_CXX_IMMORTAL_REF
* Move master server waitForPrev to swift
* =build fix linking swift in all modules
* =build single link option
* =cmake avoid manual math, just get "last" element from list
* implement Streams support (#18)
* [interop] update to new toolchain #6
* [interop] remove C++ vtable linking workarounds
* [interop] make MasterData proper reference counted SWIFT_CXX_REF_MASTERDATA
* [interop] use Swift array to pass UIDs to registerLastCommitProxyVersionReplies
* [interop] expose MasterServer actor to C++ without wrapper struct
* [interop] we no longer need expose on methods 🥳
* [interop] initial prototype of storing CheckedContinuation on the C++ side
* Example of invoking a synchronous swift function from a C++ unit test. (#21)
* move all "tests" we have in Swift, and priority support into real modules (#24)
* Make set continuation functions inline
* Split flow_swift into flow_swift and flow_swift_future to break circular dependency
* rename SwiftContinuationCallbackStruct to FlowCallbackForSwiftContinuation
* Future interop: use a method in a class template for continuation set call
* Revert "Merge pull request #22 from FoundationDB/cpp-continuation" (#30)
* Basic Swift Guide (#29)
Co-authored-by: Alex Lorenz <arphaman@gmail.com>
* Revert "Revert "Merge pull request #22 from FoundationDB/cpp-continuation" (#30)"
This reverts commit c025fe6258c4c4904d5e70cd549d408bb61f2802.
* Restore the C++ continuation, but it seems waitValue is broken for CInt somehow now
* disable broken tests - waitValue not accessible
* Streams can be async iterated over (#27)
Co-authored-by: Alex Lorenz <arphaman@gmail.com>
* remove work in progress things (#35)
* remove some not used (yet) code
* remove expose func for CInt, it's a primitive so we always have witness info (#37)
* +masterdata implement provideVersions in Swift (#36)
* serveLiveCommittedVersion in Swift (#38)
* Port updateLiveCommittedVersion to swift (#33)
Co-authored-by: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
* Implement updateRecoveryData in Swift (#39)
Co-authored-by: Alex Lorenz <arphaman@gmail.com>
* Simplify flow_swift to avoid multiple targets and generate separate CheckedContinuation header
* Uncomment test which was blocked on extensions not being picked up (#31)
* [interop] Use a separate target for Swift-to-C++ header generation
* reduce boilerplate in future and stream support (#41)
* [interop] require interop v8 - that will fix linker issue (https://github.com/apple/swift/issues/62448)
* [interop] fix swift_stream_support.h Swift include
* [interop] bump up requirement to version 9
* [interop] Generalize the Flow.Optional -> Swift.Optional conversion using generics
* [WIP] masterServer func in Swift (#45)
* [interop] Try conforms_to with a SWIFT_CONFORMS_TO macro for Optional conformance (#49)
* [interop] include FlowOptionalProtocol source file when generating Flow_CheckedContinuation.h
This header generation step depends on the import of the C++ Flow module, which requires the presence of FlowOptionalProtocol
* conform Future to FlowFutureOps
* some notes
* move to value() so we can use discardable result for Flow.Void
* make calling into Swift async funcs nicer by returning Flow Futures
* [interop] hide initial use of FlowCheckedContinuation in flow.h to break dependency cycle
* [fdbserver] fix an EncryptionOpsUtils.h modularization issue (showed up with modularized libc++)
* Pass GCC toolchain using CMAKE_Swift_COMPILE_EXTERNAL_TOOLCHAIN to Swift's clang importer
* [interop] drop the no longer needed libstdc++ include directories
* [cmake] add a configuration check to ensure Swift can import C++ standard library
* [swift] include msgpack from msgpack_DIR
* [interop] make sure the FDB module maps have 'export' directive
* add import 'flow_swift' to swift_fdbserver_cxx_swift_value_conformance.swift
This is needed for CONFORMS_TO to work in imported modules
* make sure the Swift -> C++ manually bridged function signature matches generated signature
* [interop][workaround] force back use of @expose attribute before _Concurrency issue is fixed
* [interop] make getResolutionBalancer return a pointer to allow Swift to use it
We should revert back to a reference once compiler allows references again
* [interop] add a workaround for 'pop' being marked as unsafe in Swift
* masterserver.swift: MasterData returns the Swift actor pointer in an unsafe manner
* Add a 'getCopy' method to AsyncVar to make it more Swift friendly
* [interop] bump up the toolchain requirement
* Revert "[interop][workaround] force back use of @expose attribute before _Concurrency issue is fixed"
This reverts commit b01b271a76d1677bbb7c5c9c64cdad4b8b2b9612.
* [interop] add FIXME comments highlighting new issue workarounds
* [interop] adopt the new C++ interoperability compiler flag
* [interop] generate swift compile commands
* Do not deduplicate Swift compilation commands
* [interop] generate swift compile commands
* Do not deduplicate Swift compilation commands
* flow actorcompiler.h: add a SWIFT_ACTOR empty macro definition
This is needed to make the actor files parsable by clangd
* [cmake] add missing dependencies
* experimental cross compile
* [cmake] fix triple in cross-compiled cmake flags
* [interop] update to interop toolchain version 16
* [x-compile] add flags for cross-compiling boost
* cleanup x-compile cmake changes
* [cmake] fix typo in CMAKE_Swift_COMPILER_EXTERNAL_TOOLCHAIN config variable
* [interop] pass MasterDataActor from Swift to C++ and back to Swift
* [fdbserver] Swift->C++ header generation for FDBServer should use same module cache path
* Update swift_get_latest_toolchain.sh to fetch 5.9 toochains
* set HAVE_FLAG_SEARCH_PATHS_FIRST for cross compilation
* Resolve conflicts in net2/sim2/actors, can't build yet
* undo SWIFT_ACTOR changes, not necessary for merge
* guard c++ compiler flags with is_cxx_compile
* Update flow/actorcompiler/ActorParser.cs
Co-authored-by: Evan Wilde <etceterawilde@gmail.com>
* update the boost dependency
* Include boost directory from the container for Swift
* conform flow's Optional to FlowOptionalProtocol again
* Guard entire RocksDBLogForwarder.h with SSD_ROCKSDB_EXPERIMENTAL to avoid failing on missing rocksdb APIs
* remove extraneous merge marker
* [swift] update swift_test_streams.swifto to use vars in more places
* Add header guard to flow/include/flow/ThreadSafeQueue.h to fix moduralization issue
* Update net and sim impls
* [cmake] use prebuilt libc++ boost only when we're actually using libc++
* [fdbserver] Swift->C++ header generation for FDBServer should use same module cache path
* fixups after merge
* remove CustomStringConvertible conformance that would not be used
* remove self-caused deprecation warnings in future_support
* handle newly added task priority
* reformatting
* future: make value() not mutating
* remove FIXME, not needed anymore
* future: clarify why as functions
* Support TraceEvent in Swift
* Enable TraceEvent using a class wrapper in Swift
* prearing WITH_SWIFT flag
* wip disabled failing Go stuff
* cleanup WITH_SWIFT_FLAG and reenable Go
* wip disabled failing Go stuff
* move setting flag before printing it
* Add SWIFT_IDE_SETUP and cleanup guides and build a bit
* Revert "Wipe packet buffers that held serialized WipedString (#10018)"
This reverts commit e2df6e33029897360f8e11b3aea8fef97393a98c.
* [Swift] Compile workaround in KeyBackedRangeMap; default init is incorrect
* [interop] do not add FlowFutureOps conformance when building flow clang module for Flow checked continuation header pre-generation
* make sure to show -DUSE_LIBCXX=OFF in readme
* readme updates
* do not print to stderr
* Update Swift and C++ code to build with latest Swift 5.9 toolchain now that we no longer support universal references and bridge the methods that take in a constant reference template parameter correctly
* Fix SERVER_KNOBS and enable use them for masterserver
* Bump to C++20, Swift is now able to handle it as well
* Put waitForPrev behind FLOW_WITH_SWIFT knob
* Forward declare updateLiveCommittedVersion
* Remove unused code
* fix wrong condition set for updateLiveCommittedVersion
* Revert "Revert "Wipe packet buffers that held serialized WipedString (#10018)""
This reverts commit 5ad8dce0525fb1844664ed2ccd7ba595db6913dd.
* Enable go-bindings in cmake
* Revert "Revert "Wipe packet buffers that held serialized WipedString (#10018)""
This reverts commit 5ad8dce0525fb1844664ed2ccd7ba595db6913dd.
* USE_SWIFT flag so we "build without swift" until ready to by default
* uncomment a few tests which were disabled during USE_SWIFT enablement
* the option is WITH_SWIFT, not USE
* formatting
* Fix masterserver compile error
* Fix some build errors.
How did it not merge cleanly? :/
* remove initializer list from constructor
* Expect Swift toolchain only if WITH_SWIFT is enabled
* Don't require Flow_CheckedContinuation when Swift is disabled
* Don't compile FlowCheckedContinuation when WITH_SWIFT=OFF
* No-op Swift macros
* More compile guards
* fix typo
* Run clang-format
* Guard swift/bridging include in fdbrpc
* Remove printf to pass the test
* Remove some more printf to avoid potential issues
TODO: Need to be TraceEvents instead
* Remove __has_feature(nullability) as its only used in Swift
* Don't use __FILENAME__
* Don't call generate_module_map outside WITH_SWIFT
* Add some more cmake stuff under WITH_SWIFT guard
* Some more guards
* Bring back TLSTest.cpp
* clang-format
* fix comment formatting
* Remove unused command line arg
* fix cmake formatting in some files
* Address some review comments
* fix clang-format error
---------
Co-authored-by: Alex Lorenz <arphaman@gmail.com>
Co-authored-by: Russell Sears <russell_sears@apple.com>
Co-authored-by: Evan Wilde <etceterawilde@gmail.com>
Co-authored-by: Alex Lorenz <aleksei_lorenz@apple.com>
Co-authored-by: Vishesh Yadav <vishesh_yadav@apple.com>
Co-authored-by: Vishesh Yadav <vishesh3y@gmail.com>
2023-06-03 05:09:28 +08:00
|
|
|
${CMAKE_BINARY_DIR}/bindings/go/src/github.com/apple/foundationdb/bindings/go/src/fdb/generated.go # SRC
|
|
|
|
${build_directory}/tests/go/src/fdb/ # DEST
|
2023-01-24 09:56:23 +08:00
|
|
|
COMMENT "Copy generated.go for bindingtester")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
foreach(generated IN LISTS generated_binding_files)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${target_name}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bindings/${generated} ${build_directory}/tests/${generated}
|
|
|
|
COMMENT "Copy ${generated} to bindingtester")
|
|
|
|
endforeach()
|
|
|
|
endfunction(prepare_binding_test_files)
|
|
|
|
|
|
|
|
function(package_bindingtester2)
|
|
|
|
if (WIN32 OR OPEN_FOR_IDE)
|
|
|
|
message(WARNING "Binding tester is not built (WIN32/OPEN_FOR_IDE)")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(fdbcName "libfdb_c.so")
|
|
|
|
if (APPLE)
|
|
|
|
set(fdbcName "libfdb_c.dylib")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set(touch_file ${CMAKE_BINARY_DIR}/bindingtester2.touch)
|
|
|
|
set(build_directory ${CMAKE_BINARY_DIR}/bindingtester2)
|
|
|
|
set(tests_directory ${build_directory}/tests)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${touch_file}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${build_directory}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${build_directory}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${tests_directory}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${tests_directory}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/bindings ${tests_directory}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_BINARY_DIR}/bindingtester2.touch"
|
|
|
|
COMMENT "Setup scratch directory for bindingtester2")
|
|
|
|
|
|
|
|
set(joshua_directory ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts)
|
|
|
|
set(output_files
|
|
|
|
${build_directory}/joshua_test
|
|
|
|
${build_directory}/joshua_timeout
|
|
|
|
${build_directory}/fdbcli
|
|
|
|
${build_directory}/fdbserver
|
|
|
|
${build_directory}/${fdbcName}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${output_files}
|
|
|
|
DEPENDS strip_only_fdbcli
|
|
|
|
strip_only_fdbserver
|
|
|
|
strip_only_fdb_c
|
|
|
|
${joshua_directory}/binding_test_start.sh
|
|
|
|
${joshua_directory}/binding_test_timeout.sh
|
|
|
|
${touch_file}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${CMAKE_BINARY_DIR}/packages/bin/fdbcli
|
|
|
|
${CMAKE_BINARY_DIR}/packages/bin/fdbserver
|
|
|
|
${CMAKE_BINARY_DIR}/packages/lib/${fdbcName}
|
|
|
|
${build_directory}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${joshua_directory}/binding_test_start.sh ${build_directory}/joshua_test
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${joshua_directory}/binding_test_timeout.sh ${build_directory}/joshua_timeout
|
|
|
|
COMMENT "Copy executables and scripts to bindingtester2 dir")
|
|
|
|
|
|
|
|
set(local_cluster_files ${build_directory}/local_cluster)
|
|
|
|
set(local_cluster_directory ${CMAKE_SOURCE_DIR}/contrib/local_cluster)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${local_cluster_files}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
|
|
${local_cluster_directory}
|
|
|
|
${build_directory}
|
|
|
|
)
|
|
|
|
|
|
|
|
prepare_binding_test_files(${build_directory} copy_bindingtester2_test_files ${touch_file})
|
|
|
|
|
|
|
|
set(tar_file ${CMAKE_BINARY_DIR}/packages/bindingtester2-${FDB_VERSION}.tar.gz)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${tar_file}
|
|
|
|
DEPENDS ${touch_file} ${output_files} ${local_cluster_files} copy_bindingtester2_test_files
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E tar czf ${tar_file} *
|
|
|
|
WORKING_DIRECTORY ${build_directory}
|
|
|
|
COMMENT "Pack bindingtester2"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target(bindingtester2 ALL DEPENDS ${tar_file})
|
|
|
|
endfunction(package_bindingtester2)
|
|
|
|
|
2020-03-27 07:01:58 +08:00
|
|
|
function(package_bindingtester)
|
|
|
|
if(WIN32 OR OPEN_FOR_IDE)
|
2023-01-24 09:56:23 +08:00
|
|
|
message(WARNING "Binding tester is not built (WIN32/OPEN_FOR_IDE)")
|
2020-03-27 07:01:58 +08:00
|
|
|
return()
|
|
|
|
elseif(APPLE)
|
|
|
|
set(fdbcName "libfdb_c.dylib")
|
|
|
|
else()
|
|
|
|
set(fdbcName "libfdb_c.so")
|
|
|
|
endif()
|
|
|
|
set(bdir ${CMAKE_BINARY_DIR}/bindingtester)
|
|
|
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bindingtester)
|
|
|
|
set(outfiles ${bdir}/fdbcli ${bdir}/fdbserver ${bdir}/${fdbcName} ${bdir}/joshua_test ${bdir}/joshua_timeout)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${outfiles}
|
2020-05-22 04:35:54 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/CMakeCache.txt
|
|
|
|
${CMAKE_BINARY_DIR}/packages/bin/fdbcli
|
2020-03-27 07:01:58 +08:00
|
|
|
${CMAKE_BINARY_DIR}/packages/bin/fdbserver
|
|
|
|
${CMAKE_BINARY_DIR}/packages/lib/${fdbcName}
|
|
|
|
${bdir}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/bindingTest.sh ${bdir}/joshua_test
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/bindingTimeout.sh ${bdir}/joshua_timeout
|
2020-03-28 00:36:08 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/localClusterStart.sh ${bdir}/localClusterStart.sh
|
2020-04-01 09:40:25 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/bindingTestScript.sh ${bdir}/bindingTestScript.sh
|
2020-05-22 04:35:54 +08:00
|
|
|
COMMENT "Copy executables and scripts to bindingtester dir")
|
2020-03-27 07:01:58 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${CMAKE_BINARY_DIR}/bindingtester.touch"
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bindingtester/tests
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bindingtester/tests
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/bindings ${CMAKE_BINARY_DIR}/bindingtester/tests
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_BINARY_DIR}/bindingtester.touch"
|
|
|
|
COMMENT "Copy test files for bindingtester")
|
2020-04-28 09:17:20 +08:00
|
|
|
|
2023-01-24 09:56:23 +08:00
|
|
|
prepare_binding_test_files(${bdir} copy_binding_output_files ${CMAKE_BINARY_DIR}/bindingtester.touch)
|
2020-04-29 07:24:27 +08:00
|
|
|
|
2020-04-28 09:17:20 +08:00
|
|
|
add_custom_target(copy_bindingtester_binaries
|
2020-04-29 07:24:27 +08:00
|
|
|
DEPENDS ${outfiles} "${CMAKE_BINARY_DIR}/bindingtester.touch" copy_binding_output_files)
|
2020-03-27 07:01:58 +08:00
|
|
|
add_dependencies(copy_bindingtester_binaries strip_only_fdbserver strip_only_fdbcli strip_only_fdb_c)
|
2023-01-24 09:56:23 +08:00
|
|
|
|
2021-11-24 01:35:30 +08:00
|
|
|
set(tar_file ${CMAKE_BINARY_DIR}/packages/bindingtester-${FDB_VERSION}.tar.gz)
|
2020-03-27 07:01:58 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${tar_file}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E tar czf ${tar_file} *
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bindingtester
|
|
|
|
COMMENT "Pack bindingtester")
|
2023-01-24 09:56:23 +08:00
|
|
|
add_custom_target(bindingtester ALL DEPENDS ${tar_file} copy_bindingtester_binaries)
|
2019-01-23 06:25:20 +08:00
|
|
|
endfunction()
|
2020-09-25 05:43:05 +08:00
|
|
|
|
2024-09-05 02:31:49 +08:00
|
|
|
function(add_fdb_unit_test TEST_NAME PATTERN)
|
|
|
|
add_test(NAME ${TEST_NAME}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
|
|
COMMAND ${CMAKE_BINARY_DIR}/bin/fdbserver -r unittests -f "${PATTERN}")
|
|
|
|
set_tests_properties(${TEST_NAME} PROPERTIES
|
|
|
|
FAIL_REGULAR_EXPRESSION "0 tests passed; 1 tests failed."
|
|
|
|
)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(collect_unit_tests SOURCE_DIR)
|
|
|
|
message("Collecting unit_tests in ${SOURCE_DIR}")
|
|
|
|
execute_process(
|
|
|
|
COMMAND grep --include \*.h --include \*.cpp --include \*.hpp -rhoP "TEST_CASE\\(\\\"\\K[^\\\"]+(?=\\\"\\))" "${SOURCE_DIR}"
|
|
|
|
OUTPUT_VARIABLE TEST_NAMES
|
|
|
|
)
|
|
|
|
string(REGEX REPLACE "\n" ";" TEST_NAMES "${TEST_NAMES}")
|
|
|
|
|
|
|
|
foreach(TEST_NAME ${TEST_NAMES})
|
|
|
|
message("ADDING DISCOVERED UNIT TEST: ${TEST_NAME}")
|
|
|
|
add_fdb_unit_test(UnitTest_${TEST_NAME} ${TEST_NAME})
|
|
|
|
endforeach()
|
|
|
|
endfunction()
|
|
|
|
|
2022-11-22 06:38:20 +08:00
|
|
|
# Test for setting up Python venv for client tests.
|
|
|
|
# Adding this test as a fixture to another test allows the use of non-native Python packages within client test scripts
|
|
|
|
# by installing dependencies from requirements.txt
|
|
|
|
set(test_venv_dir ${CMAKE_BINARY_DIR}/tests/test_venv)
|
|
|
|
if (WIN32)
|
|
|
|
set(shell_cmd "cmd" CACHE INTERNAL "")
|
|
|
|
set(shell_opt "/c" CACHE INTERNAL "")
|
|
|
|
set(test_venv_activate "${test_venv_dir}/Scripts/activate.bat" CACHE INTERNAL "")
|
|
|
|
else()
|
|
|
|
set(shell_cmd "bash" CACHE INTERNAL "")
|
|
|
|
set(shell_opt "-c" CACHE INTERNAL "")
|
|
|
|
set(test_venv_activate ". ${test_venv_dir}/bin/activate" CACHE INTERNAL "")
|
|
|
|
endif()
|
|
|
|
set(test_venv_cmd "")
|
|
|
|
string(APPEND test_venv_cmd "${Python3_EXECUTABLE} -m venv ${test_venv_dir} ")
|
|
|
|
string(APPEND test_venv_cmd "&& ${test_venv_activate} ")
|
|
|
|
string(APPEND test_venv_cmd "&& pip install --upgrade pip ")
|
|
|
|
string(APPEND test_venv_cmd "&& pip install -r ${CMAKE_SOURCE_DIR}/tests/TestRunner/requirements.txt")
|
2024-04-30 05:15:25 +08:00
|
|
|
# NOTE: At this stage we are in the virtual environment and Python3_EXECUTABLE is not available anymore
|
|
|
|
string(APPEND test_venv_cmd "&& (cd ${CMAKE_BINARY_DIR}/bindings/python && python3 -m pip install .) ")
|
2022-11-22 06:38:20 +08:00
|
|
|
add_test(
|
|
|
|
NAME test_venv_setup
|
|
|
|
COMMAND bash -c ${test_venv_cmd}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
set_tests_properties(test_venv_setup PROPERTIES FIXTURES_SETUP test_virtual_env_setup TIMEOUT 120)
|
2022-11-23 04:24:47 +08:00
|
|
|
set_tests_properties(test_venv_setup PROPERTIES RESOURCE_LOCK TEST_VENV_SETUP)
|
2022-11-22 06:38:20 +08:00
|
|
|
|
|
|
|
# Run the test command under Python venv as a cmd (Windows) or bash (Linux/Apple) script, which allows && or || chaining.
|
2022-12-07 00:09:35 +08:00
|
|
|
function(add_python_venv_test)
|
2022-11-22 06:38:20 +08:00
|
|
|
set(oneValueArgs NAME WORKING_DIRECTORY TEST_TIMEOUT)
|
|
|
|
set(multiValueArgs COMMAND)
|
|
|
|
cmake_parse_arguments(T "" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
|
|
|
if(OPEN_FOR_IDE)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
if(NOT T_NAME)
|
|
|
|
message(FATAL_ERROR "NAME is a required argument for add_fdbclient_test")
|
|
|
|
endif()
|
|
|
|
if(NOT T_COMMAND)
|
|
|
|
message(FATAL_ERROR "COMMAND is a required argument for add_fdbclient_test")
|
|
|
|
endif()
|
|
|
|
if(NOT T_WORKING_DIRECTORY)
|
|
|
|
set(T_WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
endif()
|
|
|
|
if(NOT T_TEST_TIMEOUT)
|
2022-12-07 00:09:35 +08:00
|
|
|
if(USE_SANITIZER)
|
|
|
|
set(T_TEST_TIMEOUT 1200)
|
|
|
|
else()
|
|
|
|
set(T_TEST_TIMEOUT 300)
|
|
|
|
endif()
|
2022-11-22 06:38:20 +08:00
|
|
|
endif()
|
2022-12-07 00:09:35 +08:00
|
|
|
# expand list of command arguments to space-separated string so that we can pass to shell
|
2022-11-22 06:38:20 +08:00
|
|
|
string(REPLACE ";" " " T_COMMAND "${T_COMMAND}")
|
|
|
|
add_test(
|
|
|
|
NAME ${T_NAME}
|
|
|
|
WORKING_DIRECTORY ${T_WORKING_DIRECTORY}
|
|
|
|
COMMAND ${shell_cmd} ${shell_opt} "${test_venv_activate} && ${T_COMMAND}")
|
|
|
|
set_tests_properties(${T_NAME} PROPERTIES FIXTURES_REQUIRED test_virtual_env_setup TIMEOUT ${T_TEST_TIMEOUT})
|
2022-12-07 00:09:35 +08:00
|
|
|
set(test_env_vars "PYTHONPATH=${CMAKE_SOURCE_DIR}/tests/TestRunner:${CMAKE_BINARY_DIR}/tests/TestRunner")
|
2023-02-16 01:00:53 +08:00
|
|
|
if(APPLE)
|
|
|
|
set(ld_env_name "DYLD_LIBRARY_PATH")
|
|
|
|
else()
|
|
|
|
set(ld_env_name "LD_LIBRARY_PATH")
|
|
|
|
endif()
|
|
|
|
set(test_env_vars PROPERTIES ENVIRONMENT "${test_env_vars};${ld_env_name}=${CMAKE_BINARY_DIR}/lib:$ENV{${ld_env_name}}")
|
2022-11-22 06:38:20 +08:00
|
|
|
if(USE_SANITIZER)
|
2022-12-07 00:09:35 +08:00
|
|
|
set(test_env_vars "${test_env_vars};${SANITIZER_OPTIONS}")
|
2022-11-22 06:38:20 +08:00
|
|
|
endif()
|
2022-12-22 08:20:20 +08:00
|
|
|
set_tests_properties("${T_NAME}" PROPERTIES ENVIRONMENT "${test_env_vars}")
|
2022-11-22 06:38:20 +08:00
|
|
|
endfunction()
|
|
|
|
|
2021-03-10 04:14:54 +08:00
|
|
|
# Creates a single cluster before running the specified command (usually a ctest test)
|
2020-09-25 05:43:05 +08:00
|
|
|
function(add_fdbclient_test)
|
2022-08-11 23:02:50 +08:00
|
|
|
set(options DISABLED ENABLED DISABLE_TENANTS DISABLE_LOG_DUMP API_TEST_BLOB_GRANULES_ENABLED TLS_ENABLED)
|
2022-02-10 06:41:21 +08:00
|
|
|
set(oneValueArgs NAME PROCESS_NUMBER TEST_TIMEOUT WORKING_DIRECTORY)
|
2020-09-25 05:43:05 +08:00
|
|
|
set(multiValueArgs COMMAND)
|
|
|
|
cmake_parse_arguments(T "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
2021-01-26 08:09:32 +08:00
|
|
|
if(OPEN_FOR_IDE)
|
|
|
|
return()
|
|
|
|
endif()
|
2020-09-25 05:43:05 +08:00
|
|
|
if(NOT T_ENABLED AND T_DISABLED)
|
|
|
|
return()
|
|
|
|
endif()
|
2022-02-10 06:41:21 +08:00
|
|
|
if(NOT T_WORKING_DIRECTORY)
|
|
|
|
set(T_WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
endif()
|
2020-09-25 05:43:05 +08:00
|
|
|
if(NOT T_NAME)
|
|
|
|
message(FATAL_ERROR "NAME is a required argument for add_fdbclient_test")
|
|
|
|
endif()
|
|
|
|
if(NOT T_COMMAND)
|
|
|
|
message(FATAL_ERROR "COMMAND is a required argument for add_fdbclient_test")
|
|
|
|
endif()
|
2022-11-22 06:38:20 +08:00
|
|
|
set(TMP_CLUSTER_CMD python ${CMAKE_SOURCE_DIR}/tests/TestRunner/tmp_cluster.py --build-dir ${CMAKE_BINARY_DIR})
|
2022-03-04 23:22:49 +08:00
|
|
|
if(T_PROCESS_NUMBER)
|
|
|
|
list(APPEND TMP_CLUSTER_CMD --process-number ${T_PROCESS_NUMBER})
|
|
|
|
endif()
|
|
|
|
if(T_DISABLE_LOG_DUMP)
|
|
|
|
list(APPEND TMP_CLUSTER_CMD --disable-log-dump)
|
|
|
|
endif()
|
2022-08-11 23:02:50 +08:00
|
|
|
if(T_DISABLE_TENANTS)
|
|
|
|
list(APPEND TMP_CLUSTER_CMD --disable-tenants)
|
|
|
|
endif()
|
2022-04-21 03:34:19 +08:00
|
|
|
if(T_API_TEST_BLOB_GRANULES_ENABLED)
|
|
|
|
list(APPEND TMP_CLUSTER_CMD --blob-granules-enabled)
|
2022-04-18 23:52:02 +08:00
|
|
|
endif()
|
2022-05-23 18:47:51 +08:00
|
|
|
if(T_TLS_ENABLED)
|
|
|
|
list(APPEND TMP_CLUSTER_CMD --tls-enabled)
|
|
|
|
endif()
|
2022-11-22 06:38:20 +08:00
|
|
|
list(APPEND TMP_CLUSTER_CMD -- ${T_COMMAND})
|
2020-09-25 05:43:05 +08:00
|
|
|
message(STATUS "Adding Client test ${T_NAME}")
|
2022-11-22 06:38:20 +08:00
|
|
|
if (NOT T_TEST_TIMEOUT)
|
2021-07-15 14:55:54 +08:00
|
|
|
# default timeout
|
2022-08-29 21:35:04 +08:00
|
|
|
if(USE_SANITIZER)
|
2022-11-22 06:38:20 +08:00
|
|
|
set(T_TEST_TIMEOUT 1200)
|
2022-08-29 21:35:04 +08:00
|
|
|
else()
|
2022-11-22 06:38:20 +08:00
|
|
|
set(T_TEST_TIMEOUT 300)
|
2022-08-29 21:35:04 +08:00
|
|
|
endif()
|
2021-07-15 14:55:54 +08:00
|
|
|
endif()
|
2022-12-07 00:09:35 +08:00
|
|
|
add_python_venv_test(
|
2022-11-22 06:38:20 +08:00
|
|
|
NAME ${T_NAME}
|
|
|
|
WORKING_DIRECTORY ${T_WORKING_DIRECTORY}
|
|
|
|
COMMAND ${TMP_CLUSTER_CMD}
|
|
|
|
TEST_TIMEOUT ${T_TEST_TIMEOUT})
|
2021-09-29 12:59:43 +08:00
|
|
|
endfunction()
|
|
|
|
|
2022-03-04 23:22:49 +08:00
|
|
|
# Creates a cluster file for a nonexistent cluster before running the specified command
|
2021-09-29 12:59:43 +08:00
|
|
|
# (usually a ctest test)
|
|
|
|
function(add_unavailable_fdbclient_test)
|
|
|
|
set(options DISABLED ENABLED)
|
|
|
|
set(oneValueArgs NAME TEST_TIMEOUT)
|
|
|
|
set(multiValueArgs COMMAND)
|
|
|
|
cmake_parse_arguments(T "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
|
|
|
if(OPEN_FOR_IDE)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
if(NOT T_ENABLED AND T_DISABLED)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
if(NOT T_NAME)
|
|
|
|
message(FATAL_ERROR "NAME is a required argument for add_unavailable_fdbclient_test")
|
|
|
|
endif()
|
|
|
|
if(NOT T_COMMAND)
|
|
|
|
message(FATAL_ERROR "COMMAND is a required argument for add_unavailable_fdbclient_test")
|
|
|
|
endif()
|
2022-11-22 06:38:20 +08:00
|
|
|
if (NOT T_TEST_TIMEOUT)
|
2021-09-29 12:59:43 +08:00
|
|
|
# default timeout
|
2022-11-22 06:38:20 +08:00
|
|
|
set(T_TEST_TIMEOUT 60)
|
2021-09-29 12:59:43 +08:00
|
|
|
endif()
|
2022-11-22 06:38:20 +08:00
|
|
|
message(STATUS "Adding unavailable client test ${T_NAME}")
|
2022-12-07 00:09:35 +08:00
|
|
|
add_python_venv_test(
|
2022-11-22 06:38:20 +08:00
|
|
|
NAME ${T_NAME}
|
|
|
|
COMMAND python ${CMAKE_SOURCE_DIR}/tests/TestRunner/fake_cluster.py
|
|
|
|
--output-dir ${CMAKE_BINARY_DIR} -- ${T_COMMAND}
|
|
|
|
TEST_TIMEOUT ${T_TEST_TIMEOUT})
|
2020-09-25 05:43:05 +08:00
|
|
|
endfunction()
|
|
|
|
|
2021-03-10 04:14:54 +08:00
|
|
|
# Creates 3 distinct clusters before running the specified command.
|
|
|
|
# This is useful for testing features that require multiple clusters (like the
|
|
|
|
# multi-cluster FDB client)
|
|
|
|
function(add_multi_fdbclient_test)
|
|
|
|
set(options DISABLED ENABLED)
|
|
|
|
set(oneValueArgs NAME)
|
|
|
|
set(multiValueArgs COMMAND)
|
|
|
|
cmake_parse_arguments(T "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
|
|
|
if(OPEN_FOR_IDE)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
if(NOT T_ENABLED AND T_DISABLED)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
if(NOT T_NAME)
|
|
|
|
message(FATAL_ERROR "NAME is a required argument for add_multi_fdbclient_test")
|
|
|
|
endif()
|
|
|
|
if(NOT T_COMMAND)
|
|
|
|
message(FATAL_ERROR "COMMAND is a required argument for add_multi_fdbclient_test")
|
|
|
|
endif()
|
|
|
|
message(STATUS "Adding Client test ${T_NAME}")
|
2022-12-07 00:09:35 +08:00
|
|
|
add_python_venv_test(
|
2022-11-22 06:38:20 +08:00
|
|
|
NAME ${T_NAME}
|
|
|
|
COMMAND python ${CMAKE_SOURCE_DIR}/tests/TestRunner/tmp_multi_cluster.py
|
2021-03-10 04:14:54 +08:00
|
|
|
--build-dir ${CMAKE_BINARY_DIR}
|
2022-11-22 06:38:20 +08:00
|
|
|
--clusters 3 -- ${T_COMMAND}
|
|
|
|
TEST_TIMEOUT 60)
|
2020-09-25 05:43:05 +08:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(add_java_test)
|
|
|
|
set(options DISABLED ENABLED)
|
|
|
|
set(oneValueArgs NAME CLASS)
|
|
|
|
set(multiValueArgs CLASS_PATH)
|
|
|
|
cmake_parse_arguments(T "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
|
|
|
if(NOT T_ENABLED AND T_DISABLED)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
if(NOT T_NAME)
|
2021-02-05 09:24:45 +08:00
|
|
|
message(FATAL_ERROR "NAME is a required argument for add_java_test")
|
2020-09-25 05:43:05 +08:00
|
|
|
endif()
|
|
|
|
if(NOT T_CLASS)
|
2021-02-05 09:24:45 +08:00
|
|
|
message(FATAL_ERROR "CLASS is a required argument for add_java_test")
|
2020-09-25 05:43:05 +08:00
|
|
|
endif()
|
|
|
|
set(cp "")
|
|
|
|
set(separator ":")
|
|
|
|
if (WIN32)
|
|
|
|
set(separator ";")
|
|
|
|
endif()
|
2020-09-25 05:58:41 +08:00
|
|
|
message(STATUS "CLASSPATH ${T_CLASS_PATH}")
|
|
|
|
foreach(path ${T_CLASS_PATH})
|
2020-09-25 05:43:05 +08:00
|
|
|
if(cp)
|
|
|
|
set(cp "${cp}${separator}${path}")
|
|
|
|
else()
|
|
|
|
set(cp "${path}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
add_fdbclient_test(
|
|
|
|
NAME ${T_NAME}
|
2020-09-25 23:38:33 +08:00
|
|
|
COMMAND ${Java_JAVA_EXECUTABLE}
|
|
|
|
-cp "${cp}"
|
|
|
|
-Djava.library.path=${CMAKE_BINARY_DIR}/lib
|
|
|
|
${T_CLASS} "@CLUSTER_FILE@")
|
2020-09-25 05:43:05 +08:00
|
|
|
endfunction()
|