aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-11-16 11:25:31 -0800
committerDylan Baker <dylan@pnwbakers.com>2020-11-18 14:44:07 -0800
commit460cb9af08565b6e1c26fcec5eb19ac2d94a1776 (patch)
tree6d40f9b8da1105c6d505e013aaab3929ed9e081a
parent3e89c30bae2265e694212a5909a553de0484dc14 (diff)
downloadmeson-460cb9af08565b6e1c26fcec5eb19ac2d94a1776.zip
meson-460cb9af08565b6e1c26fcec5eb19ac2d94a1776.tar.gz
meson-460cb9af08565b6e1c26fcec5eb19ac2d94a1776.tar.bz2
unittests: ignore nix rpaths
As a necessity nix adds a bunch of rpaths to files, this is unavoidable do to the way nix package management works. Meson doesn't expect this however, and fails all rpath tests. To correct this we just ignore any rpath entries that start with `/nix`.
-rwxr-xr-xrun_unittests.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/run_unittests.py b/run_unittests.py
index ef5e48a..a6ca087 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -92,7 +92,7 @@ def chdir(path: str):
os.chdir(curdir)
-def get_dynamic_section_entry(fname, entry):
+def get_dynamic_section_entry(fname: str, entry: str) -> T.Optional[str]:
if is_cygwin() or is_osx():
raise unittest.SkipTest('Test only applicable to ELF platforms')
@@ -106,14 +106,21 @@ def get_dynamic_section_entry(fname, entry):
for line in raw_out.split('\n'):
m = pattern.search(line)
if m is not None:
- return m.group(1)
+ return str(m.group(1))
return None # The file did not contain the specified entry.
-def get_soname(fname):
+def get_soname(fname: str) -> T.Optional[str]:
return get_dynamic_section_entry(fname, 'soname')
-def get_rpath(fname):
- return get_dynamic_section_entry(fname, r'(?:rpath|runpath)')
+def get_rpath(fname: str) -> T.Optional[str]:
+ raw = get_dynamic_section_entry(fname, r'(?:rpath|runpath)')
+ # Get both '' and None here
+ if not raw:
+ return None
+ # nix/nixos adds a bunch of stuff to the rpath out of necessity that we
+ # don't check for, so clear those
+ final = ':'.join([e for e in raw.split(':') if not e.startswith('/nix')])
+ return final
def is_tarball():
if not os.path.isdir('docs'):