diff options
author | Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> | 2020-02-26 18:49:29 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2020-03-20 11:34:23 -0700 |
commit | 5406e1f43ded0f124fe45b1a8568005c6166628b (patch) | |
tree | c07b5a6f4a8f9d7c5be4c414f9488d29fe93e073 | |
parent | f3a1a8c6fe13b6f92a6c44e771aff5d1f9683a77 (diff) | |
download | spack-5406e1f43ded0f124fe45b1a8568005c6166628b.tar.gz spack-5406e1f43ded0f124fe45b1a8568005c6166628b.tar.bz2 spack-5406e1f43ded0f124fe45b1a8568005c6166628b.tar.xz spack-5406e1f43ded0f124fe45b1a8568005c6166628b.zip |
bugfix: Add dependents when initializing spec from yaml (#15220)
The new build process, introduced in #13100 , relies on a spec's dependents in addition to their dependencies. Loading a spec from a yaml file was not initializing the dependents.
- [x] populate dependents when loading from yaml
-rw-r--r-- | lib/spack/spack/spec.py | 4 | ||||
-rw-r--r-- | lib/spack/spack/test/concretize_preferences.py | 24 |
2 files changed, 17 insertions, 11 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 4b6bd67b6d..1493f0c973 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -1919,9 +1919,7 @@ class Spec(object): yaml_deps = node[name]['dependencies'] for dname, dhash, dtypes in Spec.read_yaml_dep_specs(yaml_deps): - # Fill in dependencies by looking them up by name in deps dict - deps[name]._dependencies[dname] = DependencySpec( - deps[name], deps[dname], dtypes) + deps[name]._add_dependency(deps[dname], dtypes) return spec diff --git a/lib/spack/spack/test/concretize_preferences.py b/lib/spack/spack/test/concretize_preferences.py index 0d0d870506..81b5360869 100644 --- a/lib/spack/spack/test/concretize_preferences.py +++ b/lib/spack/spack/test/concretize_preferences.py @@ -15,15 +15,15 @@ from spack.version import Version @pytest.fixture() -def concretize_scope(config, tmpdir): +def concretize_scope(mutable_config, tmpdir): """Adds a scope for concretization preferences""" tmpdir.ensure_dir('concretize') - config.push_scope( + mutable_config.push_scope( ConfigScope('concretize', str(tmpdir.join('concretize')))) yield - config.pop_scope() + mutable_config.pop_scope() spack.repo.path._provider_index = None @@ -84,16 +84,24 @@ class TestConcretizePreferences(object): 'mpileaks', debug=True, opt=True, shared=False, static=False ) - def test_preferred_compilers(self, mutable_mock_repo): + def test_preferred_compilers(self): """Test preferred compilers are applied correctly """ - update_packages('mpileaks', 'compiler', ['clang@3.3']) + # Need to make sure the test uses an available compiler + compiler_list = spack.compilers.all_compiler_specs() + assert compiler_list + + # Try the first available compiler + compiler = str(compiler_list[0]) + update_packages('mpileaks', 'compiler', [compiler]) spec = concretize('mpileaks') - assert spec.compiler == spack.spec.CompilerSpec('clang@3.3') + assert spec.compiler == spack.spec.CompilerSpec(compiler) - update_packages('mpileaks', 'compiler', ['gcc@4.5.0']) + # Try the last available compiler + compiler = str(compiler_list[-1]) + update_packages('mpileaks', 'compiler', [compiler]) spec = concretize('mpileaks') - assert spec.compiler == spack.spec.CompilerSpec('gcc@4.5.0') + assert spec.compiler == spack.spec.CompilerSpec(compiler) def test_preferred_target(self, mutable_mock_repo): """Test preferred compilers are applied correctly |