diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-07-20 18:00:15 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-07-23 02:12:00 +0300 |
commit | de2d59cc27777562e55091633331aa478a877afd (patch) | |
tree | a4a2a593e86076ddfcc213ee9fcfe14447a4e0b6 /run_unittests.py | |
parent | b3d048e93a55feaedadb1efae72de0b8871eefab (diff) | |
download | meson-de2d59cc27777562e55091633331aa478a877afd.zip meson-de2d59cc27777562e55091633331aa478a877afd.tar.gz meson-de2d59cc27777562e55091633331aa478a877afd.tar.bz2 |
find_library: Ignore libs on MSVC properly
In addition to filtering libs out while generating the command-line, we
must also filter them out in find_library() otherwise these libs will be
detected as "found" on Windows with MSVC.
Closes https://github.com/mesonbuild/meson/issues/1509
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index 875ba65..ff5a015 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1431,6 +1431,23 @@ class WindowsTests(BasePlatformTests): self.assertPathEqual(prog.get_command()[0], sys.executable) self.assertPathBasenameEqual(prog.get_path(), 'test-script-ext.py') + def test_ignore_libs(self): + ''' + Test that find_library on libs that are to be ignored returns an empty + array of arguments. Must be a unit test because we cannot inspect + ExternalLibraryHolder from build files. + ''' + testdir = os.path.join(self.platform_test_dir, '1 basic') + env = Environment(testdir, self.builddir, self.meson_command, + get_fake_options(self.prefix), []) + cc = env.detect_c_compiler(False) + if cc.id != 'msvc': + raise unittest.SkipTest('Not using MSVC') + # To force people to update this test, and also test + self.assertEqual(set(cc.ignore_libs), {'c', 'm', 'pthread'}) + for l in cc.ignore_libs: + self.assertEqual(cc.find_library(l, env, []), []) + class LinuxlikeTests(BasePlatformTests): ''' |