diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-10-18 22:52:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-18 22:52:56 +0300 |
commit | d8cd194214a75b845689bc13cb45928619921056 (patch) | |
tree | 3833607c59c3609d8874a36b1de691e5c45e9c3f /run_unittests.py | |
parent | 7bd06d88d56e66863e9bf4a2a3291a2efacb66ce (diff) | |
parent | 9ac98040ae06ec4c0da059a3cd8c729626d6099c (diff) | |
download | meson-d8cd194214a75b845689bc13cb45928619921056.zip meson-d8cd194214a75b845689bc13cb45928619921056.tar.gz meson-d8cd194214a75b845689bc13cb45928619921056.tar.bz2 |
Merge pull request #866 from centricular/vala-no-c-warn-args
Don't add C warning args while building Vala C code
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index 79cdae0..b9c1397 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -45,6 +45,7 @@ class LinuxlikeTests(unittest.TestCase): self.mconf_command = [sys.executable, os.path.join(src_root, 'mesonconf.py')] self.ninja_command = [detect_ninja(), '-C', self.builddir] self.common_test_dir = os.path.join(src_root, 'test cases/common') + self.vala_test_dir = os.path.join(src_root, 'test cases/vala') self.output = b'' self.orig_env = os.environ.copy() @@ -108,5 +109,32 @@ class LinuxlikeTests(unittest.TestCase): self.assertEqual(simple_dep.get_version(), '1.0') self.assertTrue('-lfoo' in simple_dep.get_link_args()) + def test_vala_c_warnings(self): + testdir = os.path.join(self.vala_test_dir, '5 target glib') + self.init(testdir) + compdb = self.get_compdb() + vala_command = None + c_command = None + for each in compdb: + if each['file'].endswith('GLib.Thread.c'): + vala_command = each['command'] + elif each['file'].endswith('retcode.c'): + c_command = each['command'] + else: + m = 'Unknown file {!r} in vala_c_warnings test'.format(each['file']) + raise AssertionError(m) + self.assertIsNotNone(vala_command) + self.assertIsNotNone(c_command) + # -w suppresses all warnings, should be there in Vala but not in C + self.assertTrue('-w' in vala_command) + self.assertFalse('-w' in c_command) + # -Wall enables all warnings, should be there in C but not in Vala + self.assertFalse('-Wall' in vala_command) + self.assertTrue('-Wall' in c_command) + # -Werror converts warnings to errors, should always be there since it's + # injected by an unrelated piece of code and the project has werror=true + self.assertTrue('-Werror' in vala_command) + self.assertTrue('-Werror' in c_command) + if __name__ == '__main__': unittest.main() |