diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-07-10 04:27:23 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-07-10 12:42:52 -0700 |
commit | 47c68a59938c927b3879ecc0e237c2af0156e35a (patch) | |
tree | 3a994053ee4ad8d105236e0274380f3a78fbe7dd /run_unittests.py | |
parent | 09ad29ec560f2a05108694d909de30b5e3e58357 (diff) | |
download | meson-47c68a59938c927b3879ecc0e237c2af0156e35a.zip meson-47c68a59938c927b3879ecc0e237c2af0156e35a.tar.gz meson-47c68a59938c927b3879ecc0e237c2af0156e35a.tar.bz2 |
find_library: Validate and sort globbed shared library files
We need to pick the library with the highest version, which is what
the OpenBSD linker also does.
https://github.com/mesonbuild/meson/issues/3570#issuecomment-403638752
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/run_unittests.py b/run_unittests.py index df4603e..f4e95a3 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -522,12 +522,28 @@ class InternalTests(unittest.TestCase): self.assertEqual(p, shr) p = cc.get_library_naming(env, 'static') self.assertEqual(p, stc) - p = cc.get_library_naming(env, 'default') - self.assertEqual(p, shr + stc) - p = cc.get_library_naming(env, 'shared-static') - self.assertEqual(p, shr + stc) p = cc.get_library_naming(env, 'static-shared') self.assertEqual(p, stc + shr) + p = cc.get_library_naming(env, 'shared-static') + self.assertEqual(p, shr + stc) + p = cc.get_library_naming(env, 'default') + self.assertEqual(p, shr + stc) + # Test find library by mocking up openbsd + if platform != 'openbsd': + return + with tempfile.TemporaryDirectory() as tmpdir: + with open(os.path.join(tmpdir, 'libfoo.so.6.0'), 'w') as f: + f.write('') + with open(os.path.join(tmpdir, 'libfoo.so.5.0'), 'w') as f: + f.write('') + with open(os.path.join(tmpdir, 'libfoo.so.54.0'), 'w') as f: + f.write('') + with open(os.path.join(tmpdir, 'libfoo.so.66a.0b'), 'w') as f: + f.write('') + with open(os.path.join(tmpdir, 'libfoo.so.70.0.so.1'), 'w') as f: + f.write('') + found = cc.find_library_real('foo', env, [tmpdir], '', 'default') + self.assertEqual(os.path.basename(found[0]), 'libfoo.so.54.0') def test_find_library_patterns(self): ''' |