diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2023-07-05 01:10:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-05 01:10:58 +0300 |
commit | d391e5281c982899e17c7a5ceeca30262f1640ea (patch) | |
tree | 17d134e2b037d66f4e75468e552587b7d9b0b95d /unittests | |
parent | 7fe6e18a02129d788cd29e6861b331341265f4c7 (diff) | |
parent | ff86e799a4d1119f51d7e7715944a2c87eaef509 (diff) | |
download | meson-d391e5281c982899e17c7a5ceeca30262f1640ea.zip meson-d391e5281c982899e17c7a5ceeca30262f1640ea.tar.gz meson-d391e5281c982899e17c7a5ceeca30262f1640ea.tar.bz2 |
Merge pull request #11742 from xclaesse/link-whole-cases
Fix niche cases when linking static libs
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/allplatformstests.py | 3 | ||||
-rw-r--r-- | unittests/linuxliketests.py | 17 |
2 files changed, 18 insertions, 2 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index c484f2d..438e4fe 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -4407,8 +4407,7 @@ class AllPlatformTests(BasePlatformTests): structured_sources=None, objects=[], environment=env, compilers=env.coredata.compilers[MachineChoice.HOST], kwargs={}) - target.process_compilers() - target.process_compilers_late([]) + target.process_compilers_late() return target.filename shared_lib_name = lambda name: output_name(name, SharedLibrary) diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py index 1911539..4bb6809 100644 --- a/unittests/linuxliketests.py +++ b/unittests/linuxliketests.py @@ -1828,3 +1828,20 @@ class LinuxlikeTests(BasePlatformTests): with self.assertRaises(subprocess.CalledProcessError) as e: self.run_tests() self.assertNotIn('Traceback', e.exception.output) + + @skipUnless(is_linux(), "Ninja file differs on different platforms") + def test_complex_link_cases(self): + testdir = os.path.join(self.unit_test_dir, '113 complex link cases') + self.init(testdir) + self.build() + with open(os.path.join(self.builddir, 'build.ninja'), encoding='utf-8') as f: + content = f.read() + # Verify link dependencies, see comments in meson.build. + self.assertIn('build libt1-s3.a: STATIC_LINKER libt1-s2.a.p/s2.c.o libt1-s3.a.p/s3.c.o\n', content) + self.assertIn('build t1-e1: c_LINKER t1-e1.p/main.c.o | libt1-s1.a libt1-s3.a\n', content) + self.assertIn('build libt2-s3.a: STATIC_LINKER libt2-s2.a.p/s2.c.o libt2-s1.a.p/s1.c.o libt2-s3.a.p/s3.c.o\n', content) + self.assertIn('build t2-e1: c_LINKER t2-e1.p/main.c.o | libt2-s3.a\n', content) + self.assertIn('build t3-e1: c_LINKER t3-e1.p/main.c.o | libt3-s3.so.p/libt3-s3.so.symbols\n', content) + self.assertIn('build t4-e1: c_LINKER t4-e1.p/main.c.o | libt4-s2.so.p/libt4-s2.so.symbols libt4-s3.a\n', content) + self.assertIn('build t5-e1: c_LINKER t5-e1.p/main.c.o | libt5-s1.so.p/libt5-s1.so.symbols libt5-s3.a\n', content) + self.assertIn('build t6-e1: c_LINKER t6-e1.p/main.c.o | libt6-s2.a libt6-s3.a\n', content) |