mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 05:57:59 +01:00
travis: run tests on macOS native
Review hint: git show -w Co-authored-by: MarcoFalke <falke.marco@gmail.com> Co-authored-by: keneanung <keneanung@googlemail.com> Co-authored-by: Vadim Peretokin <vperetokin@gmail.com>
This commit is contained in:
18
ci/test/00_setup_env_mac_functional.sh
Normal file
18
ci/test/00_setup_env_mac_functional.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
export LC_ALL=C.UTF-8
|
||||
|
||||
export HOST=x86_64-apple-darwin14
|
||||
export BREW_PACKAGES="automake berkeley-db4 libtool boost miniupnpc pkg-config protobuf qt qrencode python3 ccache zeromq"
|
||||
export PIP_PACKAGES="zmq"
|
||||
export OSX_SDK=10.11
|
||||
export RUN_CI_ON_HOST=true
|
||||
export RUN_UNIT_TESTS=true
|
||||
export RUN_FUNCTIONAL_TESTS=true
|
||||
export GOAL="install"
|
||||
export BITCOIN_CONFIG="--enable-gui --enable-bip70 --enable-reduce-exports --enable-werror"
|
||||
export NO_DEPENDS=1
|
||||
@@ -6,6 +6,32 @@
|
||||
|
||||
export LC_ALL=C.UTF-8
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
set +o errexit
|
||||
pushd /usr/local/Homebrew || exit 1
|
||||
git reset --hard origin/master
|
||||
popd || exit 1
|
||||
set -o errexit
|
||||
${CI_RETRY_EXE} brew update
|
||||
# brew upgrade returns an error if any of the packages is already up to date
|
||||
# Failure is safe to ignore, unless we really need an update.
|
||||
brew upgrade $BREW_PACKAGES || true
|
||||
|
||||
# install new packages (brew install returns an error if already installed)
|
||||
for i in $BREW_PACKAGES; do
|
||||
if ! brew list | grep -q $i; then
|
||||
${CI_RETRY_EXE} brew install $i
|
||||
fi
|
||||
done
|
||||
|
||||
export PATH="/usr/local/opt/ccache/libexec:$PATH"
|
||||
OPENSSL_PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
|
||||
export PKG_CONFIG_PATH=$OPENSSL_PKG_CONFIG_PATH:$PKG_CONFIG_PATH
|
||||
|
||||
${CI_RETRY_EXE} pip3 install $PIP_PACKAGES
|
||||
|
||||
fi
|
||||
|
||||
mkdir -p "${BASE_SCRATCH_DIR}"
|
||||
ccache echo "Creating ccache dir if it didn't already exist"
|
||||
|
||||
@@ -42,11 +68,19 @@ else
|
||||
}
|
||||
fi
|
||||
|
||||
DOCKER_EXEC free -m -h
|
||||
DOCKER_EXEC echo "Number of CPUs \(nproc\):" \$\(nproc\)
|
||||
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
top -l 1 -s 0 | awk ' /PhysMem/ {print}'
|
||||
echo "Number of CPUs: $(sysctl -n hw.logicalcpu)"
|
||||
else
|
||||
DOCKER_EXEC free -m -h
|
||||
DOCKER_EXEC echo "Number of CPUs \(nproc\):" \$\(nproc\)
|
||||
fi
|
||||
|
||||
${CI_RETRY_EXE} DOCKER_EXEC apt-get update
|
||||
${CI_RETRY_EXE} DOCKER_EXEC apt-get install --no-install-recommends --no-upgrade -y $PACKAGES $DOCKER_PACKAGES
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" != "osx" ]; then
|
||||
${CI_RETRY_EXE} DOCKER_EXEC apt-get update
|
||||
${CI_RETRY_EXE} DOCKER_EXEC apt-get install --no-install-recommends --no-upgrade -y $PACKAGES $DOCKER_PACKAGES
|
||||
fi
|
||||
|
||||
if [ "$USE_BUSY_BOX" = "true" ]; then
|
||||
echo "Setup to use BusyBox utils"
|
||||
|
||||
@@ -6,19 +6,28 @@
|
||||
|
||||
export LC_ALL=C.UTF-8
|
||||
|
||||
DOCKER_EXEC echo \> \$HOME/.bitcoin # Make sure default datadir does not exist and is never read by creating a dummy file
|
||||
# Make sure default datadir does not exist and is never read by creating a dummy file
|
||||
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
echo > $HOME/Library/Application\ Support/Bitcoin
|
||||
else
|
||||
DOCKER_EXEC echo \> \$HOME/.bitcoin
|
||||
fi
|
||||
|
||||
mkdir -p depends/SDKs depends/sdk-sources
|
||||
if [ "$TRAVIS_OS_NAME" != "osx" ]; then
|
||||
|
||||
mkdir -p depends/SDKs depends/sdk-sources
|
||||
|
||||
if [ -n "$OSX_SDK" ] && [ ! -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then
|
||||
curl --location --fail $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -o depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
|
||||
fi
|
||||
if [ -n "$OSX_SDK" ] && [ -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then
|
||||
tar -C depends/SDKs -xf depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
|
||||
fi
|
||||
if [[ $HOST = *-mingw32 ]]; then
|
||||
DOCKER_EXEC update-alternatives --set $HOST-g++ \$\(which $HOST-g++-posix\)
|
||||
fi
|
||||
if [ -z "$NO_DEPENDS" ]; then
|
||||
DOCKER_EXEC CONFIG_SHELL= make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
|
||||
fi
|
||||
|
||||
if [ -n "$OSX_SDK" ] && [ ! -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then
|
||||
curl --location --fail $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -o depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
|
||||
fi
|
||||
if [ -n "$OSX_SDK" ] && [ -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then
|
||||
tar -C depends/SDKs -xf depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
|
||||
fi
|
||||
if [[ $HOST = *-mingw32 ]]; then
|
||||
DOCKER_EXEC update-alternatives --set $HOST-g++ \$\(which $HOST-g++-posix\)
|
||||
fi
|
||||
if [ -z "$NO_DEPENDS" ]; then
|
||||
DOCKER_EXEC CONFIG_SHELL= make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
|
||||
fi
|
||||
|
||||
@@ -20,7 +20,11 @@ fi
|
||||
END_FOLD
|
||||
|
||||
mkdir -p build
|
||||
|
||||
# Temporarily disable errexit, because Travis macOS fails without error message
|
||||
set +o errexit
|
||||
cd build || (echo "could not enter build directory"; exit 1)
|
||||
set -o errexit
|
||||
|
||||
BEGIN_FOLD configure
|
||||
DOCKER_EXEC ../configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false)
|
||||
@@ -30,7 +34,9 @@ BEGIN_FOLD distdir
|
||||
DOCKER_EXEC make distdir VERSION=$HOST
|
||||
END_FOLD
|
||||
|
||||
set +o errexit
|
||||
cd "bitcoin-$HOST" || (echo "could not enter distdir bitcoin-$HOST"; exit 1)
|
||||
set -o errexit
|
||||
|
||||
BEGIN_FOLD configure
|
||||
DOCKER_EXEC ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false)
|
||||
@@ -43,4 +49,6 @@ BEGIN_FOLD build
|
||||
DOCKER_EXEC make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && DOCKER_EXEC make $GOAL V=1 ; false )
|
||||
END_FOLD
|
||||
|
||||
set +o errexit
|
||||
cd ${BASE_BUILD_DIR} || (echo "could not enter travis build dir $BASE_BUILD_DIR"; exit 1)
|
||||
set -o errexit
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
|
||||
export LC_ALL=C.UTF-8
|
||||
|
||||
# Temporarily disable errexit, because Travis macOS fails without error message
|
||||
set +o errexit
|
||||
cd "build/bitcoin-$HOST" || (echo "could not enter distdir build/bitcoin-$HOST"; exit 1)
|
||||
set -o errexit
|
||||
|
||||
if [ -n "$QEMU_USER_CMD" ]; then
|
||||
BEGIN_FOLD wrap-qemu
|
||||
@@ -46,4 +49,6 @@ if [ "$RUN_FUZZ_TESTS" = "true" ]; then
|
||||
END_FOLD
|
||||
fi
|
||||
|
||||
set +o errexit
|
||||
cd ${BASE_BUILD_DIR} || (echo "could not enter travis build dir $BASE_BUILD_DIR"; exit 1)
|
||||
set -o errexit
|
||||
|
||||
Reference in New Issue
Block a user