aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-07-20 18:00:15 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2017-07-23 02:12:00 +0300
commitde2d59cc27777562e55091633331aa478a877afd (patch)
treea4a2a593e86076ddfcc213ee9fcfe14447a4e0b6 /run_unittests.py
parentb3d048e93a55feaedadb1efae72de0b8871eefab (diff)
downloadmeson-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-xrun_unittests.py17
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):
'''