summaryrefslogtreecommitdiff
path: root/lib/spack/spack/test/concretize.py
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2023-12-20 20:21:15 +0100
committerGitHub <noreply@github.com>2023-12-20 19:21:15 +0000
commit1aaab97a162f2c3c6d1dca77e2ac3d75ab3e2930 (patch)
tree3f768e0274441fb58bdb05603bd4cb1c7c66ed4a /lib/spack/spack/test/concretize.py
parent3053e701c02fd57b0a3aa169abd57b144edf827b (diff)
downloadspack-1aaab97a162f2c3c6d1dca77e2ac3d75ab3e2930.tar.gz
spack-1aaab97a162f2c3c6d1dca77e2ac3d75ab3e2930.tar.bz2
spack-1aaab97a162f2c3c6d1dca77e2ac3d75ab3e2930.tar.xz
spack-1aaab97a162f2c3c6d1dca77e2ac3d75ab3e2930.zip
Only reuse externals when configured (#41707)
Users expect that changes to the externals sections in packages.yaml config apply immediately, but reuse concretization caused this not to be the case. With this commit, the concretizer is only allowed to reuse externals previously imported from config if identical config exists.
Diffstat (limited to 'lib/spack/spack/test/concretize.py')
-rw-r--r--lib/spack/spack/test/concretize.py36
1 files changed, 22 insertions, 14 deletions
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index 2eb75edb6c..fd5bd7d9c5 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -1817,12 +1817,14 @@ class TestConcretize:
@pytest.mark.regression("31484")
@pytest.mark.only_clingo("Use case not supported by the original concretizer")
- def test_installed_externals_are_reused(self, mutable_database, repo_with_changing_recipe):
+ def test_installed_externals_are_reused(
+ self, mutable_database, repo_with_changing_recipe, tmp_path
+ ):
"""Test that external specs that are in the DB can be reused."""
external_conf = {
"changing": {
"buildable": False,
- "externals": [{"spec": "changing@1.0", "prefix": "/usr"}],
+ "externals": [{"spec": "changing@1.0", "prefix": str(tmp_path)}],
}
}
spack.config.set("packages", external_conf)
@@ -1847,12 +1849,12 @@ class TestConcretize:
@pytest.mark.regression("31484")
@pytest.mark.only_clingo("Use case not supported by the original concretizer")
- def test_user_can_select_externals_with_require(self, mutable_database):
+ def test_user_can_select_externals_with_require(self, mutable_database, tmp_path):
"""Test that users have means to select an external even in presence of reusable specs."""
external_conf = {
"mpi": {"buildable": False},
"multi-provider-mpi": {
- "externals": [{"spec": "multi-provider-mpi@2.0.0", "prefix": "/usr"}]
+ "externals": [{"spec": "multi-provider-mpi@2.0.0", "prefix": str(tmp_path)}]
},
}
spack.config.set("packages", external_conf)
@@ -2434,7 +2436,8 @@ def test_reusable_externals_match(mock_packages, tmpdir):
spec.external_path = tmpdir.strpath
spec.external_modules = ["mpich/4.1"]
spec._mark_concrete()
- assert spack.solver.asp._is_reusable_external(
+ assert spack.solver.asp._is_reusable(
+ spec,
{
"mpich": {
"externals": [
@@ -2442,7 +2445,7 @@ def test_reusable_externals_match(mock_packages, tmpdir):
]
}
},
- spec,
+ local=False,
)
@@ -2451,7 +2454,8 @@ def test_reusable_externals_match_virtual(mock_packages, tmpdir):
spec.external_path = tmpdir.strpath
spec.external_modules = ["mpich/4.1"]
spec._mark_concrete()
- assert spack.solver.asp._is_reusable_external(
+ assert spack.solver.asp._is_reusable(
+ spec,
{
"mpi": {
"externals": [
@@ -2459,7 +2463,7 @@ def test_reusable_externals_match_virtual(mock_packages, tmpdir):
]
}
},
- spec,
+ local=False,
)
@@ -2468,7 +2472,8 @@ def test_reusable_externals_different_prefix(mock_packages, tmpdir):
spec.external_path = "/other/path"
spec.external_modules = ["mpich/4.1"]
spec._mark_concrete()
- assert not spack.solver.asp._is_reusable_external(
+ assert not spack.solver.asp._is_reusable(
+ spec,
{
"mpich": {
"externals": [
@@ -2476,7 +2481,7 @@ def test_reusable_externals_different_prefix(mock_packages, tmpdir):
]
}
},
- spec,
+ local=False,
)
@@ -2486,7 +2491,8 @@ def test_reusable_externals_different_modules(mock_packages, tmpdir, modules):
spec.external_path = tmpdir.strpath
spec.external_modules = modules
spec._mark_concrete()
- assert not spack.solver.asp._is_reusable_external(
+ assert not spack.solver.asp._is_reusable(
+ spec,
{
"mpich": {
"externals": [
@@ -2494,7 +2500,7 @@ def test_reusable_externals_different_modules(mock_packages, tmpdir, modules):
]
}
},
- spec,
+ local=False,
)
@@ -2502,6 +2508,8 @@ def test_reusable_externals_different_spec(mock_packages, tmpdir):
spec = Spec("mpich@4.1%gcc@13.1.0~debug build_system=generic arch=linux-ubuntu23.04-zen2")
spec.external_path = tmpdir.strpath
spec._mark_concrete()
- assert not spack.solver.asp._is_reusable_external(
- {"mpich": {"externals": [{"spec": "mpich@4.1 +debug", "prefix": tmpdir.strpath}]}}, spec
+ assert not spack.solver.asp._is_reusable(
+ spec,
+ {"mpich": {"externals": [{"spec": "mpich@4.1 +debug", "prefix": tmpdir.strpath}]}},
+ local=False,
)