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.
This commit is contained in:
Massimiliano Culpo 2022-02-28 21:55:24 +01:00 committed by GitHub
parent 8f4e029e3a
commit 9b298fd7e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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