Separate integration tests; simplify test scripts (#4006)

* Separate build integration tests; simplify test scripts

- Move build tests out of the regular Travis unit tests, add more smoke
  test packages to build.

- Run all test scripts with bash -e, which fails on error.

- Factor coverage out into a Travis environment variable, so it's more
  obvious from .travis.yml which tests contribute to coverage and which
  don't.

- Factor dependency checking and much of the front-matter in tests
  scripts into a setup.sh script, which is sourced by all the test
  scripts.  Extra cruft in each tests script now reduced to 2 lines at
  the beginning.
This commit is contained in:
Todd Gamblin
2017-04-27 11:47:56 -07:00
committed by GitHub
parent a0ebce0cb3
commit bb5a433a46
7 changed files with 172 additions and 177 deletions

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash -e
#
# Description:
# Runs Spack unit tests.
@@ -10,44 +10,16 @@
# Optionally add one or more unit tests
# to only run these tests.
#
# Notes:
# Requires coverage, git, mercurial, and subversion.
#
QA_DIR="$(dirname "$0")"
SPACK_ROOT="$QA_DIR/../../.."
# Array of dependencies
deps=(
coverage
git
hg
svn
)
# Check for dependencies
"$QA_DIR/check_dependencies" "${deps[@]}" || exit 1
# Add Spack to the PATH.
export PATH="$SPACK_ROOT/bin:$PATH"
. "$(dirname $0)/setup.sh"
check_dependencies ${coverage} git hg svn
# Move to root directory of Spack
# Allows script to be run from anywhere
cd "$SPACK_ROOT"
# Run integration tests
# TODO: should these be separated into a different test suite?
source "$SPACK_ROOT/share/spack/setup-env.sh"
spack compilers
# Print compiler information
spack config get compilers
# Run unit tests with code coverage
py_ver=$(python -c 'import platform; print(platform.python_version())')
if [[ "$py_ver" == 2.7* || "$py_ver" == 3.6* ]];
then
coverage run bin/spack install -v libdwarf
coverage run bin/spack test "$@" && coverage combine
else
spack install -v libdwarf
spack test "$@"
fi
${coverage_run} bin/spack test "$@"
${coverage_combine}