summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2017-01-31 13:35:38 -0600
committerTodd Gamblin <tgamblin@llnl.gov>2017-01-31 14:35:38 -0500
commit41c77d7429debad4df86a0bc5382a94173b46700 (patch)
treef09e81c90a9ee8162901722b29b6aabd2b04ce77 /lib
parent7d279e06a0ada26198f2e69346253ece8b8660d1 (diff)
downloadspack-41c77d7429debad4df86a0bc5382a94173b46700.tar.gz
spack-41c77d7429debad4df86a0bc5382a94173b46700.tar.bz2
spack-41c77d7429debad4df86a0bc5382a94173b46700.tar.xz
spack-41c77d7429debad4df86a0bc5382a94173b46700.zip
Add installcheck phase to AutotoolsPackage (#2863)
* Add installcheck phase to AutotoolsPackage * Update installcheck phase with new callbacks API * build_directory has been converted to a property
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/autotools.py12
-rw-r--r--lib/spack/spack/package.py21
2 files changed, 33 insertions, 0 deletions
diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py
index af6f5507b2..f0f57b1232 100644
--- a/lib/spack/spack/build_systems/autotools.py
+++ b/lib/spack/spack/build_systems/autotools.py
@@ -84,6 +84,9 @@ class AutotoolsPackage(PackageBase):
#: Callback names for build-time test
build_time_test_callbacks = ['check']
+ #: Callback names for install-time test
+ install_time_test_callbacks = ['installcheck']
+
#: Set to true to force the autoreconf step even if configure is present
force_autoreconf = False
#: Options to be passed to autoreconf when using the default implementation
@@ -288,5 +291,14 @@ class AutotoolsPackage(PackageBase):
self._if_make_target_execute('test')
self._if_make_target_execute('check')
+ run_after('install')(PackageBase._run_default_install_time_test_callbacks)
+
+ def installcheck(self):
+ """Searches the Makefile for an ``installcheck`` target
+ and runs it if found.
+ """
+ with working_dir(self.build_directory):
+ self._if_make_target_execute('installcheck')
+
# Check that self.prefix is there after installation
run_after('install')(PackageBase.sanity_check_prefix)
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 797ae1ff5d..e5ea8c56ad 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -1733,6 +1733,27 @@ class PackageBase(object):
msg = 'RUN-TESTS: method not implemented [{0}]'
tty.warn(msg.format(name))
+ install_time_test_callbacks = None
+
+ @on_package_attributes(run_tests=True)
+ def _run_default_install_time_test_callbacks(self):
+ """Tries to call all the methods that are listed in the attribute
+ ``install_time_test_callbacks`` if ``self.run_tests is True``.
+
+ If ``install_time_test_callbacks is None`` returns immediately.
+ """
+ if self.install_time_test_callbacks is None:
+ return
+
+ for name in self.install_time_test_callbacks:
+ try:
+ fn = getattr(self, name)
+ tty.msg('RUN-TESTS: install-time tests [{0}]'.format(name))
+ fn()
+ except AttributeError:
+ msg = 'RUN-TESTS: method not implemented [{0}]'
+ tty.warn(msg.format(name))
+
class Package(PackageBase):
"""General purpose class with a single ``install``