Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Side by Side Diff: tests/gclient_test.py

Issue 11146032: Add recursion=n syntax to DEPS files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for gclient.py. 6 """Unit tests for gclient.py.
7 7
8 See gclient_smoketest.py for integration tests. 8 See gclient_smoketest.py for integration tests.
9 """ 9 """
10 10
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 ' "unix": { "foo/dir2": "/dir2", },\n' 299 ' "unix": { "foo/dir2": "/dir2", },\n'
300 ' "baz": { "foo/dir3": "/dir3", },\n' 300 ' "baz": { "foo/dir3": "/dir3", },\n'
301 '}') 301 '}')
302 302
303 parser = gclient.Parser() 303 parser = gclient.Parser()
304 options, _ = parser.parse_args(['--jobs', '1']) 304 options, _ = parser.parse_args(['--jobs', '1'])
305 options.deps_os = "unix" 305 options.deps_os = "unix"
306 306
307 obj = gclient.GClient.LoadCurrentConfig(options) 307 obj = gclient.GClient.LoadCurrentConfig(options)
308 self.assertEqual(['baz', 'unix'], sorted(obj.enforced_os)) 308 self.assertEqual(['baz', 'unix'], sorted(obj.enforced_os))
309 309
310 def testRecursionOverride(self):
311 """Verifies gclient respects the recursion var syntax.
312
313 We check several things here:
314 - recursion = 3 sets recursion on the foo dep to exactly 3
315 (we pull /fizz, but not /fuzz)
316 - pulling foo/bar at recursion level 1 (in .gclient) is overriden by
317 a later pull of foo/bar at recursion level 2 (in the dep tree)
318 """
319 write(
320 '.gclient',
321 'solutions = [\n'
322 ' { "name": "foo", "url": "svn://example.com/foo" },\n'
323 ' { "name": "foo/bar", "url": "svn://example.com/bar" },\n'
324 ']')
325 write(
326 os.path.join('foo', 'DEPS'),
327 'deps = {\n'
328 ' "bar": "/bar",\n'
329 '}\n'
330 'recursion = 3')
331 write(
332 os.path.join('bar', 'DEPS'),
333 'deps = {\n'
334 ' "baz": "/baz",\n'
335 '}')
336 write(
337 os.path.join('baz', 'DEPS'),
338 'deps = {\n'
339 ' "fizz": "/fizz",\n'
340 '}')
341 write(
342 os.path.join('fizz', 'DEPS'),
343 'deps = {\n'
344 ' "fuzz": "/fuzz",\n'
345 '}')
346
347 options, _ = gclient.Parser().parse_args([])
348 obj = gclient.GClient.LoadCurrentConfig(options)
349 obj.RunOnDeps('None', [])
350 self.assertEquals(
351 [
352 'svn://example.com/foo',
353 'svn://example.com/bar',
354 'svn://example.com/foo/bar',
355 'svn://example.com/foo/bar/baz',
356 'svn://example.com/foo/bar/baz/fizz',
357 ],
358 self._get_processed())
359
310 360
311 if __name__ == '__main__': 361 if __name__ == '__main__':
312 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) 362 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
313 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) 363 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True)
314 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) 364 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr)
315 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) 365 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True)
316 logging.basicConfig( 366 logging.basicConfig(
317 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ 367 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][
318 min(sys.argv.count('-v'), 3)], 368 min(sys.argv.count('-v'), 3)],
319 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' 369 format='%(relativeCreated)4d %(levelname)5s %(module)13s('
320 '%(lineno)d) %(message)s') 370 '%(lineno)d) %(message)s')
321 unittest.main() 371 unittest.main()
OLDNEW
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698