summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
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``