From aca984cbf105f8472ea478e265dba717dd3ee974 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Fri, 7 Sep 2018 21:52:14 +0000 Subject: [PATCH] Add test for a weirdness of gclient use_relative_paths and recurse_deps BUG= Change-Id: I1f8be18b821d45564bbabbd4e90eb2624d51a3f9 Reviewed-on: https://chromium-review.googlesource.com/1213582 Reviewed-by: Edward Lesmes Reviewed-by: Andrii Shyshkalov Commit-Queue: Corentin Wallez --- gclient.py | 2 +- tests/gclient_test.py | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/gclient.py b/gclient.py index c68e2c39fa..f65af57b05 100755 --- a/gclient.py +++ b/gclient.py @@ -796,7 +796,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): ]) def findDepsFromNotAllowedHosts(self): - """Returns a list of depenecies from not allowed hosts. + """Returns a list of dependencies from not allowed hosts. If allowed_hosts is not set, allows all hosts and returns empty list. """ diff --git a/tests/gclient_test.py b/tests/gclient_test.py index 227a263e05..ff4c4fa739 100755 --- a/tests/gclient_test.py +++ b/tests/gclient_test.py @@ -772,6 +772,45 @@ class GclientTest(trial_dir.TestCase): ], self._get_processed()) + def testRelativeRecursionInNestedDir(self): + """Verifies a gotcha of relative recursion where the parent uses relative + paths but not the dependency being recursed in. In that case the recursed + dependencies will only take into account the first directory of its path. + In this test it can be seen in baz being placed in foo/third_party.""" + write( + '.gclient', + 'solutions = [\n' + ' { "name": "foo", "url": "svn://example.com/foo" },\n' + ']') + write( + os.path.join('foo', 'DEPS'), + 'use_relative_paths = True\n' + 'deps = {\n' + ' "third_party/bar": "/bar",\n' + '}\n' + 'recursedeps = ["third_party/bar"]') + write( + os.path.join('foo/third_party/bar', 'DEPS'), + 'deps = {\n' + ' "baz": "/baz",\n' + '}') + write( + os.path.join('baz', 'DEPS'), + 'deps = {\n' + ' "fizz": "/fizz",\n' + '}') + + options, _ = gclient.OptionParser().parse_args([]) + obj = gclient.GClient.LoadCurrentConfig(options) + obj.RunOnDeps('None', []) + self.assertEquals( + [ + ('foo', 'svn://example.com/foo'), + ('foo/third_party/bar', 'svn://example.com/bar'), + ('foo/third_party/baz', 'svn://example.com/baz'), + ], + self._get_processed()) + def testRecursedepsAltfile(self): """Verifies gclient respects the |recursedeps| var syntax with overridden target DEPS file.