Changeset View
Changeset View
Standalone View
Standalone View
contrib/teamcity/build.sh
#!/usr/bin/env bash | #!/usr/bin/env bash | ||||
set -eu | set -eu | ||||
TOPLEVEL=`git rev-parse --show-toplevel` | TOPLEVEL=$(git rev-parse --show-toplevel) | ||||
if [[ -z "${TOPLEVEL}" ]]; then | if [[ -z "${TOPLEVEL}" ]]; then | ||||
echo "No .git directory found, assuming pwd" | echo "No .git directory found, assuming pwd" | ||||
TOPLEVEL=`pwd -P` | TOPLEVEL=$(pwd -P) | ||||
fi | fi | ||||
BUILD_DIR="${TOPLEVEL}/build" | BUILD_DIR="${TOPLEVEL}/build" | ||||
mkdir -p ${BUILD_DIR} | mkdir -p ${BUILD_DIR} | ||||
## Generate necessary autoconf files | ## Generate necessary autoconf files | ||||
cd ${TOPLEVEL} | cd ${TOPLEVEL} | ||||
./autogen.sh | ./autogen.sh | ||||
cd ${BUILD_DIR} | cd ${BUILD_DIR} | ||||
rm -f build.status test_bitcoin.xml | rm -f build.status test_bitcoin.xml | ||||
## Determine the number of build threads | ## Determine the number of build threads | ||||
THREADS=$(nproc || sysctl -n hw.ncpu) | THREADS=$(nproc || sysctl -n hw.ncpu) | ||||
# Default to nothing | # Default to nothing | ||||
: ${DISABLE_WALLET:=} | : "${DISABLE_WALLET:=}" | ||||
: ${CONFIGURE_FLAGS:=} | : "${CONFIGURE_FLAGS:=}" | ||||
CONFIGURE_FLAGS=($CONFIGURE_FLAGS "--prefix=`pwd`") | CONFIGURE_FLAGS=("$CONFIGURE_FLAGS" "--prefix=$(pwd)") | ||||
if [[ ! -z "${DISABLE_WALLET}" ]]; then | if [[ -n "${DISABLE_WALLET}" ]]; then | ||||
echo "*** Building without wallet" | echo "*** Building without wallet" | ||||
CONFIGURE_FLAGS+=("--disable-wallet") | CONFIGURE_FLAGS+=("--disable-wallet") | ||||
fi | fi | ||||
../configure "${CONFIGURE_FLAGS[@]}" | ../configure "${CONFIGURE_FLAGS[@]}" | ||||
# Base directories for sanitizer related files | # Base directories for sanitizer related files | ||||
SAN_SUPP_DIR="${TOPLEVEL}/test/sanitizer_suppressions" | SAN_SUPP_DIR="${TOPLEVEL}/test/sanitizer_suppressions" | ||||
Show All 16 Lines | do | ||||
cat "${log}" | cat "${log}" | ||||
done | done | ||||
} | } | ||||
# Run build | # Run build | ||||
make -j ${THREADS} | make -j ${THREADS} | ||||
# Default to nothing | # Default to nothing | ||||
: ${DISABLE_TESTS:=} | : "${DISABLE_TESTS:=}" | ||||
# If DISABLE_TESTS is unset (default), run the tests | # If DISABLE_TESTS is unset (default), run the tests | ||||
if [[ -z "${DISABLE_TESTS}" ]]; then | if [[ -z "${DISABLE_TESTS}" ]]; then | ||||
echo "*** Running tests" | echo "*** Running tests" | ||||
# Run unit tests | # Run unit tests | ||||
make -j ${THREADS} check || (print_sanitizers_log && exit 1) | make -j ${THREADS} check || (print_sanitizers_log && exit 1) | ||||
mkdir -p output/ | mkdir -p output/ | ||||
BRANCH=$(git rev-parse --abbrev-ref HEAD) | BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||||
JUNIT_DEFAULT="junit_results_default.xml" | JUNIT_DEFAULT="junit_results_default.xml" | ||||
JUNIT_NEXT_UPGRADE="junit_results_next_upgrade.xml" | JUNIT_NEXT_UPGRADE="junit_results_next_upgrade.xml" | ||||
if [[ ! -z "${DISABLE_WALLET}" ]]; then | if [[ -n "${DISABLE_WALLET}" ]]; then | ||||
echo "Skipping rpc testing due to disabled wallet functionality." | echo "Skipping rpc testing due to disabled wallet functionality." | ||||
elif [[ "${BRANCH}" == "master" ]]; then | elif [[ "${BRANCH}" == "master" ]]; then | ||||
./test/functional/test_runner.py -J="${JUNIT_DEFAULT}" --cutoff=600 --tmpdirprefix=output | ./test/functional/test_runner.py -J="${JUNIT_DEFAULT}" --cutoff=600 --tmpdirprefix=output | ||||
./test/functional/test_runner.py -J="${JUNIT_NEXT_UPGRADE}" --cutoff=600 --tmpdirprefix=output --with-gravitonactivation | ./test/functional/test_runner.py -J="${JUNIT_NEXT_UPGRADE}" --cutoff=600 --tmpdirprefix=output --with-gravitonactivation | ||||
else | else | ||||
./test/functional/test_runner.py -J="${JUNIT_DEFAULT}" --tmpdirprefix=output | ./test/functional/test_runner.py -J="${JUNIT_DEFAULT}" --tmpdirprefix=output | ||||
./test/functional/test_runner.py -J="${JUNIT_NEXT_UPGRADE}" --tmpdirprefix=output --with-gravitonactivation | ./test/functional/test_runner.py -J="${JUNIT_NEXT_UPGRADE}" --tmpdirprefix=output --with-gravitonactivation | ||||
fi | fi | ||||
else | else | ||||
echo "*** Tests have been skipped" | echo "*** Tests have been skipped" | ||||
fi | fi | ||||