summaryrefslogtreecommitdiff
path: root/share/spack/qa/setup-env-test.sh
diff options
context:
space:
mode:
authorGreg Becker <becker33@llnl.gov>2020-01-22 22:36:02 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2020-01-22 22:36:02 -0800
commitc9e01ff9d76f5e1e645b01f5021c469f436b260c (patch)
treede1eacc3b689efc0ef8cdbd8634ecc0436f3b080 /share/spack/qa/setup-env-test.sh
parent5053dfa2599a90a8b5bf69c9391fa3b8e38a7bbb (diff)
downloadspack-c9e01ff9d76f5e1e645b01f5021c469f436b260c.tar.gz
spack-c9e01ff9d76f5e1e645b01f5021c469f436b260c.tar.bz2
spack-c9e01ff9d76f5e1e645b01f5021c469f436b260c.tar.xz
spack-c9e01ff9d76f5e1e645b01f5021c469f436b260c.zip
shell support: `spack load` no longer needs modules (#14062)
Previously the `spack load` command was a wrapper around `module load`. This required some bootstrapping of modules to make `spack load` work properly. With this PR, the `spack` shell function handles the environment modifications necessary to add packages to your user environment. This removes the dependence on environment modules or lmod and removes the requirement to bootstrap spack (beyond using the setup-env scripts). Included in this PR is support for MacOS when using Apple's System Integrity Protection (SIP), which is enabled by default in modern MacOS versions. SIP clears the `LD_LIBRARY_PATH` and `DYLD_LIBRARY_PATH` variables on process startup for executables that live in `/usr` (but not '/usr/local', `/System`, `/bin`, and `/sbin` among other system locations. Spack cannot know the `LD_LIBRARY_PATH` of the calling process when executed using `/bin/sh` and `/usr/bin/python`. The `spack` shell function now manually forwards these two variables, if they are present, as `SPACK_<VAR>` and recovers those values on startup. - [x] spack load/unload no longer delegate to modules - [x] refactor user_environment modification calculations - [x] update documentation for spack load/unload Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
Diffstat (limited to 'share/spack/qa/setup-env-test.sh')
-rwxr-xr-xshare/spack/qa/setup-env-test.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/share/spack/qa/setup-env-test.sh b/share/spack/qa/setup-env-test.sh
index 66284d1a96..da4fb9657d 100755
--- a/share/spack/qa/setup-env-test.sh
+++ b/share/spack/qa/setup-env-test.sh
@@ -104,20 +104,25 @@ contains "usage: spack module " spack -m module --help
contains "usage: spack module " spack -m module
title 'Testing `spack load`'
-contains "module load $b_module" spack -m load b
+contains "export LD_LIBRARY_PATH=$(spack -m location -i b)/lib" spack -m load --only package --sh b
+succeeds spack -m load b
fails spack -m load -l
-contains "module load -l --arg $b_module" spack -m load -l --arg b
-contains "module load $b_module $a_module" spack -m load -r a
-contains "module load $b_module $a_module" spack -m load --dependencies a
+# test a variable MacOS clears and one it doesn't for recursive loads
+contains "export LD_LIBRARY_PATH=$(spack -m location -i a)/lib:$(spack -m location -i b)/lib" spack -m load --sh a
+contains "export LIBRARY_PATH=$(spack -m location -i a)/lib:$(spack -m location -i b)/lib" spack -m load --sh a
+succeeds spack -m load --only dependencies a
+succeeds spack -m load --only package a
fails spack -m load d
contains "usage: spack load " spack -m load -h
contains "usage: spack load " spack -m load -h d
contains "usage: spack load " spack -m load --help
title 'Testing `spack unload`'
-contains "module unload $b_module" spack -m unload b
+spack -m load b a # setup
+succeeds spack -m unload b
+succeeds spack -m unload --all
+spack -m unload --all # cleanup
fails spack -m unload -l
-contains "module unload -l --arg $b_module" spack -m unload -l --arg b
fails spack -m unload d
contains "usage: spack unload " spack -m unload -h
contains "usage: spack unload " spack -m unload -h d