Commit c9f58389 authored by Jérome Perrin's avatar Jérome Perrin

testing/check_software: support ignoring some not found dynamic libraries

This can be useful for scenarios where shared objects are dynamically loaded at
runtime, after having pre-loaded dynamically some shared objects they depend on.
parent ab82a0af
...@@ -58,9 +58,9 @@ def checkSoftware(slap, software_url): ...@@ -58,9 +58,9 @@ def checkSoftware(slap, software_url):
with software installations. with software installations.
""" """
# Check that all components set rpath correctly and we don't have miss linking any libraries. # Check that all components set rpath correctly and we don't have miss linking any libraries.
# Also check that they are not linked against system libraries, except a white list of core # Also check that they are not linked against system libraries, except a list of core
# system libraries. # system libraries.
system_lib_white_list = set(( system_lib_allowed_list = set((
'libanl', 'libanl',
'libc', 'libc',
'libcrypt', 'libcrypt',
...@@ -76,6 +76,10 @@ def checkSoftware(slap, software_url): ...@@ -76,6 +76,10 @@ def checkSoftware(slap, software_url):
'libutil', 'libutil',
)) ))
# Some libraries might also not be found statically but provided at run time.
missing_lib_allowed_list = set((
))
# we also ignore a few patterns for part that are known to be binary distributions, # we also ignore a few patterns for part that are known to be binary distributions,
# for which we generate LD_LIBRARY_PATH wrappers or we don't use directly. # for which we generate LD_LIBRARY_PATH wrappers or we don't use directly.
ignored_file_patterns = set(( ignored_file_patterns = set((
...@@ -109,7 +113,7 @@ def checkSoftware(slap, software_url): ...@@ -109,7 +113,7 @@ def checkSoftware(slap, software_url):
ldd_so_resolved_re = re.compile( ldd_so_resolved_re = re.compile(
r'\t(?P<library_name>.*) => (?P<library_path>.*) \(0x') r'\t(?P<library_name>.*) => (?P<library_path>.*) \(0x')
ldd_already_loaded_re = re.compile(r'\t(?P<library_name>.*) \(0x') ldd_already_loaded_re = re.compile(r'\t(?P<library_name>.*) \(0x')
ldd_not_found_re = re.compile(r'.*not found.*') ldd_not_found_re = re.compile(r'\t(?P<library_name>.*) => not found.*')
class DynamicLibraryNotFound(Exception): class DynamicLibraryNotFound(Exception):
"""Exception raised when ldd cannot resolve a library. """Exception raised when ldd cannot resolve a library.
...@@ -150,6 +154,8 @@ def checkSoftware(slap, software_url): ...@@ -150,6 +154,8 @@ def checkSoftware(slap, software_url):
# VDSO or ELF, ignore . See https://stackoverflow.com/a/35805410/7294664 for more about this # VDSO or ELF, ignore . See https://stackoverflow.com/a/35805410/7294664 for more about this
pass pass
elif not_found_match: elif not_found_match:
library_name = not_found_match.group('library_name')
if library_name.split('.')[0] not in missing_lib_allowed_list:
not_found.append(line) not_found.append(line)
else: else:
raise RuntimeError('Unknown ldd line %s for %s.' % (line, path)) raise RuntimeError('Unknown ldd line %s for %s.' % (line, path))
...@@ -182,7 +188,7 @@ def checkSoftware(slap, software_url): ...@@ -182,7 +188,7 @@ def checkSoftware(slap, software_url):
executable_link_error_list.append(str(e)) executable_link_error_list.append(str(e))
else: else:
for lib, lib_path in libs.items(): for lib, lib_path in libs.items():
if lib.split('.')[0] in system_lib_white_list: if lib.split('.')[0] in system_lib_allowed_list:
continue continue
lib_path = os.path.realpath(lib_path) lib_path = os.path.realpath(lib_path)
# dynamically linked programs can only be linked with libraries # dynamically linked programs can only be linked with libraries
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment