aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-07-02 18:44:36 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-07-02 19:52:53 +0530
commita1d9adba096589122aefc50fb9429ec0ce0432b9 (patch)
tree65711916a354df107ab4022a200855938bacd3a2 /run_unittests.py
parent5714ba253467d84b9cd1003b99e6596b5d86f20a (diff)
downloadmeson-a1d9adba096589122aefc50fb9429ec0ce0432b9.zip
meson-a1d9adba096589122aefc50fb9429ec0ce0432b9.tar.gz
meson-a1d9adba096589122aefc50fb9429ec0ce0432b9.tar.bz2
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()
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py20
1 files changed, 20 insertions, 0 deletions
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):
'''