diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-12-03 12:08:39 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-12-03 13:08:42 -0800 |
commit | f8aa17d8e62e05ed264a00a5e948b3e42aa68b30 (patch) | |
tree | 78ae4e6832cef3c60310773dbfaa4d75df354a9f | |
parent | afe00f42177f865a7f1781c0ccac280b7cf0d746 (diff) | |
download | meson-f8aa17d8e62e05ed264a00a5e948b3e42aa68b30.zip meson-f8aa17d8e62e05ed264a00a5e948b3e42aa68b30.tar.gz meson-f8aa17d8e62e05ed264a00a5e948b3e42aa68b30.tar.bz2 |
run_unittests: Add tests for LD on windows
-rwxr-xr-x | run_unittests.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index feb3ee8..dcc4dec 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -4496,6 +4496,29 @@ class WindowsTests(BasePlatformTests): self.assertTrue('prog.pdb' in files) + def _check_ld(self, name: str, lang: str, expected: str) -> None: + if not shutil.which(name): + raise unittest.SkipTest('Could not find {}.'.format(name)) + with mock.patch.dict(os.environ, {'LD': name}): + env = get_fake_env() + try: + comp = getattr(env, 'detect_{}_compiler'.format(lang))(MachineChoice.HOST) + except EnvironmentException: + raise unittest.SkipTest('Could not find a compiler for {}'.format(lang)) + self.assertEqual(comp.linker.id, expected) + + def test_link_environment_variable_lld_link(self): + self._check_ld('lld-link', 'c', 'lld-link') + + def test_link_environment_variable_link(self): + self._check_ld('link', 'c', 'link') + + def test_link_environment_variable_optlink(self): + self._check_ld('optlink', 'c', 'optlink') + + def test_link_environment_variable_rust(self): + self._check_ld('link', 'rust', 'link') + @unittest.skipUnless(is_osx(), "requires Darwin") class DarwinTests(BasePlatformTests): ''' |