summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2022-02-28 21:55:24 +0100
committerGitHub <noreply@github.com>2022-02-28 12:55:24 -0800
commit9b298fd7e47e99a09a8a6dea9ca74d98475c1e7f (patch)
treed2ab2cbbd93ecbbadf97f8fd41b4be2bd4abf5c2
parent8f4e029e3a598a6274e2ee78a40dc97bd6a2a107 (diff)
downloadspack-9b298fd7e47e99a09a8a6dea9ca74d98475c1e7f.tar.gz
spack-9b298fd7e47e99a09a8a6dea9ca74d98475c1e7f.tar.bz2
spack-9b298fd7e47e99a09a8a6dea9ca74d98475c1e7f.tar.xz
spack-9b298fd7e47e99a09a8a6dea9ca74d98475c1e7f.zip
Add a new test to catch exit code failure (#29244)
* Add a new test to catch exit code failure fixes #29226 This introduces a new unit test that checks the return code of `spack unit-test` when it is supposed to fail. This is to prevent bugs like the one introduced in #25601 in which CI didn't catch a missing return statement. In retrospective it seems that the shell test we have right now all go through `tty.die` or similar code paths which call `sys.exit(a)` explicitly. This new test instead checks `spack unit-test` which relies on the return code from command invocation in case of errors.
-rwxr-xr-xshare/spack/qa/setup-env-test.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/share/spack/qa/setup-env-test.sh b/share/spack/qa/setup-env-test.sh
index 7fdc15b835..03eb23a6fa 100755
--- a/share/spack/qa/setup-env-test.sh
+++ b/share/spack/qa/setup-env-test.sh
@@ -200,3 +200,6 @@ despacktivate
echo "Correct error exit codes for activate and deactivate"
fails spack env activate nonexisiting_environment
fails spack env deactivate
+
+echo "Correct error exit codes for unit-test when it fails"
+fails spack unit-test fail