Fix `sandbox.sh` to work on multiple platforms (#4412)

This commit is contained in:
Julien Maffre 2022-10-26 19:44:53 +01:00 коммит произвёл GitHub
Родитель 0428995fe9
Коммит f1e122ef87
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 17 добавлений и 5 удалений

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

@ -40,6 +40,10 @@ include(GNUInstallDirs)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/common.cmake)
# 3.0 temporary way to identify platform from Debian package
file(WRITE ${CMAKE_BINARY_DIR}/PLATFORM "${COMPILE_TARGET}")
install(FILES ${CMAKE_BINARY_DIR}/PLATFORM DESTINATION share)
set(CMAKE_GENERATED_COMMENT
"This file was auto-generated by CMake from a corresponding *.in file. DO NOT EDIT"
)

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

@ -77,7 +77,7 @@ if [ -n "$PYTHON_PACKAGE_PATH" ]; then
fi
echo "** Start original service"
"${ccf_install_path}"/bin/sandbox.sh -e release --sig-tx-interval "${signature_tx_interval}" &
"${ccf_install_path}"/bin/sandbox.sh --sig-tx-interval "${signature_tx_interval}" &
sandbox_pid=$!
network_live_time=60
@ -113,7 +113,7 @@ fi
echo "** Recover service"
seconds_before_recovery=$SECONDS
# shellcheck disable=SC2086
"${ccf_install_path}"/bin/sandbox.sh -e release --recover --ledger-dir $LEDGER_DIR --common-dir ./workspace/sandbox_common --ledger-recovery-timeout 1000 ${recovery_snapshot_dir_args} &
"${ccf_install_path}"/bin/sandbox.sh --recover --ledger-dir $LEDGER_DIR --common-dir ./workspace/sandbox_common --ledger-recovery-timeout 1000 ${recovery_snapshot_dir_args} &
network_live_time=600
if poll_for_service_open ${network_live_time}; then
echo "Error: Timeout waiting for service to open"

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

@ -12,6 +12,9 @@ VERSION_FILE="${PATH_HERE}"/../share/VERSION_LONG
is_package_specified=false
is_js_bundle_specified=false
PLATFORM_FILE="${PATH_HERE}"/../share/PLATFORM
enclave_type="virtual"
extra_args=("$@")
while [ "$1" != "" ]; do
case $1 in
@ -50,6 +53,12 @@ if [ -f "${VERSION_FILE}" ]; then
START_NETWORK_SCRIPT="${PATH_HERE}"/start_network.py
VERSION=$(<"${VERSION_FILE}")
VERSION=${VERSION#"ccf-"}
platform=$(<"${PLATFORM_FILE}")
if [ "${platform}" == "sgx" ]; then
enclave_type="release"
else
enclave_type="virtual"
fi
if [ ${is_package_specified} == false ] && [ ${is_js_bundle_specified} == false ]; then
# Only on install tree, default to installed js logging app
echo "No package/app specified. Defaulting to installed JS logging app"
@ -80,7 +89,7 @@ echo "Python environment successfully setup"
export CURL_CLIENT=ON
exec python "${START_NETWORK_SCRIPT}" \
--binary-dir "${BINARY_DIR}" \
--enclave-type virtual \
--enclave-type "${enclave_type}" \
--initial-member-count 1 \
--constitution "${PATH_HERE}"/actions.js \
--constitution "${PATH_HERE}"/validate.js \

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

@ -43,7 +43,7 @@ cd "$working_dir"
# Start ephemeral network in the background
network_live_time=120
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 --verbose &
if poll_for_service_open ${network_live_time}; then
echo "Error: Timeout waiting for service to open"
@ -71,7 +71,6 @@ cp -r ./workspace/sandbox_0/0.ledger .
recovered_network_live_time=120
timeout --signal=SIGINT --kill-after=${recovered_network_live_time}s --preserve-status ${recovered_network_live_time}s \
"$INSTALL_PREFIX"/bin/sandbox.sh --verbose \
-e release \
--recover \
--ledger-dir 0.ledger \
--common-dir ./workspace/sandbox_common/