aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-12-28 06:28:35 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-01-01 01:14:03 +0530
commit851475db9b8772930276a29320a14714d3a4da92 (patch)
tree9adb16e9b7577fdb262c8729d52255cccec0abce /run_unittests.py
parentdd3f49af0d8c94033e6db68b25c23ea9e63e9c5c (diff)
downloadmeson-851475db9b8772930276a29320a14714d3a4da92.zip
meson-851475db9b8772930276a29320a14714d3a4da92.tar.gz
meson-851475db9b8772930276a29320a14714d3a4da92.tar.bz2
intrp: Consolidate subproject dep checking and logging
If a dep is not found on the system and a fallback is specified, we have two cases: 1. Look for the dependency in a pre-initialized subproject 2. Initialize the subproject and look for the dependency Both these require version comparing, ensuring the fetched variable is a dependency, and printing a success message, erroring out, etc. Now we share the relevant code instead of duplicating it. It already diverged, so this is a good thing. As a side-effect, we now log fallback dependencies in the same format as system dependencies: Dependency libva found: YES Dependency libva found: YES (cached) Dependency glib-2.0 from subproject subprojects/glib found: YES Dependency glib-2.0 from subproject subprojects/glib found: YES (cached)
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 184386c..107306b 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1880,6 +1880,29 @@ class FailureTests(BasePlatformTests):
return
raise unittest.SkipTest("objc and objcpp found, can't test detection failure")
+ def test_subproject_variables(self):
+ '''
+ Test that:
+ 1. The correct message is outputted when a not-required dep is not
+ found and the fallback subproject is also not found.
+ 2. A not-found not-required dep with a fallback subproject outputs the
+ correct message when the fallback subproject is found but the
+ variable inside it is not.
+ 3. A fallback dependency is found from the subproject parsed in (2)
+ 4. A not-required fallback dependency is not found because the
+ subproject failed to parse.
+ '''
+ tdir = os.path.join(self.unit_test_dir, '20 subproj dep variables')
+ out = self.init(tdir, inprocess=True)
+ self.assertRegex(out, r"Also couldn't find a fallback subproject "
+ "in.*subprojects.*nosubproj.*for the dependency.*somedep")
+ self.assertRegex(out, r'Dependency.*somenotfounddep.*from subproject.*'
+ 'subprojects.*somesubproj.*found:.*NO')
+ self.assertRegex(out, r'Dependency.*zlibproxy.*from subproject.*'
+ 'subprojects.*somesubproj.*found:.*YES.*(cached)')
+ self.assertRegex(out, r'Also couldn\'t find a fallback subproject in '
+ '.*subprojects.*failingsubproj.*for the dependency.*somedep')
+
class WindowsTests(BasePlatformTests):
'''