summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-08-14 00:07:46 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2018-08-14 14:33:50 -0700
commit62026ce30272349c33c5ff9c8977e2db31d82203 (patch)
treed3dc80d3b3c7336d2284ae1c58ee473dd44c0fec /lib
parent85d00c5ef4df6713d7f054b8e2d625d07cdd28af (diff)
downloadspack-62026ce30272349c33c5ff9c8977e2db31d82203.tar.gz
spack-62026ce30272349c33c5ff9c8977e2db31d82203.tar.bz2
spack-62026ce30272349c33c5ff9c8977e2db31d82203.tar.xz
spack-62026ce30272349c33c5ff9c8977e2db31d82203.zip
tests: make the dependency patching test more complete
- dependency patching test didn't attempt to apply patches; just to see whether they were on the spec. - it applies the patch now and verifies that that patch was applied.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/conftest.py1
-rw-r--r--lib/spack/spack/test/patch.py23
2 files changed, 21 insertions, 3 deletions
diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py
index 860732b873..5a2ee699e1 100644
--- a/lib/spack/spack/test/conftest.py
+++ b/lib/spack/spack/test/conftest.py
@@ -388,6 +388,7 @@ def install_mockery(tmpdir, config, mock_packages):
with spack.config.override('config:checksum', False):
yield
+ tmpdir.join('opt').remove()
spack.store.store = real_store
diff --git a/lib/spack/spack/test/patch.py b/lib/spack/spack/test/patch.py
index 3e8bc62ba0..0b16a3f5be 100644
--- a/lib/spack/spack/test/patch.py
+++ b/lib/spack/spack/test/patch.py
@@ -31,6 +31,7 @@ from llnl.util.filesystem import working_dir, mkdirp
import spack.paths
import spack.util.compression
+from spack.util.executable import Executable
from spack.stage import Stage
from spack.spec import Spec
@@ -108,16 +109,32 @@ def test_patch_in_spec(mock_packages, config):
spec.variants['patches'].value)
-def test_patched_dependency(mock_packages, config):
+def test_patched_dependency(
+ mock_packages, config, install_mockery, mock_fetch):
"""Test whether patched dependencies work."""
spec = Spec('patch-a-dependency')
spec.concretize()
assert 'patches' in list(spec['libelf'].variants.keys())
- # foo
- assert (('b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c',) ==
+ # make sure the patch makes it into the dependency spec
+ assert (('c45c1564f70def3fc1a6e22139f62cb21cd190cc3a7dbe6f4120fa59ce33dcb8',) ==
spec['libelf'].variants['patches'].value)
+ # make sure the patch in the dependent's directory is applied to the
+ # dependency
+ libelf = spec['libelf']
+ pkg = libelf.package
+ pkg.do_patch()
+ with pkg.stage:
+ with working_dir(pkg.stage.source_path):
+ # output a Makefile with 'echo Patched!' as the default target
+ configure = Executable('./configure')
+ configure()
+
+ # Make sure the Makefile contains the patched text
+ with open('Makefile') as mf:
+ assert 'Patched!' in mf.read()
+
def test_multiple_patched_dependencies(mock_packages, config):
"""Test whether multiple patched dependencies work."""