This commit is contained in:
Julien Maffre 2021-03-26 16:49:12 +00:00 коммит произвёл GitHub
Родитель 160f899f37
Коммит 51f65034ed
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 76 добавлений и 15 удалений

Просмотреть файл

@ -23,7 +23,7 @@ steps:
- script: | - script: |
sudo apt -y install ./$(pkgname) sudo apt -y install ./$(pkgname)
cat /tmp/install_prefix | xargs -i bash -c "PYTHON_PACKAGE_PATH=../python ./test_install.sh {}" cat /tmp/install_prefix | xargs -i bash -c "PYTHON_PACKAGE_PATH=../python ./test_install.sh {} release"
workingDirectory: build workingDirectory: build
displayName: Test installed CCF displayName: Test installed CCF

Просмотреть файл

@ -26,6 +26,8 @@ parameters:
cmake_args: "-DCMAKE_BUILD_TYPE=Debug -DBUILD_SMALLBANK=OFF -DBUILD_TPCC=OFF" cmake_args: "-DCMAKE_BUILD_TYPE=Debug -DBUILD_SMALLBANK=OFF -DBUILD_TPCC=OFF"
perf: perf:
cmake_args: '-DBUILD_UNIT_TESTS=OFF -DDISTRIBUTE_PERF_TESTS="`../.nodes.sh`"' cmake_args: '-DBUILD_UNIT_TESTS=OFF -DDISTRIBUTE_PERF_TESTS="`../.nodes.sh`"'
release:
cmake_args: "-DTLS_TEST=ON -DENABLE_BFT=OFF"
test: test:
NoSGX: NoSGX:
@ -67,7 +69,7 @@ jobs:
parameters: parameters:
target: SGX target: SGX
env: ${{ parameters.env.SGX }} env: ${{ parameters.env.SGX }}
cmake_args: "${{ parameters.build.common.cmake_args }} -DTLS_TEST=ON" cmake_args: "${{ parameters.build.common.cmake_args }} ${{ parameters.build.release.cmake_args }}"
suffix: "Release" suffix: "Release"
artifact_name: "SGX_Release" artifact_name: "SGX_Release"

Просмотреть файл

@ -47,7 +47,11 @@ configure_file(
) )
configure_file(${CCF_DIR}/python/setup.py.in ${CCF_DIR}/python/setup.py @ONLY) configure_file(${CCF_DIR}/python/setup.py.in ${CCF_DIR}/python/setup.py @ONLY)
set(CONSENSUSES cft bft) if(ENABLE_BFT)
set(CONSENSUSES cft bft)
else()
set(CONSENSUSES cft)
endif()
option(BUILD_TESTS "Build tests" ON) option(BUILD_TESTS "Build tests" ON)
option(BUILD_UNIT_TESTS "Build unit tests" ON) option(BUILD_UNIT_TESTS "Build unit tests" ON)

Просмотреть файл

@ -50,6 +50,11 @@ option(COVERAGE "Enable coverage mapping" OFF)
option(SHUFFLE_SUITE "Shuffle end to end test suite" OFF) option(SHUFFLE_SUITE "Shuffle end to end test suite" OFF)
option(LONG_TESTS "Enable long end-to-end tests" OFF) option(LONG_TESTS "Enable long end-to-end tests" OFF)
option(ENABLE_BFT "Enable experimental BFT consensus at compile time" ON)
if(ENABLE_BFT)
add_compile_definitions(ENABLE_BFT)
endif()
option(DEBUG_CONFIG "Enable non-production options options to aid debugging" option(DEBUG_CONFIG "Enable non-production options options to aid debugging"
OFF OFF
) )

Просмотреть файл

@ -56,6 +56,15 @@ extern "C"
return false; return false;
} }
#ifndef ENABLE_BFT
// As BFT consensus is currently experimental, disable it in release
// enclaves
if (consensus_type != ConsensusType::CFT)
{
return false;
}
#endif
num_pending_threads = (uint16_t)num_worker_threads + 1; num_pending_threads = (uint16_t)num_worker_threads + 1;
if ( if (

Просмотреть файл

@ -784,6 +784,17 @@ int main(int argc, char** argv)
LOG_FATAL_FMT("Start command should be start|join|recover. Exiting."); LOG_FATAL_FMT("Start command should be start|join|recover. Exiting.");
} }
if (consensus == ConsensusType::BFT)
{
#ifdef ENABLE_BFT
LOG_INFO_FMT(
"Selected consensus BFT is experimental in {}", ccf::ccf_version);
#else
LOG_FAIL_FMT(
"Selected consensus BFT is not supported in {}", ccf::ccf_version);
#endif
}
enclave.create_node( enclave.create_node(
enclave_config, enclave_config,
ccf_config, ccf_config,

Просмотреть файл

@ -1,19 +1,42 @@
#!/bin/bash #!/bin/bash
# Copyright (c) Microsoft Corporation. All rights reserved. # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License. # Licensed under the Apache 2.0 License.
set -ex set -e
function service_http_status() function service_http_status()
{ {
curl -o /dev/null -s https://127.0.0.1:8000/app/commit -w "%{http_code}" --key ./workspace/sandbox_common/user0_privk.pem --cert ./workspace/sandbox_common/user0_cert.pem --cacert ./workspace/sandbox_common/networkcert.pem curl -o /dev/null -s https://127.0.0.1:8000/app/commit -w "%{http_code}" --key ./workspace/sandbox_common/user0_privk.pem --cert ./workspace/sandbox_common/user0_cert.pem --cacert ./workspace/sandbox_common/networkcert.pem
} }
if [ "$#" -ne 1 ]; then function poll_for_service_open()
{
network_live_time=$1
polls=0
while [ ! "$(service_http_status)" == "200" ] && [ "${polls}" -lt "${network_live_time}" ]; do
echo "Waiting for service to open..."
polls=$((polls+1))
sleep 1
done
if [ "$(service_http_status)" == "200" ]; then
return 1
fi
return 0
}
if [ "$#" -lt 1 ]; then
echo "Install prefix should be passed as first argument to $0" echo "Install prefix should be passed as first argument to $0"
exit 1 exit 1
fi fi
echo "Install prefix is ${1}" # If "release" is passed as second argument to the script, run additional
# tests at the end of this script
is_release=false
if [ "${2}" == "release" ]; then
echo "Testing release"
is_release=true
fi
# Setup env # Setup env
INSTALL_PREFIX="$1" INSTALL_PREFIX="$1"
@ -30,15 +53,7 @@ network_live_time=60
timeout --signal=SIGINT --kill-after=${network_live_time}s --preserve-status ${network_live_time}s \ timeout --signal=SIGINT --kill-after=${network_live_time}s --preserve-status ${network_live_time}s \
"$INSTALL_PREFIX"/bin/sandbox.sh -e release --verbose & "$INSTALL_PREFIX"/bin/sandbox.sh -e release --verbose &
# Poll until service is open if poll_for_service_open ${network_live_time}; then
polls=0
while [ ! "$(service_http_status)" == "200" ] && [ ${polls} -lt ${network_live_time} ]; do
echo "Waiting for service to open..."
polls=$((polls+1))
sleep 1
done
if [ ! "$(service_http_status)" == "200" ]; then
echo "Error: Timeout waiting for service to open" echo "Error: Timeout waiting for service to open"
kill "$(jobs -p)" kill "$(jobs -p)"
exit 1 exit 1
@ -74,3 +89,18 @@ timeout --signal=SIGINT --kill-after=${recovered_network_live_time}s --preserve-
--ledger-dir 0.ledger \ --ledger-dir 0.ledger \
--common-dir ./workspace/sandbox_common/ --common-dir ./workspace/sandbox_common/
# If the install is a release, run additional tests. Otherwise, exit successfully.
if [ "$is_release" == false ]; then
exit 0
fi
# In release, running a BFT service should not be possible
network_live_time=30
timeout --signal=SIGINT --kill-after=${network_live_time}s --preserve-status ${network_live_time}s \
"$INSTALL_PREFIX"/bin/sandbox.sh -e release --consensus=bft --verbose &
if ! poll_for_service_open ${network_live_time}; then
echo "Error: Experimental BFT consensus should not be allowed in release install"
kill "$(jobs -p)"
exit 1
fi