68 lines
1.3 KiB
Bash
Executable File
68 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Description:
|
|
# Runs Spack unit tests.
|
|
#
|
|
# Usage:
|
|
# run-unit-tests [test ...]
|
|
#
|
|
# Options:
|
|
# 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"
|
|
|
|
# Move to root directory of Spack
|
|
# Allows script to be run from anywhere
|
|
cd "$SPACK_ROOT"
|
|
|
|
# Array of directories containing core Spack framework
|
|
core_dirs=(
|
|
bin
|
|
etc
|
|
# lib, but skip documentation
|
|
lib/spack/env
|
|
lib/spack/external
|
|
lib/spack/llnl
|
|
lib/spack/spack
|
|
share
|
|
)
|
|
|
|
# Gather array of changed files
|
|
changed=($("$QA_DIR/changed_files" "${core_dirs[@]}"))
|
|
|
|
# Exit if no core Spack framework files were modified
|
|
if [[ ! "${changed[@]}" ]]; then
|
|
echo "No core Spack framework files were modified."
|
|
exit 0
|
|
fi
|
|
|
|
# Run integration tests
|
|
# TODO: should these be separated into a different test suite?
|
|
source "$SPACK_ROOT/share/spack/setup-env.sh"
|
|
spack compilers
|
|
spack config get compilers
|
|
spack install -v libdwarf
|
|
|
|
# Run unit tests with code coverage
|
|
coverage run bin/spack test "$@"
|