summaryrefslogtreecommitdiff
path: root/share/spack/qa/run-unit-tests
blob: 706720c0335fc744b811b33fd086980e4fdc3462 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash -e
#
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

#
# Description:
#     Runs Spack unit tests.
#
# Usage:
#     run-unit-tests [test ...]
#
# Options:
#     Optionally add one or more unit tests
#     to only run these tests.
#
. "$(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"

# Print compiler information
spack config get compilers

# Run spack help to cover command import
${coverage_run} bin/spack -h
${coverage_run} bin/spack help -a

# Profile and print top 20 lines for a simple call to spack spec
if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then
    ${coverage_run} bin/spack -p --lines 20 spec mpileaks%gcc ^elfutils@0.170
fi

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