diff options
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 9560319..a461df5 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. |