setup-env.sh: make setup scripts work with set -u

- Add set -u to the setup-env.sh test script

- Refactor lines in setup-env.sh that tested potentially undefined
  variables to use the `[ -z ${var+x} ]` construct
This commit is contained in:
Todd Gamblin
2019-07-03 12:43:13 -07:00
parent 47e9f7aac9
commit 5686c2a544
2 changed files with 11 additions and 4 deletions

View File

@@ -163,6 +163,9 @@ unuse() {
# Make sure no environment is active
unset SPACK_ENV
# fail with undefined variables
set -u
# Source setup-env.sh before tests
. share/spack/setup-env.sh