Cflags requirements: regression fix#40639
Merged
alalazo merged 3 commits intospack:developfrom Oct 31, 2023
Merged
Conversation
Member
Author
|
Items meriting refactor that are longer-term (not addressed here):
|
alalazo
requested changes
Oct 31, 2023
Member
There was a problem hiding this comment.
The fix looks good to me, but the unit test doesn't fail on develop (for the same reason the previous test didn't catch the bug). I suggest using the mock repo instead:
diff --git a/lib/spack/spack/test/concretize_requirements.py b/lib/spack/spack/test/concretize_requirements.py
index f3dad1a195..51747dd992 100644
--- a/lib/spack/spack/test/concretize_requirements.py
+++ b/lib/spack/spack/test/concretize_requirements.py
@@ -91,25 +91,6 @@ class U(Package):
)
-_pkgw = (
- "w",
- """\
-class W(Package):
- provides('virtual-w')
- version('1.0')
-""",
-)
-
-
-_virtualw = (
- "virtual-w",
- """\
-class VirtualW(Package):
- virtual = True
-""",
-)
-
-
@pytest.fixture
def create_test_repo(tmpdir, mutable_config):
repo_path = str(tmpdir)
@@ -123,7 +104,7 @@ def create_test_repo(tmpdir, mutable_config):
)
packages_dir = tmpdir.join("packages")
- for pkg_name, pkg_str in [_pkgx, _pkgy, _pkgv, _pkgt, _pkgu, _pkgw]:
+ for pkg_name, pkg_str in [_pkgx, _pkgy, _pkgv, _pkgt, _pkgu]:
pkg_dir = packages_dir.ensure(pkg_name, dir=True)
pkg_file = pkg_dir.join("package.py")
with open(str(pkg_file), "w") as f:
@@ -488,25 +469,25 @@ def test_one_package_multiple_oneof_groups(concretize_scope, test_repo):
@pytest.mark.regression("34241")
-def test_require_cflags(concretize_scope, test_repo):
+def test_require_cflags(concretize_scope, mock_packages):
"""Ensures that flags can be required from configuration."""
conf_str = """\
packages:
all:
providers:
- virtual-w: [w]
- y:
+ mpi: [mpich]
+ mpich2:
require: cflags="-g"
- virtual-w:
- require: w cflags="-O1"
+ mpi:
+ require: mpich cflags="-O1"
"""
update_packages_config(conf_str)
- spec_y = Spec("y").concretized()
+ spec_y = Spec("mpich2").concretized()
assert spec_y.satisfies("cflags=-g")
- spec_w = Spec("virtual-w").concretized()
- assert spec_w.satisfies("w cflags=-O1")
+ spec_w = Spec("mpi").concretized()
+ assert spec_w.satisfies("mpich cflags=-O1")
def test_requirements_for_package_that_is_not_needed(concretize_scope, test_repo):I'll be posting benchmark results next
Member
|
Confirmed that there is no impact on performance. radiuss-develop.csv Tested on:
|
… without the fix, although is fragile in the same way)
alalazo
approved these changes
Oct 31, 2023
Member
|
Thanks! |
RikkiButler20
pushed a commit
to RikkiButler20/spack
that referenced
this pull request
Nov 2, 2023
gabrielctn
pushed a commit
to gabrielctn/spack
that referenced
this pull request
Nov 24, 2023
This was referenced Nov 29, 2023
mtaillefumier
pushed a commit
to mtaillefumier/spack
that referenced
this pull request
Dec 14, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

fixes #39671
Reapply targeted changes from #39880
Based on discussion there, this logic is due for some refactoring. It would be good to have a fix in for the 0.21 release though (and refactoring might take longer).