Generate bindingtester2 tarball for test

bindingtester2-${FDB_VERSION} is generated in packages/ directory.
It is possible to run the test by

j start --tarball bindingtester2-7.3.0.tar.gz --max-runs 1000

and submit the test to joshua system. Joshua will run the tests in
parallel and tests will not impact each other. Yet it will take long
time for each run.
This commit is contained in:
Xiaoge Su 2023-01-23 17:56:23 -08:00
parent 71a002c0e0
commit 9a0fd7f999
10 changed files with 133 additions and 52 deletions

View File

@ -17,4 +17,5 @@ if(WITH_RUBY_BINDING)
endif()
if(NOT WIN32 AND NOT OPEN_FOR_IDE)
package_bindingtester()
package_bindingtester2()
endif()

View File

@ -22,10 +22,8 @@
import sys
import subprocess
import struct
import random
import argparse
import math
import os
import copy
import traceback

View File

@ -380,8 +380,127 @@ function(create_valgrind_correctness_package)
endif()
endfunction()
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")
set(generated_binding_files python/fdb/fdboptions.py)
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
COMMAND ${CMAKE_COMMAND} -E make_directory ${bdir}/tests/go/src/fdb/
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/bindings/go/src/github.com/apple/foundationdb/bindings/go/src/fdb/generated.go # SRC
${build_directory}/tests/go/src/fdb/ # DEST
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)
function(package_bindingtester)
if(WIN32 OR OPEN_FOR_IDE)
message(WARNING "Binding tester is not built (WIN32/OPEN_FOR_IDE)")
return()
elseif(APPLE)
set(fdbcName "libfdb_c.dylib")
@ -403,7 +522,6 @@ function(package_bindingtester)
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/localClusterStart.sh ${bdir}/localClusterStart.sh
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/contrib/Joshua/scripts/bindingTestScript.sh ${bdir}/bindingTestScript.sh
COMMENT "Copy executables and scripts to bindingtester dir")
file(GLOB_RECURSE test_files ${CMAKE_SOURCE_DIR}/bindings/*)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/bindingtester.touch"
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bindingtester/tests
@ -412,60 +530,19 @@ function(package_bindingtester)
COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_BINARY_DIR}/bindingtester.touch"
COMMENT "Copy test files for bindingtester")
add_custom_target(copy_binding_output_files DEPENDS ${CMAKE_BINARY_DIR}/bindingtester.touch python_binding fdb_flow_tester)
add_custom_command(
TARGET copy_binding_output_files
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:fdb_flow_tester> ${bdir}/tests/flow/bin/fdb_flow_tester
COMMENT "Copy Flow tester for bindingtester")
set(generated_binding_files python/fdb/fdboptions.py)
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 copy_binding_output_files
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/packages/fdb-java-${FDB_VERSION}${not_fdb_release_string}.jar
${bdir}/tests/java/foundationdb-client.jar
COMMENT "Copy Java bindings for bindingtester")
add_dependencies(copy_binding_output_files fat-jar)
add_dependencies(copy_binding_output_files foundationdb-tests)
set(generated_binding_files ${generated_binding_files} java/foundationdb-tests.jar)
endif()
if(WITH_GO_BINDING AND NOT OPEN_FOR_IDE)
add_dependencies(copy_binding_output_files fdb_go_tester fdb_go)
add_custom_command(
TARGET copy_binding_output_files
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bindings/go/bin/_stacktester ${bdir}/tests/go/build/bin/_stacktester
COMMAND ${CMAKE_COMMAND} -E make_directory ${bdir}/tests/go/src/fdb/
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/bindings/go/src/github.com/apple/foundationdb/bindings/go/src/fdb/generated.go # SRC
${bdir}/tests/go/src/fdb/ # DEST
COMMENT "Copy generated.go for bindingtester")
endif()
foreach(generated IN LISTS generated_binding_files)
add_custom_command(
TARGET copy_binding_output_files
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bindings/${generated} ${bdir}/tests/${generated}
COMMENT "Copy ${generated} to bindingtester")
endforeach()
prepare_binding_test_files(${bdir} copy_binding_output_files ${CMAKE_BINARY_DIR}/bindingtester.touch)
add_custom_target(copy_bindingtester_binaries
DEPENDS ${outfiles} "${CMAKE_BINARY_DIR}/bindingtester.touch" copy_binding_output_files)
add_dependencies(copy_bindingtester_binaries strip_only_fdbserver strip_only_fdbcli strip_only_fdb_c)
set(tar_file ${CMAKE_BINARY_DIR}/packages/bindingtester-${FDB_VERSION}.tar.gz)
add_custom_command(
OUTPUT ${tar_file}
COMMAND ${CMAKE_COMMAND} -E tar czf ${tar_file} *
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bindingtester
COMMENT "Pack bindingtester")
add_custom_target(bindingtester ALL DEPENDS ${tar_file})
add_dependencies(bindingtester copy_bindingtester_binaries)
add_custom_target(bindingtester ALL DEPENDS ${tar_file} copy_bindingtester_binaries)
endfunction()
# Test for setting up Python venv for client tests.

View File

@ -1,4 +1,3 @@
# RPM specifics
if(CPACK_GENERATOR MATCHES "RPM")
set(CPACK_PACKAGING_INSTALL_PREFIX "/")
set(CPACK_COMPONENTS_ALL clients-el7 server-el7 clients-versioned server-versioned)

View File

@ -0,0 +1,3 @@
#! /usr/bin/env bash
python3 ./binding_test.py --debug --stop-at-failure 10 --fdbserver-path $(pwd)/fdbserver --fdbcli-path $(pwd)/fdbcli --libfdb-path $(pwd) --num-ops 1000 --num-hca-ops 100 --concurrency 5 --test-timeout 600

View File

@ -0,0 +1,3 @@
#! /usr/bin/env bash
echo "Binding test timed out"

0
contrib/Joshua/scripts/localClusterStart.sh Normal file → Executable file
View File

View File

@ -52,7 +52,8 @@ def _setup_logs(log_level: int = logging.INFO):
logger.addHandler(stdout_handler)
logger.setLevel(log_level)
# Here we might lose some of the logging from lib
# Here we might lose some of the logging from lib as the logger is set after
# importing the modules
lib_logger = logging.getLogger("lib")
lib_logger.setLevel(log_level)

View File

@ -63,7 +63,8 @@ async def run_fdbservers(num_processes, work_dir, cluster_file, port):
async with lib.local_cluster.FDBServerLocalCluster(
num_processes, work_dir, cluster_file, port
):
await asyncio.sleep(20)
while True:
await asyncio.sleep(1)
def main():

View File

@ -56,7 +56,6 @@ function(add_documentation_target)
${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${target}_done
DEPENDS ${SRCS}
WORKING_DIRECTORY ${venv_dir})
message(STATUS "add_custom_target(${target} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target}_done)")
add_custom_target(${target} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target}_done)
add_dependencies(${target} buildsphinx)
endfunction()
@ -85,7 +84,6 @@ else()
string(MD5 username_hash ${username})
# cmake math function can only use 64 bit signed integers - so we just truncate the string
string(SUBSTRING "${username_hash}" 0 15 username_hash_small)
message(STATUS math(EXPR port "(0x${username_hash_small} % 8000) + 8000" OUTPUT_FORMAT DECIMAL))
math(EXPR port "(0x${username_hash_small} % 8000) + 8000" OUTPUT_FORMAT DECIMAL)
message(STATUS "Port is ${port}")
endif()