aboutsummaryrefslogtreecommitdiff
path: root/unittests/linuxliketests.py
diff options
context:
space:
mode:
authorL. E. Segovia <amy@amyspark.me>2022-10-30 13:05:40 +0000
committerJussi Pakkanen <jpakkane@gmail.com>2022-11-01 17:56:18 +0200
commit7e5b0760ce18666c7b1a42f97ca29ce03406e21b (patch)
tree1d38a4770efe0bd2be5da9bf67a712926d9f47a9 /unittests/linuxliketests.py
parent21f86fa90209538b1d9cc9aa3aaa1d8dc884137f (diff)
downloadmeson-7e5b0760ce18666c7b1a42f97ca29ce03406e21b.zip
meson-7e5b0760ce18666c7b1a42f97ca29ce03406e21b.tar.gz
meson-7e5b0760ce18666c7b1a42f97ca29ce03406e21b.tar.bz2
minstall: make do_strip run with -Sx for macOS targets
This commit also adds some extra symbol noise to lib.c, in order to aid detection of the debug information with nm. Fixes #10943
Diffstat (limited to 'unittests/linuxliketests.py')
-rw-r--r--unittests/linuxliketests.py28
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()