From a1d9adba096589122aefc50fb9429ec0ce0432b9 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 2 Jul 2018 18:44:36 +0530 Subject: FeatureNew: Make all checks subproject-specific We now pass the current subproject to every FeatureNew and FeatureDeprecated call. This requires a bunch of rework to: 1. Ensure that we have access to the subproject in the list of arguments when used as a decorator (see _get_callee_args). 2. Pass the subproject to .use() when it's called manually. 3. We also can't do feature checks for new features in meson_options.txt because that's parsed before we know the meson_version from project() --- run_unittests.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'run_unittests.py') diff --git a/run_unittests.py b/run_unittests.py index 480ae2e..b6ad20d 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -2271,6 +2271,21 @@ recommended as it is not supported on some platforms''') arches = set(arches[1:]) self.assertEqual(arches, set(mesonbuild.environment.known_cpu_families)) + def test_feature_check_usage_subprojects(self): + testdir = os.path.join(self.unit_test_dir, '34 featurenew subprojects') + out = self.init(testdir) + # Parent project warns correctly + self.assertRegex(out, "WARNING: Project targetting '>=0.45'.*'0.47.0': dict") + # Subproject warns correctly + self.assertRegex(out, "|WARNING: Project targetting '>=0.40'.*'0.44.0': disabler") + # Subproject has a new-enough meson_version, no warning + self.assertNotRegex(out, "WARNING: Project targetting.*Python") + # Ensure a summary is printed in the subproject and the outer project + self.assertRegex(out, "|WARNING: Project specifies a minimum meson_version '>=0.40'") + self.assertRegex(out, "| * 0.44.0: {'disabler'}") + self.assertRegex(out, "WARNING: Project specifies a minimum meson_version '>=0.45'") + self.assertRegex(out, " * 0.47.0: {'dict'}") + class FailureTests(BasePlatformTests): ''' @@ -2493,6 +2508,11 @@ class FailureTests(BasePlatformTests): ".*WARNING.*Project targetting.*but.*", meson_version='>= 0.47.0') + def test_using_too_recent_feature_dependency(self): + self.assertMesonOutputs("dependency('pcap', required: false)", + ".*WARNING.*Project targetting.*but.*", + meson_version='>= 0.41.0') + class WindowsTests(BasePlatformTests): ''' -- cgit v1.1