diff options
Diffstat (limited to 'unittests/linuxliketests.py')
-rw-r--r-- | unittests/linuxliketests.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py index 357e420..8dd9cfc 100644 --- a/unittests/linuxliketests.py +++ b/unittests/linuxliketests.py @@ -1773,25 +1773,41 @@ class LinuxlikeTests(BasePlatformTests): # If so, we can test that cmake works with "gcc -m32" self.do_one_test_with_nativefile('../cmake/1 basic', "['gcc', '-m32']") - @skipUnless(is_linux(), 'Test only applicable to Linux') + @skipUnless(is_linux() or is_osx(), 'Test only applicable to Linux and macOS') def test_install_strip(self): testdir = os.path.join(self.unit_test_dir, '103 strip') self.init(testdir) self.build() destdir = self.installdir + self.prefix - lib = os.path.join(destdir, self.libdir, 'liba.so') + if is_linux(): + lib = os.path.join(destdir, self.libdir, 'liba.so') + else: + lib = os.path.join(destdir, self.libdir, 'liba.dylib') install_cmd = self.meson_command + ['install', '--destdir', self.installdir] # Check we have debug symbols by default self._run(install_cmd, workdir=self.builddir) - stdout = self._run(['file', '-b', lib]) - self.assertIn('not stripped', stdout) + if is_linux(): + # file can detect stripped libraries on linux + stdout = self._run(['file', '-b', lib]) + self.assertIn('not stripped', stdout) + else: + #Â on macOS we need to query dsymutil instead. + # Alternatively, check if __dyld_private is defined + # in the output of nm liba.dylib, but that is not + # 100% reliable, it needs linking to an external library + stdout = self._run(['dsymutil', '--dump-debug-map', lib]) + self.assertIn('symbols:', stdout) # Check debug symbols got removed with --strip self._run(install_cmd + ['--strip'], workdir=self.builddir) - stdout = self._run(['file', '-b', lib]) - self.assertNotIn('not stripped', stdout) + if is_linux(): + stdout = self._run(['file', '-b', lib]) + self.assertNotIn('not stripped', stdout) + else: + stdout = self._run(['dsymutil', '--dump-debug-map', lib]) + self.assertNotIn('symbols:', stdout) def test_isystem_default_removal_with_symlink(self): env = get_fake_env() |