From 9b298fd7e47e99a09a8a6dea9ca74d98475c1e7f Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 28 Feb 2022 21:55:24 +0100 Subject: 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. --- share/spack/qa/setup-env-test.sh | 3 +++ 1 file changed, 3 insertions(+) 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 -- cgit v1.2.3-60-g2f50