Add some tests for packages with multiple virtual dependencies.
- Added mock `hypre` package, depends on `lapack` and `blas`. - test cases where some packages provide both `lapack` and `blas`, but others do not.
This commit is contained in:
		| @@ -142,6 +142,34 @@ def test_concretize_with_provides_when(self): | ||||
|                                 for spec in spack.repo.providers_for('mpi@3'))) | ||||
|  | ||||
|  | ||||
|     def test_concretize_two_virtuals(self): | ||||
|         """Test a package with multiple virtual dependencies.""" | ||||
|         s = Spec('hypre').concretize() | ||||
|  | ||||
|  | ||||
|     def test_concretize_two_virtuals_with_one_bound(self): | ||||
|         """Test a package with multiple virtual dependencies and one preset.""" | ||||
|         s = Spec('hypre ^openblas').concretize() | ||||
|  | ||||
|  | ||||
|     def test_concretize_two_virtuals_with_two_bound(self): | ||||
|         """Test a package with multiple virtual dependencies and two of them preset.""" | ||||
|         s = Spec('hypre ^openblas ^netlib-lapack').concretize() | ||||
|  | ||||
|  | ||||
|     def test_concretize_two_virtuals_with_dual_provider(self): | ||||
|         """Test a package with multiple virtual dependencies and force a provider | ||||
|            that provides both.""" | ||||
|         s = Spec('hypre ^openblas-with-lapack').concretize() | ||||
|  | ||||
|  | ||||
|     def test_concretize_two_virtuals_with_dual_provider_and_a_conflict(self): | ||||
|         """Test a package with multiple virtual dependencies and force a provider | ||||
|            that provides both, and another conflicting package that provides one.""" | ||||
|         s = Spec('hypre ^openblas-with-lapack ^netlib-lapack') | ||||
|         self.assertRaises(spack.spec.MultipleProviderError, s.concretize) | ||||
|  | ||||
|  | ||||
|     def test_virtual_is_fully_expanded_for_callpath(self): | ||||
|         # force dependence on fake "zmpi" by asking for MPI 10.0 | ||||
|         spec = Spec('callpath ^mpi@10.0') | ||||
| @@ -281,4 +309,3 @@ def test_find_spec_none(self): | ||||
|                       Spec('d')), | ||||
|                  Spec('e')) | ||||
|         self.assertEqual(None, find_spec(s['b'], lambda s: '+foo' in s)) | ||||
|  | ||||
|   | ||||
							
								
								
									
										39
									
								
								var/spack/repos/builtin.mock/packages/hypre/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								var/spack/repos/builtin.mock/packages/hypre/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| ############################################################################## | ||||
| # Copyright (c) 2013-2015, Lawrence Livermore National Security, LLC. | ||||
| # Produced at the Lawrence Livermore National Laboratory. | ||||
| # | ||||
| # This file is part of Spack. | ||||
| # Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. | ||||
| # LLNL-CODE-647188 | ||||
| # | ||||
| # For details, see https://github.com/llnl/spack | ||||
| # Please also see the LICENSE file for our notice and the LGPL. | ||||
| # | ||||
| # This program is free software; you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License (as published by | ||||
| # the Free Software Foundation) version 2.1 dated February 1999. | ||||
| # | ||||
| # This program is distributed in the hope that it will be useful, but | ||||
| # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and | ||||
| # conditions of the GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU Lesser General Public License | ||||
| # along with this program; if not, write to the Free Software Foundation, | ||||
| # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||
| ############################################################################## | ||||
| from spack import * | ||||
|  | ||||
| class Hypre(Package): | ||||
|     """Hypre is included here as an example of a package that depends on | ||||
|        both LAPACK and BLAS.""" | ||||
|     homepage = "http://www.openblas.net" | ||||
|     url      = "http://github.com/xianyi/OpenBLAS/archive/v0.2.15.tar.gz" | ||||
|  | ||||
|     version('0.2.15', 'b1190f3d3471685f17cfd1ec1d252ac9') | ||||
|  | ||||
|     depends_on('lapack') | ||||
|     depends_on('blas') | ||||
|  | ||||
|     def install(self, spec, prefix): | ||||
|         pass | ||||
| @@ -0,0 +1,38 @@ | ||||
| ############################################################################## | ||||
| # Copyright (c) 2013-2015, Lawrence Livermore National Security, LLC. | ||||
| # Produced at the Lawrence Livermore National Laboratory. | ||||
| # | ||||
| # This file is part of Spack. | ||||
| # Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. | ||||
| # LLNL-CODE-647188 | ||||
| # | ||||
| # For details, see https://github.com/llnl/spack | ||||
| # Please also see the LICENSE file for our notice and the LGPL. | ||||
| # | ||||
| # This program is free software; you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License (as published by | ||||
| # the Free Software Foundation) version 2.1 dated February 1999. | ||||
| # | ||||
| # This program is distributed in the hope that it will be useful, but | ||||
| # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and | ||||
| # conditions of the GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU Lesser General Public License | ||||
| # along with this program; if not, write to the Free Software Foundation, | ||||
| # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||
| ############################################################################## | ||||
| from spack import * | ||||
|  | ||||
| class OpenblasWithLapack(Package): | ||||
|     """Dummy version of OpenBLAS that also provides LAPACK, for testing.""" | ||||
|     homepage = "http://www.openblas.net" | ||||
|     url      = "http://github.com/xianyi/OpenBLAS/archive/v0.2.15.tar.gz" | ||||
|  | ||||
|     version('0.2.15', 'b1190f3d3471685f17cfd1ec1d252ac9') | ||||
|  | ||||
|     provides('lapack') | ||||
|     provides('blas') | ||||
|  | ||||
|     def install(self, spec, prefix): | ||||
|         pass | ||||
		Reference in New Issue
	
	Block a user
	 Todd Gamblin
					Todd Gamblin