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
This commit is contained in:
Adam J. Stewart 2017-01-31 13:35:38 -06:00 committed by Todd Gamblin
parent 7d279e06a0
commit 41c77d7429
2 changed files with 33 additions and 0 deletions

View file

@ -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 @@ def check(self):
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)

View file

@ -1733,6 +1733,27 @@ def _run_default_build_time_test_callbacks(self):
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``