Add unit-tests for use cases requiring separate concretization of build deps
This commit is contained in:
parent
9f8edbf6bf
commit
d5eb5106b0
@ -2181,3 +2181,82 @@ def test_virtuals_are_annotated_on_edges(self, spec_str, default_mock_concretiza
|
|||||||
assert len(edges) == 1 and edges[0].virtuals == ("mpi",)
|
assert len(edges) == 1 and edges[0].virtuals == ("mpi",)
|
||||||
edges = spec.edges_to_dependencies(name="callpath")
|
edges = spec.edges_to_dependencies(name="callpath")
|
||||||
assert len(edges) == 1 and edges[0].virtuals == ()
|
assert len(edges) == 1 and edges[0].virtuals == ()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture()
|
||||||
|
def duplicates_test_repository():
|
||||||
|
builder_test_path = os.path.join(spack.paths.repos_path, "duplicates.test")
|
||||||
|
with spack.repo.use_repositories(builder_test_path) as mock_repo:
|
||||||
|
yield mock_repo
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("mutable_config", "duplicates_test_repository")
|
||||||
|
class TestConcretizeSeparately:
|
||||||
|
@pytest.mark.parametrize("strategy", ["minimal", "full"])
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
os.environ.get("SPACK_TEST_SOLVER") == "original",
|
||||||
|
reason="Not supported by the original concretizer",
|
||||||
|
)
|
||||||
|
def test_two_gmake(self, strategy):
|
||||||
|
"""Tests that we can concretize a spec with nodes using the same build
|
||||||
|
dependency pinned at different versions.
|
||||||
|
|
||||||
|
o hdf5@1.0
|
||||||
|
|\
|
||||||
|
o | pinned-gmake@1.0
|
||||||
|
o | gmake@3.0
|
||||||
|
/
|
||||||
|
o gmake@4.1
|
||||||
|
|
||||||
|
"""
|
||||||
|
spack.config.config.set("concretizer:duplicates:strategy", strategy)
|
||||||
|
s = Spec("hdf5").concretized()
|
||||||
|
|
||||||
|
# Check that hdf5 depends on gmake@=4.1
|
||||||
|
hdf5_gmake = s["hdf5"].dependencies(name="gmake", deptype="build")
|
||||||
|
assert len(hdf5_gmake) == 1 and hdf5_gmake[0].satisfies("@=4.1")
|
||||||
|
|
||||||
|
# Check that pinned-gmake depends on gmake@=3.0
|
||||||
|
pinned_gmake = s["pinned-gmake"].dependencies(name="gmake", deptype="build")
|
||||||
|
assert len(pinned_gmake) == 1 and pinned_gmake[0].satisfies("@=3.0")
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("strategy", ["minimal", "full"])
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
os.environ.get("SPACK_TEST_SOLVER") == "original",
|
||||||
|
reason="Not supported by the original concretizer",
|
||||||
|
)
|
||||||
|
def test_two_setuptools(self, strategy):
|
||||||
|
"""Tests that we can concretize separate build dependencies, when we are dealing
|
||||||
|
with extensions.
|
||||||
|
|
||||||
|
o py-shapely@1.25.0
|
||||||
|
|\
|
||||||
|
| |\
|
||||||
|
| o | py-setuptools@60
|
||||||
|
|/ /
|
||||||
|
| o py-numpy@1.25.0
|
||||||
|
|/|
|
||||||
|
| |\
|
||||||
|
| o | py-setuptools@59
|
||||||
|
|/ /
|
||||||
|
o | python@3.11.2
|
||||||
|
o | gmake@3.0
|
||||||
|
/
|
||||||
|
o gmake@4.1
|
||||||
|
|
||||||
|
"""
|
||||||
|
spack.config.config.set("concretizer:duplicates:strategy", strategy)
|
||||||
|
s = Spec("py-shapely").concretized()
|
||||||
|
# Requirements on py-shapely
|
||||||
|
setuptools = s["py-shapely"].dependencies(name="py-setuptools", deptype="build")
|
||||||
|
assert len(setuptools) == 1 and setuptools[0].satisfies("@=60")
|
||||||
|
|
||||||
|
# Requirements on py-numpy
|
||||||
|
setuptools = s["py-numpy"].dependencies(name="py-setuptools", deptype="build")
|
||||||
|
assert len(setuptools) == 1 and setuptools[0].satisfies("@=59")
|
||||||
|
gmake = s["py-numpy"].dependencies(name="gmake", deptype="build")
|
||||||
|
assert len(gmake) == 1 and gmake[0].satisfies("@=4.1")
|
||||||
|
|
||||||
|
# Requirements on python
|
||||||
|
gmake = s["python"].dependencies(name="gmake", deptype="build")
|
||||||
|
assert len(gmake) == 1 and gmake[0].satisfies("@=3.0")
|
||||||
|
@ -3,3 +3,5 @@ concretizer:
|
|||||||
targets:
|
targets:
|
||||||
granularity: microarchitectures
|
granularity: microarchitectures
|
||||||
host_compatible: false
|
host_compatible: false
|
||||||
|
duplicates:
|
||||||
|
strategy: none
|
||||||
|
19
var/spack/repos/duplicates.test/packages/gmake/package.py
Normal file
19
var/spack/repos/duplicates.test/packages/gmake/package.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
|
class Gmake(Package):
|
||||||
|
"""Simple build tool, with different versions"""
|
||||||
|
|
||||||
|
homepage = "http://www.example.com"
|
||||||
|
url = "http://www.example.com/tdep-1.0.tar.gz"
|
||||||
|
|
||||||
|
tags = ["build-tools"]
|
||||||
|
|
||||||
|
version("4.1", md5="0123456789abcdef0123456789abcdef")
|
||||||
|
version("4.0", md5="0123456789abcdef0123456789abcdef")
|
||||||
|
version("3.0", md5="0123456789abcdef0123456789abcdef")
|
||||||
|
version("2.0", md5="0123456789abcdef0123456789abcdef")
|
17
var/spack/repos/duplicates.test/packages/hdf5/package.py
Normal file
17
var/spack/repos/duplicates.test/packages/hdf5/package.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
|
class Hdf5(Package):
|
||||||
|
"""Requires gmake at a version that doesn't match that of its dependency"""
|
||||||
|
|
||||||
|
homepage = "http://www.example.com"
|
||||||
|
url = "http://www.example.com/tdep-1.0.tar.gz"
|
||||||
|
|
||||||
|
version("1.0", md5="0123456789abcdef0123456789abcdef")
|
||||||
|
|
||||||
|
depends_on("pinned-gmake", type="link")
|
||||||
|
depends_on("gmake@4", type="build")
|
@ -0,0 +1,16 @@
|
|||||||
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
|
class PinnedGmake(Package):
|
||||||
|
"""Software that requires gmake at a specific version"""
|
||||||
|
|
||||||
|
homepage = "http://www.example.com"
|
||||||
|
url = "http://www.example.com/tdep-1.0.tar.gz"
|
||||||
|
|
||||||
|
version("1.0", md5="0123456789abcdef0123456789abcdef")
|
||||||
|
|
||||||
|
depends_on("gmake@3", type="build")
|
20
var/spack/repos/duplicates.test/packages/py-numpy/package.py
Normal file
20
var/spack/repos/duplicates.test/packages/py-numpy/package.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
|
class PyNumpy(Package):
|
||||||
|
"""An extension that depends on pinned build dependencies"""
|
||||||
|
|
||||||
|
homepage = "http://www.example.com"
|
||||||
|
url = "http://www.example.com/tdep-1.0.tar.gz"
|
||||||
|
|
||||||
|
tags = ["build-tools"]
|
||||||
|
|
||||||
|
version("1.25.0", md5="0123456789abcdef0123456789abcdef")
|
||||||
|
|
||||||
|
extends("python")
|
||||||
|
depends_on("py-setuptools@=59", type=("build", "run"))
|
||||||
|
depends_on("gmake@4.1", type="build")
|
@ -0,0 +1,19 @@
|
|||||||
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
|
class PySetuptools(Package):
|
||||||
|
"""Build tool for an extendable package"""
|
||||||
|
|
||||||
|
homepage = "http://www.example.com"
|
||||||
|
url = "http://www.example.com/tdep-1.0.tar.gz"
|
||||||
|
|
||||||
|
tags = ["build-tools"]
|
||||||
|
|
||||||
|
extends("python")
|
||||||
|
|
||||||
|
version("60", md5="0123456789abcdef0123456789abcdef")
|
||||||
|
version("59", md5="0123456789abcdef0123456789abcdef")
|
@ -0,0 +1,18 @@
|
|||||||
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
|
class PyShapely(Package):
|
||||||
|
"""An extension that depends on pinned build dependencies"""
|
||||||
|
|
||||||
|
homepage = "http://www.example.com"
|
||||||
|
url = "http://www.example.com/tdep-1.0.tar.gz"
|
||||||
|
|
||||||
|
version("1.25.0", md5="0123456789abcdef0123456789abcdef")
|
||||||
|
|
||||||
|
extends("python")
|
||||||
|
depends_on("py-numpy", type=("build", "link", "run"))
|
||||||
|
depends_on("py-setuptools@=60", type="build")
|
18
var/spack/repos/duplicates.test/packages/python/package.py
Normal file
18
var/spack/repos/duplicates.test/packages/python/package.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
|
class Python(Package):
|
||||||
|
"""A package that can be extended"""
|
||||||
|
|
||||||
|
homepage = "http://www.example.com"
|
||||||
|
url = "http://www.example.com/tdep-1.0.tar.gz"
|
||||||
|
|
||||||
|
version("3.11.2", md5="0123456789abcdef0123456789abcdef")
|
||||||
|
|
||||||
|
extendable = True
|
||||||
|
|
||||||
|
depends_on("gmake@3", type="build")
|
2
var/spack/repos/duplicates.test/repo.yaml
Normal file
2
var/spack/repos/duplicates.test/repo.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
repo:
|
||||||
|
namespace: duplicates.test
|
Loading…
Reference in New Issue
Block a user