From 904a175be4d65028100fb67aaa5a7e802a8ac351 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 4 Apr 2019 12:07:32 -0400 Subject: [PATCH] Parameterize venv and source paths more --- .circleci/config.yml | 4 ++++ .circleci/run-tests.sh | 21 +++++++++++++++++---- .circleci/setup-virtualenv.sh | 19 ++++++++++++++++--- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6fe3ea34c..ccfcaa838 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,6 +89,8 @@ jobs: name: "Setup virtualenv" command: | sudo --set-home -u nobody /tmp/project/.circleci/setup-virtualenv.sh \ + "/tmp/venv" \ + "/tmp/project" \ "${TAHOE_LAFS_TOX_ENVIRONMENT}" \ "${TAHOE_LAFS_TOX_ARGS}" @@ -96,6 +98,8 @@ jobs: name: "Run test suite" command: | /tmp/project/.circleci/run-tests.sh \ + "/tmp/venv" \ + "/tmp/project" \ "${ARTIFACTS_OUTPUT_PATH}" \ "${TAHOE_LAFS_TOX_ENVIRONMENT}" \ "${TAHOE_LAFS_TOX_ARGS}" diff --git a/.circleci/run-tests.sh b/.circleci/run-tests.sh index 618b7c60d..797dd8ab1 100755 --- a/.circleci/run-tests.sh +++ b/.circleci/run-tests.sh @@ -1,4 +1,17 @@ -#!/bin/bash -e +#!/bin/bash + +# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ +set -euxo pipefail + +# The filesystem location of the root of a virtualenv we can use to get/build +# wheels. +BOOTSTRAP_VENV="$1" +shift + +# The filesystem location of the root of the project source. We need this to +# know what wheels to get/build, of course. +PROJECT_ROOT="$1" +shift ARTIFACTS=$1 shift @@ -40,8 +53,8 @@ sudo \ PIP_NO_INDEX="1" \ --set-home \ --user nobody \ - /tmp/tests/bin/tox \ - -c /tmp/project/tox.ini \ + ${BOOTSTRAP_VENV}/bin/tox \ + -c ${PROJECT_ROOT}/tox.ini \ --workdir /tmp/tahoe-lafs.tox \ -e "${TAHOE_LAFS_TOX_ENVIRONMENT}" \ ${TAHOE_LAFS_TOX_ARGS} @@ -49,5 +62,5 @@ sudo \ if [ -n "${ARTIFACTS}" ]; then # Create a junitxml results area. mkdir -p "$(dirname "${JUNITXML}")" - /tmp/tests/bin/subunit2junitxml < "${SUBUNIT2}" > "${JUNITXML}" + ${BOOTSTRAP_VENV}/bin/subunit2junitxml < "${SUBUNIT2}" > "${JUNITXML}" fi diff --git a/.circleci/setup-virtualenv.sh b/.circleci/setup-virtualenv.sh index 579547d0f..7764dd1bb 100755 --- a/.circleci/setup-virtualenv.sh +++ b/.circleci/setup-virtualenv.sh @@ -1,4 +1,17 @@ -#!/bin/bash -e +#!/bin/bash + +# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ +set -euxo pipefail + +# The filesystem location of the root of a virtualenv we can use to get/build +# wheels. +BOOTSTRAP_VENV="$1" +shift + +# The filesystem location of the root of the project source. We need this to +# know what wheels to get/build, of course. +PROJECT_ROOT="$1" +shift TAHOE_LAFS_TOX_ENVIRONMENT=$1 shift @@ -7,8 +20,8 @@ TAHOE_LAFS_TOX_ARGS=$1 shift || : # Get everything else installed in it, too. -/tmp/tests/bin/tox \ - -c /tmp/project/tox.ini \ +"${BOOTSTRAP_VENV}"/bin/tox \ + -c "${PROJECT_ROOT}"/tox.ini \ --workdir /tmp/tahoe-lafs.tox \ --notest \ -e "${TAHOE_LAFS_TOX_ENVIRONMENT}" \