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:
parent
7d279e06a0
commit
41c77d7429
@ -84,6 +84,9 @@ class AutotoolsPackage(PackageBase):
|
|||||||
#: Callback names for build-time test
|
#: Callback names for build-time test
|
||||||
build_time_test_callbacks = ['check']
|
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
|
#: Set to true to force the autoreconf step even if configure is present
|
||||||
force_autoreconf = False
|
force_autoreconf = False
|
||||||
#: Options to be passed to autoreconf when using the default implementation
|
#: 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('test')
|
||||||
self._if_make_target_execute('check')
|
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
|
# Check that self.prefix is there after installation
|
||||||
run_after('install')(PackageBase.sanity_check_prefix)
|
run_after('install')(PackageBase.sanity_check_prefix)
|
||||||
|
@ -1733,6 +1733,27 @@ def _run_default_build_time_test_callbacks(self):
|
|||||||
msg = 'RUN-TESTS: method not implemented [{0}]'
|
msg = 'RUN-TESTS: method not implemented [{0}]'
|
||||||
tty.warn(msg.format(name))
|
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):
|
class Package(PackageBase):
|
||||||
"""General purpose class with a single ``install``
|
"""General purpose class with a single ``install``
|
||||||
|
Loading…
Reference in New Issue
Block a user