aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-10-06 17:33:12 +0300
committerGitHub <noreply@github.com>2019-10-06 17:33:12 +0300
commit51fef880b6a12e82955d5b93df7ffed0ae2f1478 (patch)
tree327575ae53cc7e25389ee6af1a02861c8296b9ad /run_unittests.py
parent5bbea6be05c9740aedcd7f170c24a6b2c098cd01 (diff)
parent47e20b3004b41261c01b1a46898252924f031f1d (diff)
downloadmeson-51fef880b6a12e82955d5b93df7ffed0ae2f1478.zip
meson-51fef880b6a12e82955d5b93df7ffed0ae2f1478.tar.gz
meson-51fef880b6a12e82955d5b93df7ffed0ae2f1478.tar.bz2
Merge pull request #5953 from mensinda/isystem
Add is_system to dependency
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index d6c81a1..bfd7a54 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -447,6 +447,8 @@ class InternalTests(unittest.TestCase):
## Test --start/end-group
linker = mesonbuild.linkers.GnuDynamicLinker([], MachineChoice.HOST, 'fake', '-Wl,')
gcc = mesonbuild.compilers.GnuCCompiler([], 'fake', mesonbuild.compilers.CompilerType.GCC_STANDARD, False, MachineChoice.HOST, linker=linker)
+ ## Ensure that the fake compiler is never called by overriding the relevant function
+ gcc.get_default_include_dirs = lambda: ['/usr/include', '/usr/share/include', '/usr/local/include']
## Test that 'direct' append and extend works
l = cargsfunc(gcc, ['-Lfoodir', '-lfoo'])
self.assertEqual(l.to_native(copy=True), ['-Lfoodir', '-Wl,--start-group', '-lfoo', '-Wl,--end-group'])
@@ -469,6 +471,20 @@ class InternalTests(unittest.TestCase):
l.append('-Wl,-ldl')
self.assertEqual(l.to_native(copy=True), ['-Lfoo', '-Lfoodir', '-Wl,--start-group', '-lfoo', '-Lbardir', '-lbar', '-lbar', '/libbaz.a', '-Wl,--export-dynamic', '-Wl,-ldl', '-Wl,--end-group'])
+ def test_compiler_args_remove_system(self):
+ cargsfunc = mesonbuild.compilers.CompilerArgs
+ ## Test --start/end-group
+ linker = mesonbuild.linkers.GnuDynamicLinker([], MachineChoice.HOST, 'fake', '-Wl,')
+ gcc = mesonbuild.compilers.GnuCCompiler([], 'fake', mesonbuild.compilers.CompilerType.GCC_STANDARD, False, MachineChoice.HOST, linker=linker)
+ ## Ensure that the fake compiler is never called by overriding the relevant function
+ gcc.get_default_include_dirs = lambda: ['/usr/include', '/usr/share/include', '/usr/local/include']
+ ## Test that 'direct' append and extend works
+ l = cargsfunc(gcc, ['-Lfoodir', '-lfoo'])
+ self.assertEqual(l.to_native(copy=True), ['-Lfoodir', '-Wl,--start-group', '-lfoo', '-Wl,--end-group'])
+ ## Test that to_native removes all system includes
+ l += ['-isystem/usr/include', '-isystem=/usr/share/include', '-DSOMETHING_IMPORTANT=1', '-isystem', '/usr/local/include']
+ self.assertEqual(l.to_native(copy=True), ['-Lfoodir', '-Wl,--start-group', '-lfoo', '-Wl,--end-group', '-DSOMETHING_IMPORTANT=1'])
+
def test_string_templates_substitution(self):
dictfunc = mesonbuild.mesonlib.get_filenames_templates_dict
substfunc = mesonbuild.mesonlib.substitute_values