Commit 6f1a1cb8 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 5d5d40d9
......@@ -58,9 +58,9 @@ def checkSoftware(slap, software_url):
with software installations.
"""
# 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_lib_white_list = set((
system_lib_allowed_list = set((
'libanl',
'libc',
'libcrypt',
......@@ -76,6 +76,10 @@ def checkSoftware(slap, software_url):
'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,
# for which we generate LD_LIBRARY_PATH wrappers or we don't use directly.
ignored_file_patterns = set((
......@@ -109,7 +113,7 @@ def checkSoftware(slap, software_url):
ldd_so_resolved_re = re.compile(
r'\t(?P<library_name>.*) => (?P<library_path>.*) \(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):
"""Exception raised when ldd cannot resolve a library.
......@@ -150,6 +154,8 @@ def checkSoftware(slap, software_url):
# VDSO or ELF, ignore . See https://stackoverflow.com/a/35805410/7294664 for more about this
pass
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)
else:
raise RuntimeError('Unknown ldd line %s for %s.' % (line, path))
......@@ -182,7 +188,7 @@ def checkSoftware(slap, software_url):
executable_link_error_list.append(str(e))
else:
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
lib_path = os.path.realpath(lib_path)
# 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