From 6333ee88c1a243f28b3a7a9bce2dd003b541280a Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 13 Apr 2020 14:35:06 -0400 Subject: Merge wraps from subprojects into wraps from main project wraps from subprojects are now merged into the list of wraps from main project, so they can be used to download dependencies of dependencies instead of having to promote wraps manually. If multiple projects provides the same wrap file, the first one to be configured wins. This also fix usage of sub-subproject that don't have wrap files. We can now configure B when its source tree is at `subprojects/A/subprojects/B/`. This has the implication that we cannot assume that subproject "foo" is at `self.subproject_dir / 'foo'` any more. --- run_unittests.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'run_unittests.py') diff --git a/run_unittests.py b/run_unittests.py index 22e7cdc..cfab11b 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -4183,6 +4183,16 @@ recommended as it is not supported on some platforms''') 'name': 'sub_novar', 'version': '1.0', }, + { + 'descriptive_name': 'subsub', + 'name': 'subsub', + 'version': 'undefined' + }, + { + 'descriptive_name': 'subsubsub', + 'name': 'subsubsub', + 'version': 'undefined' + }, ] } res['subprojects'] = sorted(res['subprojects'], key=lambda i: i['name']) @@ -5365,16 +5375,16 @@ class FailureTests(BasePlatformTests): correct message when the fallback subproject is found but the variable inside it is not. 4. A fallback dependency is found from the subproject parsed in (3) - 5. The correct message is outputted when the .wrap file is missing for - a sub-subproject. + 5. A wrap file from a subproject is used but fails because it does not + contain required keys. ''' tdir = os.path.join(self.unit_test_dir, '20 subproj dep variables') out = self.init(tdir, inprocess=True) self.assertRegex(out, r"Subproject directory not found and .*nosubproj.wrap.* file not found") self.assertRegex(out, r'Function does not take positional arguments.') - self.assertRegex(out, r'WARNING:.* Dependency .*subsubproject.* not found but it is available in a sub-subproject.') - self.assertRegex(out, r'Subproject directory not found and .*subsubproject.wrap.* file not found') + self.assertRegex(out, r'Dependency .*somenotfounddep.* from subproject .*subprojects/somesubproj.* found: .*NO.*') self.assertRegex(out, r'Dependency .*zlibproxy.* from subproject .*subprojects.*somesubproj.* found: .*YES.*') + self.assertRegex(out, r'Missing key .*source_filename.* in subsubproject.wrap') def test_exception_exit_status(self): ''' -- cgit v1.1 From 3a0182378612bc764667328805b11bc92db696c2 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 29 Sep 2020 22:24:56 -0400 Subject: wrap: Add 'redirect' type and use it when auto promote --- run_unittests.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'run_unittests.py') diff --git a/run_unittests.py b/run_unittests.py index cfab11b..f6adcee 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -69,6 +69,8 @@ import mesonbuild.modules.pkgconfig from mesonbuild.mtest import TAPParser, TestResult +from mesonbuild.wrap.wrap import PackageDefinition, WrapException + from run_tests import ( Backend, FakeBuild, FakeCompilerOptions, ensure_backend_detects_changes, exe_suffix, get_backend_commands, @@ -5166,6 +5168,52 @@ recommended as it is not supported on some platforms''') out = self.init(testdir) self.assertNotRegex(out, r'WARNING') + def test_wrap_redirect(self): + redirect_wrap = os.path.join(self.builddir, 'redirect.wrap') + real_wrap = os.path.join(self.builddir, 'foo/subprojects/real.wrap') + os.makedirs(os.path.dirname(real_wrap)) + + # Invalid redirect, filename must have .wrap extension + with open(redirect_wrap, 'w') as f: + f.write(textwrap.dedent(''' + [wrap-redirect] + filename = foo/subprojects/real.wrapper + ''')) + with self.assertRaisesRegex(WrapException, 'wrap-redirect filename must be a .wrap file'): + PackageDefinition(redirect_wrap) + + # Invalid redirect, filename cannot be in parent directory + with open(redirect_wrap, 'w') as f: + f.write(textwrap.dedent(''' + [wrap-redirect] + filename = ../real.wrap + ''')) + with self.assertRaisesRegex(WrapException, 'wrap-redirect filename cannot contain ".."'): + PackageDefinition(redirect_wrap) + + # Invalid redirect, filename must be in foo/subprojects/real.wrap + with open(redirect_wrap, 'w') as f: + f.write(textwrap.dedent(''' + [wrap-redirect] + filename = foo/real.wrap + ''')) + with self.assertRaisesRegex(WrapException, 'wrap-redirect filename must be in the form foo/subprojects/bar.wrap'): + wrap = PackageDefinition(redirect_wrap) + + # Correct redirect + with open(redirect_wrap, 'w') as f: + f.write(textwrap.dedent(''' + [wrap-redirect] + filename = foo/subprojects/real.wrap + ''')) + with open(real_wrap, 'w') as f: + f.write(textwrap.dedent(''' + [wrap-git] + url = http://invalid + ''')) + wrap = PackageDefinition(redirect_wrap) + self.assertEqual(wrap.get('url'), 'http://invalid') + class FailureTests(BasePlatformTests): ''' Tests that test failure conditions. Build files here should be dynamically -- cgit v1.1