aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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