diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-11-14 16:43:00 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-11-27 18:20:52 +0200 |
commit | f86aa3c0800d3489befe0391c75977aa1d0271bb (patch) | |
tree | a9077253ddda554d32c7e5aef00deec852795968 /run_unittests.py | |
parent | cef13b04c253150a449eaea806d97207281916eb (diff) | |
download | meson-prelink.tar.gz |
Add prelinking support for static libraries.prelink
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index 956031965..a461df5f2 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -7389,6 +7389,32 @@ class LinuxlikeTests(BasePlatformTests): content = f.read() self.assertNotIn('-lfoo', content) + def test_prelinking(self): + # Prelinking currently only works on recently new GNU toolchains. + # Skip everything else. When support for other toolchains is added, + # remove limitations as necessary. + if is_osx(): + raise unittest.SkipTest('Prelinking not supported on Darwin.') + if 'clang' in os.environ.get('CC', 'dummy'): + raise unittest.SkipTest('Prelinking not supported with Clang.') + gccver = subprocess.check_output(['cc', '--version']) + if b'7.5.0' in gccver: + raise unittest.SkipTest('GCC on Bionic is too old to be supported.') + testdir = os.path.join(self.unit_test_dir, '87 prelinking') + self.init(testdir) + self.build() + outlib = os.path.join(self.builddir, 'libprelinked.a') + ar = shutil.which('ar') + self.assertTrue(os.path.exists(outlib)) + self.assertTrue(ar is not None) + p = subprocess.run([ar, 't', outlib], + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + universal_newlines=True, timeout=1) + obj_files = p.stdout.strip().split('\n') + self.assertEqual(len(obj_files), 1) + self.assertTrue(obj_files[0].endswith('-prelink.o')) + class BaseLinuxCrossTests(BasePlatformTests): # Don't pass --libdir when cross-compiling. We have tests that # check whether meson auto-detects it correctly. |