diff options
author | Greg Becker <becker33@llnl.gov> | 2020-09-18 10:21:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-18 10:21:14 -0700 |
commit | 2e4892c1113670087bbc1c56ebbf7674630701f6 (patch) | |
tree | 456e0de456cc84e70101e225acb56a44874c3cec /lib | |
parent | 44c7826892db9646b557ce25a9691f773b9633bd (diff) | |
download | spack-2e4892c1113670087bbc1c56ebbf7674630701f6.tar.gz spack-2e4892c1113670087bbc1c56ebbf7674630701f6.tar.bz2 spack-2e4892c1113670087bbc1c56ebbf7674630701f6.tar.xz spack-2e4892c1113670087bbc1c56ebbf7674630701f6.zip |
env view failures: print underlying error message (#18713)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/llnl/util/filesystem.py | 3 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/env.py | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index f6bc1aecbc..1bc177a68b 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -680,7 +680,7 @@ def replace_directory_transaction(directory_name, tmp_root=None): try: yield tmp_dir - except (Exception, KeyboardInterrupt, SystemExit): + except (Exception, KeyboardInterrupt, SystemExit) as e: # Delete what was there, before copying back the original content if os.path.exists(directory_name): shutil.rmtree(directory_name) @@ -691,6 +691,7 @@ def replace_directory_transaction(directory_name, tmp_root=None): tty.debug('DIRECTORY RECOVERED [{0}]'.format(directory_name)) msg = 'the transactional move of "{0}" failed.' + msg += '\n ' + str(e) raise RuntimeError(msg.format(directory_name)) else: # Otherwise delete the temporary directory diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py index 998dd5d876..92c9e4bcb5 100644 --- a/lib/spack/spack/test/cmd/env.py +++ b/lib/spack/spack/test/cmd/env.py @@ -1041,6 +1041,17 @@ def test_env_updates_view_install( check_mpileaks_and_deps_in_view(view_dir) +def test_env_view_fails( + tmpdir, mock_packages, mock_stage, mock_fetch, install_mockery): + view_dir = tmpdir.mkdir('view') + env('create', '--with-view=%s' % view_dir, 'test') + with ev.read('test'): + add('libelf') + add('libelf cflags=-g') + with pytest.raises(RuntimeError, match='merge blocked by file'): + install('--fake') + + def test_env_without_view_install( tmpdir, mock_stage, mock_fetch, install_mockery): # Test enabling a view after installing specs |