Add a unit test to prevent regression
This commit is contained in:
parent
dd4d7bae1d
commit
6d69d23aa5
@ -14,7 +14,9 @@
|
|||||||
|
|
||||||
dependencies = SpackCommand('dependencies')
|
dependencies = SpackCommand('dependencies')
|
||||||
|
|
||||||
mpis = ['mpich', 'mpich2', 'multi-provider-mpi', 'zmpi']
|
mpis = [
|
||||||
|
'low-priority-provider', 'mpich', 'mpich2', 'multi-provider-mpi', 'zmpi'
|
||||||
|
]
|
||||||
mpi_deps = ['fake']
|
mpi_deps = ['fake']
|
||||||
|
|
||||||
|
|
||||||
|
@ -1274,3 +1274,17 @@ def test_versions_in_virtual_dependencies(self):
|
|||||||
# package doesn't end up using a later implementation
|
# package doesn't end up using a later implementation
|
||||||
s = spack.spec.Spec('hpcviewer@2019.02').concretized()
|
s = spack.spec.Spec('hpcviewer@2019.02').concretized()
|
||||||
assert s['java'].satisfies('virtual-with-versions@1.8.0')
|
assert s['java'].satisfies('virtual-with-versions@1.8.0')
|
||||||
|
|
||||||
|
@pytest.mark.regression('26866')
|
||||||
|
def test_non_default_provider_of_multiple_virtuals(self):
|
||||||
|
s = spack.spec.Spec(
|
||||||
|
'many-virtual-consumer ^low-priority-provider'
|
||||||
|
).concretized()
|
||||||
|
assert s['mpi'].name == 'low-priority-provider'
|
||||||
|
assert s['lapack'].name == 'low-priority-provider'
|
||||||
|
|
||||||
|
for virtual_pkg in ('mpi', 'lapack'):
|
||||||
|
for pkg in spack.repo.path.providers_for(virtual_pkg):
|
||||||
|
if pkg.name == 'low-priority-provider':
|
||||||
|
continue
|
||||||
|
assert pkg not in s
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
packages:
|
packages:
|
||||||
all:
|
all:
|
||||||
providers:
|
providers:
|
||||||
mpi: [openmpi, mpich]
|
mpi: [openmpi, mpich, zmpi]
|
||||||
|
lapack: [openblas-with-lapack]
|
||||||
blas: [openblas]
|
blas: [openblas]
|
||||||
externaltool:
|
externaltool:
|
||||||
buildable: False
|
buildable: False
|
||||||
|
@ -30,6 +30,7 @@ def mpi_names(mock_repo_path):
|
|||||||
def mpileaks_possible_deps(mock_packages, mpi_names):
|
def mpileaks_possible_deps(mock_packages, mpi_names):
|
||||||
possible = {
|
possible = {
|
||||||
'callpath': set(['dyninst'] + mpi_names),
|
'callpath': set(['dyninst'] + mpi_names),
|
||||||
|
'low-priority-provider': set(),
|
||||||
'dyninst': set(['libdwarf', 'libelf']),
|
'dyninst': set(['libdwarf', 'libelf']),
|
||||||
'fake': set(),
|
'fake': set(),
|
||||||
'libdwarf': set(['libelf']),
|
'libdwarf': set(['libelf']),
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
# Copyright 2013-2021 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 import *
|
||||||
|
|
||||||
|
|
||||||
|
class LowPriorityProvider(Package):
|
||||||
|
"""Provides multiple virtuals but is low in the priority of clingo"""
|
||||||
|
|
||||||
|
homepage = "http://www.example.com"
|
||||||
|
url = "http://www.example.com/a-1.0.tar.gz"
|
||||||
|
|
||||||
|
version('1.0', '0123456789abcdef0123456789abcdef')
|
||||||
|
|
||||||
|
provides('lapack')
|
||||||
|
provides('mpi')
|
@ -0,0 +1,18 @@
|
|||||||
|
# Copyright 2013-2021 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)
|
||||||
|
class ManyVirtualConsumer(Package):
|
||||||
|
"""PAckage that depends on many virtual packages"""
|
||||||
|
url = "http://www.example.com/"
|
||||||
|
url = "http://www.example.com/2.0.tar.gz"
|
||||||
|
|
||||||
|
version('1.0', 'abcdef1234567890abcdef1234567890')
|
||||||
|
|
||||||
|
depends_on('mpi')
|
||||||
|
depends_on('lapack')
|
||||||
|
|
||||||
|
# This directive is an example of imposing a constraint on a
|
||||||
|
# dependency is that dependency is in the DAG. This pattern
|
||||||
|
# is mainly used with virtual providers.
|
||||||
|
depends_on('low-priority-provider@1.0', when='^low-priority-provider')
|
Loading…
Reference in New Issue
Block a user