summaryrefslogtreecommitdiff
path: root/share/spack/qa/run-unit-tests
diff options
context:
space:
mode:
Diffstat (limited to 'share/spack/qa/run-unit-tests')
-rwxr-xr-xshare/spack/qa/run-unit-tests30
1 files changed, 30 insertions, 0 deletions
diff --git a/share/spack/qa/run-unit-tests b/share/spack/qa/run-unit-tests
index 49dbda0d32..4403d53a76 100755
--- a/share/spack/qa/run-unit-tests
+++ b/share/spack/qa/run-unit-tests
@@ -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
@@ -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