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

Unified Diff: tests/gclient_test.py

Issue 11363036: Allow specificying that only target_os should be used in a gclient file (Closed) Base URL: https://git.chromium.org/chromium/tools/depot_tools.git@master
Patch Set: Make invalid combinations fatal Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gclient_test.py
diff --git a/tests/gclient_test.py b/tests/gclient_test.py
index 20c9ca627aa3373af938a73c2c9264b350cb0069..449a49169c56861a442de43dc7816f59ea2839de 100755
--- a/tests/gclient_test.py
+++ b/tests/gclient_test.py
@@ -307,6 +307,73 @@ class GclientTest(trial_dir.TestCase):
obj = gclient.GClient.LoadCurrentConfig(options)
self.assertEqual(['baz', 'unix'], sorted(obj.enforced_os))
+ def testTargetOsWithTargetOsOnly(self):
+ """Verifies that specifying a target_os and target_os_only pulls in only
+ the relevant dependencies.
+
+ The target_os variable allows specifying the name of an additional OS which
+ should be considered when selecting dependencies from a DEPS' deps_os. With
+ target_os_only also set, the _enforced_os tuple will be set to only the
+ target_os value.
+ """
+
+ write(
+ '.gclient',
+ 'solutions = [\n'
+ ' { "name": "foo",\n'
+ ' "url": "svn://example.com/foo",\n'
+ ' }]\n'
+ 'target_os = ["baz"]\n'
+ 'target_os_only = True')
+ write(
+ os.path.join('foo', 'DEPS'),
+ 'deps = {\n'
+ ' "foo/dir1": "/dir1",'
+ '}\n'
+ 'deps_os = {\n'
+ ' "unix": { "foo/dir2": "/dir2", },\n'
+ ' "baz": { "foo/dir3": "/dir3", },\n'
+ '}')
+
+ parser = gclient.Parser()
+ options, _ = parser.parse_args(['--jobs', '1'])
+ options.deps_os = "unix"
+
+ obj = gclient.GClient.LoadCurrentConfig(options)
+ self.assertEqual(['baz'], sorted(obj.enforced_os))
+
+ def testTargetOsOnlyWithoutTargetOs(self):
+ """Verifies that specifying a target_os_only without target_os_only raises
+ an exception.
+ """
+
+ write(
+ '.gclient',
+ 'solutions = [\n'
+ ' { "name": "foo",\n'
+ ' "url": "svn://example.com/foo",\n'
+ ' }]\n'
+ 'target_os_only = True')
+ write(
+ os.path.join('foo', 'DEPS'),
+ 'deps = {\n'
+ ' "foo/dir1": "/dir1",'
+ '}\n'
+ 'deps_os = {\n'
+ ' "unix": { "foo/dir2": "/dir2", },\n'
+ '}')
+
+ parser = gclient.Parser()
+ options, _ = parser.parse_args(['--jobs', '1'])
+ options.deps_os = "unix"
+
+ exception_raised = False
+ try:
+ gclient.GClient.LoadCurrentConfig(options)
+ except gclient_utils.Error:
+ exception_raised = True
+ self.assertTrue(exception_raised)
+
def testTargetOsInDepsFile(self):
"""Verifies that specifying a target_os value in a DEPS file pulls in all
relevant dependencies.
« 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