libtool: fix running the unit-tests with spack install --test root (#25707)

Besides adding autoconf and automake as needed for tests of 2.4.6,
skip Fortran test cases when Fortran compilers are not provided.
This commit is contained in:
bernhardkaindl 2021-09-21 22:18:29 +02:00 committed by GitHub
parent c3cb863b82
commit 981551b47f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ class Libtool(AutotoolsPackage, GNUMirrorPackage):
"""libtool -- library building part of autotools."""
homepage = 'https://www.gnu.org/software/libtool/'
gnu_mirror_path = "libtool/libtool-2.4.2.tar.gz"
gnu_mirror_path = "libtool/libtool-2.4.6.tar.gz"
version('develop', git='https://git.savannah.gnu.org/git/libtool.git',
branch='master', submodules=True)
@ -25,6 +25,10 @@ class Libtool(AutotoolsPackage, GNUMirrorPackage):
depends_on('automake', type='build')
depends_on('help2man', type='build')
with when('@2.4.6'):
depends_on('autoconf@2.62:', type='test')
depends_on('automake', type='test')
with when('@develop'):
depends_on('autoconf', type='build')
depends_on('automake', type='build')
@ -92,3 +96,20 @@ def post_install(self):
join_path(self.prefix.bin, 'glibtool'))
symlink(join_path(self.prefix.bin, 'libtoolize'),
join_path(self.prefix.bin, 'glibtoolize'))
def setup_build_environment(self, env):
"""Wrapper until spack has a real implementation of setup_test_environment()"""
if self.run_tests:
self.setup_test_environment(env)
def setup_test_environment(self, env):
"""When Fortran is not provided, a few tests need to be skipped"""
if (self.compiler.f77 is None):
env.set('F77', 'no')
if (self.compiler.fc is None):
env.set('FC', 'no')
@when('@2.4.6')
def check(self):
"""installcheck of libtool-2.4.6 runs the full testsuite, skip 'make check'"""
pass