Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make setup-env.sh compatible with dash #4048

Merged
merged 3 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ ignore:
- lib/spack/spack/test/.*
- lib/spack/docs/.*
- lib/spack/external/.*
- share/spack/qa/.*
- share/spack/spack-completion.bash

comment: off
33 changes: 10 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,6 @@ jobs:
os: linux
language: python
env: [ TEST_SUITE=unit, COVERAGE=true ]
addons:
apt:
packages:
- cmake
- gfortran
- graphviz
- gnupg2
- kcov
- mercurial
- ninja-build
- perl
- perl-base
- realpath
- patchelf
- r-base
- r-base-core
- r-base-dev

- python: '3.7'
sudo: required
os: linux
Expand Down Expand Up @@ -159,13 +141,16 @@ addons:
- r-base
- r-base-core
- r-base-dev
- zsh
# for Mac builds, we use Homebrew
homebrew:
packages:
- python@2
- gcc
- gnupg2
- ccache
- dash
- kcov
update: true

# ~/.ccache needs to be cached directly as Travis is not taking care of it
Expand Down Expand Up @@ -223,11 +208,13 @@ script:

after_success:
- ccache -s
- if [[ "$TEST_SUITE" == "unit" || "$TEST_SUITE" == "build" ]]; then
codecov --env PYTHON_VERSION
--required
--flags "${TEST_SUITE}${TRAVIS_OS_NAME}";
fi
- case "$TEST_SUITE" in
unit)
codecov --env PYTHON_VERSION
--required
--flags "${TEST_SUITE}${TRAVIS_OS_NAME}";
;;
esac

#=============================================================================
# Notifications
Expand Down
30 changes: 30 additions & 0 deletions share/spack/qa/run-unit-tests
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
# Optionally add one or more unit tests
# to only run these tests.
#

#-----------------------------------------------------------
# Run a few initial commands and set up test environment
#-----------------------------------------------------------
ORIGINAL_PATH="$PATH"

. "$(dirname $0)/setup.sh"
check_dependencies ${coverage} git hg svn

Expand All @@ -33,9 +39,33 @@ bin/spack help -a
# Profile and print top 20 lines for a simple call to spack spec
bin/spack -p --lines 20 spec mpileaks%gcc ^elfutils@0.170

#-----------------------------------------------------------
# Run unit tests with code coverage
#-----------------------------------------------------------
extra_args=""
if [[ -n "$@" ]]; then
extra_args="-k $@"
fi
${coverage_run} bin/spack test --verbose "$extra_args"

#-----------------------------------------------------------
# Run tests for setup-env.sh
#-----------------------------------------------------------
# Clean the environment by removing Spack from the path and getting rid of
# the spack shell function
export PATH="$ORIGINAL_PATH"
unset spack

# start in the spack root directory
cd $SPACK_ROOT

# Run bash tests with coverage enabled, but pipe output to /dev/null
# because it seems that kcov seems to undo the script's redirection
if [ "$BASH_COVERAGE" = true ]; then
${QA_DIR}/bashcov ${QA_DIR}/setup-env-test.sh &> /dev/null
fi

# run the test scripts for their output (these will print nicely)
bash ${QA_DIR}/setup-env-test.sh
zsh ${QA_DIR}/setup-env-test.sh
dash ${QA_DIR}/setup-env-test.sh