aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@gmail.com>2023-02-10 17:03:15 -0500
committerXavier Claessens <xclaesse@gmail.com>2023-03-01 08:56:46 -0500
commitb27104d92040a6e4976ec4d4e1f11b3196d6ea0a (patch)
tree8af1f25bc90393180dcf8f374879455afd74a54e /unittests
parentc8490315133166136b6dd8ac8b94c7349240eea0 (diff)
downloadmeson-b27104d92040a6e4976ec4d4e1f11b3196d6ea0a.zip
meson-b27104d92040a6e4976ec4d4e1f11b3196d6ea0a.tar.gz
meson-b27104d92040a6e4976ec4d4e1f11b3196d6ea0a.tar.bz2
unittests: add test for source dir stripping from rpaths
This test checks that rpaths are stripped correctly when their prefix matches the source directory. This test fails without the previous commit: 1/4 visitation FAIL 0.01s exit status 127 >>> MALLOC_PERTURB_=150 meson/tmpy7c0joy5/patron ――――――――――――――――――――――――――――――――――――― βœ€ ――――――――――――――――――――――――――――――――――――― stderr: meson/tmpy7c0joy5/patron: error while loading shared libraries: libalexandria.so: cannot open shared object file: No such file or directory Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Diffstat (limited to 'unittests')
-rw-r--r--unittests/allplatformstests.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 99dbf51..6d48019 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -1679,6 +1679,48 @@ class AllPlatformTests(BasePlatformTests):
self.build()
self.run_tests()
+ def test_prebuilt_shared_lib_rpath_same_prefix(self) -> None:
+ (cc, _, object_suffix, shared_suffix) = self.detect_prebuild_env()
+ orig_tdir = os.path.join(self.unit_test_dir, '17 prebuilt shared')
+
+ # Put the shared library in a location that shares a common prefix with
+ # the source directory:
+ #
+ # .../
+ # foo-lib/
+ # libalexandria.so
+ # foo/
+ # meson.build
+ # ...
+ #
+ # This allows us to check that the .../foo-lib/libalexandria.so path is
+ # preserved correctly when meson processes it.
+ with tempfile.TemporaryDirectory() as d:
+ libdir = os.path.join(d, 'foo-lib')
+ os.mkdir(libdir)
+
+ source = os.path.join(orig_tdir, 'alexandria.c')
+ objectfile = os.path.join(libdir, 'alexandria.' + object_suffix)
+ impfile = os.path.join(libdir, 'alexandria.lib')
+ if cc.get_argument_syntax() == 'msvc':
+ shlibfile = os.path.join(libdir, 'alexandria.' + shared_suffix)
+ elif is_cygwin():
+ shlibfile = os.path.join(libdir, 'cygalexandria.' + shared_suffix)
+ else:
+ shlibfile = os.path.join(libdir, 'libalexandria.' + shared_suffix)
+ # Ensure MSVC extra files end up in the directory that gets deleted
+ # at the end
+ with chdir(libdir):
+ self.build_shared_lib(cc, source, objectfile, shlibfile, impfile)
+
+ tdir = os.path.join(d, 'foo')
+ shutil.copytree(orig_tdir, tdir)
+
+ # Run the test
+ self.init(tdir, extra_args=[f'-Dsearch_dir={libdir}'])
+ self.build()
+ self.run_tests()
+
def test_underscore_prefix_detection_list(self) -> None:
'''
Test the underscore detection hardcoded lookup list