diff --git a/.circleci/bootstrap-test-environment.sh b/.circleci/bootstrap-test-environment.sh index d21e2cd1d..193a3443b 100755 --- a/.circleci/bootstrap-test-environment.sh +++ b/.circleci/bootstrap-test-environment.sh @@ -3,6 +3,9 @@ PROJECT=$1 shift +EXTRA_PACKAGES=$1 +shift + # Avoid the /nonexistent home directory in nobody's /etc/passwd entry. usermod --home /tmp/nobody nobody diff --git a/.circleci/config.yml b/.circleci/config.yml index face66f84..1acec54b1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -227,17 +227,17 @@ jobs: - run: <<: *BOOTSTRAP_TEST_ENVIRONMENT command: | - sudo --preserve-env ~/project/.circleci/bootstrap-test-environment.sh ~/project + sudo ~/project/.circleci/bootstrap-test-environment.sh ~/project "${EXTRA_PACKAGES}" - run: <<: *SETUP_VIRTUALENV command: | - sudo --preserve-env /tmp/project/.circleci/setup-virtualenv.sh + sudo /tmp/project/.circleci/setup-virtualenv.sh "${TAHOE_LAFS_TOX_ENVIRONMENT}" ${TAHOE_LAFS_TOX_ARGS} - run: <<: *RUN_TESTS command: | - sudo --preserve-env /tmp/project/.circleci/run-tests.sh + sudo /tmp/project/.circleci/run-tests.sh "${TAHOE_LAFS_TOX_ENVIRONMENT}" ${TAHOE_LAFS_TOX_ARGS} - store_artifacts: *STORE_TEST_LOG - store_artifacts: *STORE_OTHER_ARTIFACTS diff --git a/.circleci/run-tests.sh b/.circleci/run-tests.sh index 6b6329e8c..9b7091269 100755 --- a/.circleci/run-tests.sh +++ b/.circleci/run-tests.sh @@ -1,5 +1,11 @@ #!/bin/bash -e +TAHOE_LAFS_TOX_ENVIRONMENT=$1 +shift + +TAHOE_LAFS_TOX_ARGS=$1 +shift + # Run the test suite as a non-root user. This is the expected usage some # small areas of the test suite assume non-root privileges (such as unreadable # files being unreadable). @@ -7,4 +13,4 @@ # Also run with /tmp as a workdir because the non-root user won't be able to # create the tox working filesystem state in the source checkout because it is # owned by root. -sudo --set-home -u nobody /tmp/tests/bin/tox -c /tmp/project/tox.ini --workdir /tmp -e ${TAHOE_LAFS_TOX_ENVIRONMENT} +sudo --set-home -u nobody /tmp/tests/bin/tox -c /tmp/project/tox.ini --workdir /tmp -e "${TAHOE_LAFS_TOX_ENVIRONMENT}" ${TAHOE_LAFS_TOX_ARGS} diff --git a/.circleci/setup-virtualenv.sh b/.circleci/setup-virtualenv.sh index b08272d0e..97d7825d4 100755 --- a/.circleci/setup-virtualenv.sh +++ b/.circleci/setup-virtualenv.sh @@ -1,5 +1,11 @@ #!/bin/bash -e +TAHOE_LAFS_TOX_ENVIRONMENT=$1 +shift + +TAHOE_LAFS_TOX_ARGS=$1 +shift + # Set up the virtualenv as a non-root user so we can run the test suite as a # non-root user. See below. sudo --set-home -u nobody virtualenv --python python2.7 /tmp/tests