Skip to content

Commit 8c4c8e6

Browse files
committed
TST: add another RPATH handling verification test
This shows that build RPATHs are not correctly stripped.
1 parent 723364e commit 8c4c8e6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_wheel.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,27 @@ def test_local_lib(venv, wheel_link_against_local_lib):
178178
assert int(output) == 3
179179

180180

181+
@pytest.mark.skipif(sys.platform in {'win32', 'cygwin'}, reason='requires RPATH support')
182+
def test_sharedlib_in_package_rpath(wheel_sharedlib_in_package, tmp_path):
183+
artifact = wheel.wheelfile.WheelFile(wheel_sharedlib_in_package)
184+
artifact.extractall(tmp_path)
185+
186+
origin = '@loader_path' if sys.platform == 'darwin' else '$ORIGIN'
187+
188+
rpath = set(mesonpy._rpath._get_rpath(tmp_path / 'mypkg' / f'_example{EXT_SUFFIX}'))
189+
# This RPATH entry should be removed by meson-python but it is not.
190+
build_rpath = {f'{origin}/../src'}
191+
assert rpath == {origin, *build_rpath}
192+
193+
rpath = set(mesonpy._rpath._get_rpath(tmp_path / 'mypkg' / f'liblib{LIB_SUFFIX}'))
194+
# This RPATH entry should be removed by meson-python but it is not.
195+
build_rpath = {f'{origin}/'}
196+
assert rpath == {f'{origin}/sub', *build_rpath}
197+
198+
rpath = set(mesonpy._rpath._get_rpath(tmp_path / 'mypkg' / 'sub' / f'libsublib{LIB_SUFFIX}'))
199+
assert rpath == set()
200+
201+
181202
def test_sharedlib_in_package(venv, wheel_sharedlib_in_package):
182203
venv.pip('install', wheel_sharedlib_in_package)
183204
output = venv.python('-c', 'import mypkg; print(mypkg.prodsum(2, 3, 4))')

0 commit comments

Comments
 (0)