From 2c1e51e6b72585fe20ffc939e120fec41cc1a05f Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 4 Nov 2019 08:23:04 -0500 Subject: [PATCH] Merge #17233: travis: Run unit and functional tests on native arm facc0da63a8fa4bd6fc2782cbe92eb9f920f2256 travis: Run unit and functional tests on native arm (MarcoFalke) fafa064d2a8dbe24303545ab582ec84cde52ab5b ci: Remove ccache requirement on the host (MarcoFalke) Pull request description: This keeps the cross-compilation to make it easy to run the ci on non-arm hardware. To run this locally in qemu-user as it used to be, just `export QEMU_USER_CMD="qemu-arm -L /usr/arm-linux-gnueabihf/"`. ACKs for top commit: laanwj: LGTM ACK facc0da63a8fa4bd6fc2782cbe92eb9f920f2256 practicalswift: ACK facc0da63a8fa4bd6fc2782cbe92eb9f920f2256 -- diff looks correct and Travis seems happy Tree-SHA512: 0dc1bc82eb93e2bd8b159e044f20fe3055f8cdfd73aaa238bd2e178397582144dfc0c6a87bd8270115dafea1a623e642bde5d5f30254f94140f1a2cdb12fc2da --- .cirrus.yml | 2 -- .travis.yml | 4 +++- ci/README.md | 2 +- ci/test/00_setup_env_arm.sh | 11 ++++++++--- ci/test/04_install.sh | 6 +++++- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 75c17cfa48..e65a565301 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -44,8 +44,6 @@ task: folder: "/tmp/ccache_dir" depends_built_cache: folder: "/tmp/cirrus-ci-build/depends/built" - depends_sdk_cache: - folder: "/tmp/cirrus-ci-build/depends/sdk-sources" install_script: - apt-get update - apt-get -y install git bash ccache diff --git a/.travis.yml b/.travis.yml index bd5f2d7968..e70490f3b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -225,9 +225,11 @@ after_success: - set -o errexit; source ./ci/lint/06_script.sh - stage: test - name: 'ARM [GOAL: install] [unit tests, no functional tests]' + name: 'ARM [GOAL: install] [unit tests, functional tests]' + arch: arm64 env: >- FILE_ENV="./ci/test/00_setup_env_arm.sh" + QEMU_USER_CMD="" # Can run the tests natively without qemu - stage: test name: 'S390x [GOAL: install] [unit tests, functional tests]' diff --git a/ci/README.md b/ci/README.md index 16c481158f..fb1cd7460b 100644 --- a/ci/README.md +++ b/ci/README.md @@ -12,7 +12,7 @@ To allow for a wide range of tested environments, but also ensure reproducibilit requires `docker` to be installed. To install all requirements on Ubuntu, run ``` -sudo apt install docker.io ccache bash git +sudo apt install docker.io bash git ``` To run the default test stage, diff --git a/ci/test/00_setup_env_arm.sh b/ci/test/00_setup_env_arm.sh index 9335f0b337..6e2542584c 100644 --- a/ci/test/00_setup_env_arm.sh +++ b/ci/test/00_setup_env_arm.sh @@ -7,11 +7,16 @@ export LC_ALL=C.UTF-8 export HOST=arm-linux-gnueabihf -export QEMU_USER_CMD="qemu-arm -L /usr/arm-linux-gnueabihf/" -export PACKAGES="python3 g++-arm-linux-gnueabihf busybox qemu-user" +# The host arch is unknown, so we run the tests through qemu. +# If the host is arm and wants to run the tests natively, it can set QEMU_USER_CMD to the empty string. +export QEMU_USER_CMD="${QEMU_USER_CMD:"qemu-arm -L /usr/arm-linux-gnueabihf/"}" +# We don't know whether the host can run the cross compiled binaries. To run them, either qemu-user or libc6:armhf for +# the target is required, so install both. +export DPKG_ADD_ARCH="armhf" +export PACKAGES="python3 g++-arm-linux-gnueabihf busybox qemu-user libc6:armhf libstdc++6:armhf libfontconfig1:armhf libxcb1:armhf" export USE_BUSY_BOX=true export RUN_UNIT_TESTS=true -export RUN_FUNCTIONAL_TESTS=false +export RUN_FUNCTIONAL_TESTS=true export GOAL="install" # -Wno-psabi is to disable ABI warnings: "note: parameter passing for argument of type ... changed in GCC 7.1" # This could be removed once the ABI change warning does not show up by default diff --git a/ci/test/04_install.sh b/ci/test/04_install.sh index 3359c82b6c..d8febcaab8 100755 --- a/ci/test/04_install.sh +++ b/ci/test/04_install.sh @@ -7,7 +7,7 @@ export LC_ALL=C.UTF-8 mkdir -p "${BASE_SCRATCH_DIR}" -ccache echo "Creating ccache dir if it didn't already exist" +mkdir -p "${CCACHE_DIR}" if [ ! -d ${DIR_QA_ASSETS} ]; then git clone https://github.com/bitcoin-core/qa-assets ${DIR_QA_ASSETS} @@ -44,6 +44,10 @@ export -f DOCKER_EXEC DOCKER_EXEC free -m -h DOCKER_EXEC echo "Number of CPUs \(nproc\):" \$\(nproc\) +if [ -n "$DPKG_ADD_ARCH" ]; then + DOCKER_EXEC dpkg --add-architecture "$DPKG_ADD_ARCH" +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