Changeset View
Changeset View
Standalone View
Standalone View
contrib/teamcity/build-configurations.sh
#!/usr/bin/env bash | #!/usr/bin/env bash | ||||
export LC_ALL=C.UTF-8 | export LC_ALL=C.UTF-8 | ||||
set -euxo pipefail | set -euxo pipefail | ||||
: "${ABC_BUILD_NAME:=""}" | : "${ABC_BUILD_NAME:=""}" | ||||
if [ -z "$ABC_BUILD_NAME" ]; then | if [ -z "${ABC_BUILD_NAME}" ]; then | ||||
echo "Error: Environment variable ABC_BUILD_NAME must be set" | echo "Error: Environment variable ABC_BUILD_NAME must be set" | ||||
exit 1 | exit 1 | ||||
fi | fi | ||||
echo "Running build configuration '${ABC_BUILD_NAME}'..." | echo "Running build configuration '${ABC_BUILD_NAME}'..." | ||||
TOPLEVEL=$(git rev-parse --show-toplevel) | TOPLEVEL=$(git rev-parse --show-toplevel) | ||||
export TOPLEVEL | export TOPLEVEL | ||||
setup() { | setup() { | ||||
: "${BUILD_DIR:=${TOPLEVEL}/build}" | # Use separate build dirs to get the most out of ccache and prevent crosstalk | ||||
: "${BUILD_DIR:=${TOPLEVEL}/${ABC_BUILD_NAME}}" | |||||
mkdir -p "${BUILD_DIR}" | mkdir -p "${BUILD_DIR}" | ||||
BUILD_DIR=$(cd "${BUILD_DIR}"; pwd) | BUILD_DIR=$(cd "${BUILD_DIR}"; pwd) | ||||
export BUILD_DIR | export BUILD_DIR | ||||
cd "${BUILD_DIR}" | cd "${BUILD_DIR}" | ||||
# Determine the number of build threads | # Determine the number of build threads | ||||
THREADS=$(nproc || sysctl -n hw.ncpu) | THREADS=$(nproc || sysctl -n hw.ncpu) | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | build-asan) | ||||
CMAKE_FLAGS=( | CMAKE_FLAGS=( | ||||
"-DCMAKE_CXX_FLAGS=-DARENA_DEBUG" | "-DCMAKE_CXX_FLAGS=-DARENA_DEBUG" | ||||
"-DCMAKE_BUILD_TYPE=Debug" | "-DCMAKE_BUILD_TYPE=Debug" | ||||
# ASAN does not support assembly code: https://github.com/google/sanitizers/issues/192 | # ASAN does not support assembly code: https://github.com/google/sanitizers/issues/192 | ||||
# This will trigger a segfault if the SSE4 implementation is selected for SHA256. | # This will trigger a segfault if the SSE4 implementation is selected for SHA256. | ||||
# Disabling the assembly works around the issue. | # Disabling the assembly works around the issue. | ||||
"-DCRYPTO_USE_ASM=OFF" | "-DCRYPTO_USE_ASM=OFF" | ||||
"-DENABLE_SANITIZERS=address" | "-DENABLE_SANITIZERS=address" | ||||
"-DCCACHE=OFF" | |||||
"-DCMAKE_C_COMPILER=clang" | "-DCMAKE_C_COMPILER=clang" | ||||
"-DCMAKE_CXX_COMPILER=clang++" | "-DCMAKE_CXX_COMPILER=clang++" | ||||
) | ) | ||||
CMAKE_FLAGS="${CMAKE_FLAGS[*]}" "${DEVTOOLS_DIR}"/build_cmake.sh --Werror | CMAKE_FLAGS="${CMAKE_FLAGS[*]}" "${DEVTOOLS_DIR}"/build_cmake.sh --Werror | ||||
run_test_bitcoin "with address sanitizer" | run_test_bitcoin "with address sanitizer" | ||||
# Libs and utils tests | # Libs and utils tests | ||||
ninja \ | ninja \ | ||||
check-bitcoin-qt \ | check-bitcoin-qt \ | ||||
check-bitcoin-seeder \ | check-bitcoin-seeder \ | ||||
check-bitcoin-util \ | check-bitcoin-util \ | ||||
ninja check-functional | ninja check-functional | ||||
;; | ;; | ||||
build-ubsan) | build-ubsan) | ||||
# Build with the undefined sanitizer, then run unit tests and functional tests. | # Build with the undefined sanitizer, then run unit tests and functional tests. | ||||
CMAKE_FLAGS=( | CMAKE_FLAGS=( | ||||
"-DCMAKE_BUILD_TYPE=Debug" | "-DCMAKE_BUILD_TYPE=Debug" | ||||
"-DENABLE_SANITIZERS=undefined" | "-DENABLE_SANITIZERS=undefined" | ||||
"-DCCACHE=OFF" | |||||
"-DCMAKE_C_COMPILER=clang" | "-DCMAKE_C_COMPILER=clang" | ||||
"-DCMAKE_CXX_COMPILER=clang++" | "-DCMAKE_CXX_COMPILER=clang++" | ||||
) | ) | ||||
CMAKE_FLAGS="${CMAKE_FLAGS[*]}" "${DEVTOOLS_DIR}"/build_cmake.sh --Werror | CMAKE_FLAGS="${CMAKE_FLAGS[*]}" "${DEVTOOLS_DIR}"/build_cmake.sh --Werror | ||||
run_test_bitcoin "with undefined sanitizer" | run_test_bitcoin "with undefined sanitizer" | ||||
# Libs and utils tests | # Libs and utils tests | ||||
ninja \ | ninja \ | ||||
check-bitcoin-qt \ | check-bitcoin-qt \ | ||||
check-bitcoin-seeder \ | check-bitcoin-seeder \ | ||||
check-bitcoin-util \ | check-bitcoin-util \ | ||||
ninja check-functional | ninja check-functional | ||||
;; | ;; | ||||
build-tsan) | build-tsan) | ||||
# Build with the thread sanitizer, then run unit tests and functional tests. | # Build with the thread sanitizer, then run unit tests and functional tests. | ||||
CMAKE_FLAGS=( | CMAKE_FLAGS=( | ||||
"-DENABLE_SANITIZERS=thread" | "-DENABLE_SANITIZERS=thread" | ||||
"-DCCACHE=OFF" | |||||
"-DCMAKE_C_COMPILER=clang" | "-DCMAKE_C_COMPILER=clang" | ||||
"-DCMAKE_CXX_COMPILER=clang++" | "-DCMAKE_CXX_COMPILER=clang++" | ||||
) | ) | ||||
CMAKE_FLAGS="${CMAKE_FLAGS[*]}" "${DEVTOOLS_DIR}"/build_cmake.sh --Werror | CMAKE_FLAGS="${CMAKE_FLAGS[*]}" "${DEVTOOLS_DIR}"/build_cmake.sh --Werror | ||||
run_test_bitcoin "with thread sanitizer" | run_test_bitcoin "with thread sanitizer" | ||||
# Libs and utils tests | # Libs and utils tests | ||||
▲ Show 20 Lines • Show All 341 Lines • Show Last 20 Lines |