run-unit-tests 1.34 KB
Newer Older
1
#!/bin/bash -e
2
#
3
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
4
5
6
7
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

8
#
9
10
# Description:
#     Runs Spack unit tests.
11
#
12
13
# Usage:
#     run-unit-tests [test ...]
14
#
15
16
17
# Options:
#     Optionally add one or more unit tests
#     to only run these tests.
18
#
19
20
21
22
23
24

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

25
. "$(dirname $0)/setup.sh"
26
check_dependencies $coverage git hg svn
27

28
29
30
31
# Move to root directory of Spack
# Allows script to be run from anywhere
cd "$SPACK_ROOT"

32
# Print compiler information
33
34
spack config get compilers

Todd Gamblin's avatar
Todd Gamblin committed
35
# Run spack help to cover command import
36
37
bin/spack -h
bin/spack help -a
Todd Gamblin's avatar
Todd Gamblin committed
38

39
# Profile and print top 20 lines for a simple call to spack spec
40
spack -p --lines 20 spec mpileaks%gcc ^elfutils@0.170
41

42
#-----------------------------------------------------------
43
# Run unit tests with code coverage
44
#-----------------------------------------------------------
45
46
47
48
49
if [[ "$ONLY_PACKAGES" == "true" ]]; then
  echo "ONLY PACKAGE RECIPES CHANGED [skipping slow unit tests]"
  export PYTEST_ADDOPTS='-m "not maybeslow"'
fi

Greg Becker's avatar
Greg Becker committed
50
$coverage_run $(which spack) unit-test -x --verbose