blob: f9976ed14857405668f54073c83cd047878f41e7 [file] [log] [blame]
Ryan Cuiafd6c5c2012-07-30 17:48:22 -07001#!/usr/bin/python
2# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Steve Funge984a532013-11-25 17:09:25 -08006"""Unit tests for the deploy_chrome script."""
Ryan Cuiafd6c5c2012-07-30 17:48:22 -07007
Mike Frysinger383367e2014-09-16 15:06:17 -04008from __future__ import print_function
9
Ryan Cuiafd6c5c2012-07-30 17:48:22 -070010import os
11import sys
David James88e6f032013-03-02 08:13:20 -080012import time
Ryan Cuiafd6c5c2012-07-30 17:48:22 -070013
14sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)),
15 '..', '..'))
Ryan Cuief91e702013-02-04 12:06:36 -080016
Ryan Cui686ec052013-02-12 16:39:41 -080017from chromite.cros.commands import cros_chrome_sdk_unittest
Ryan Cuief91e702013-02-04 12:06:36 -080018from chromite.lib import chrome_util
Ryan Cuiafd6c5c2012-07-30 17:48:22 -070019from chromite.lib import cros_build_lib
20from chromite.lib import cros_test_lib
Ryan Cui686ec052013-02-12 16:39:41 -080021from chromite.lib import osutils
Ryan Cuiafd6c5c2012-07-30 17:48:22 -070022from chromite.lib import partial_mock
Robert Flack1dc7ea82014-11-26 13:50:24 -050023from chromite.lib import remote_access
Ryan Cuiafd6c5c2012-07-30 17:48:22 -070024from chromite.lib import remote_access_unittest
Ryan Cuicbd9bb62013-04-30 11:17:02 -070025from chromite.lib import stats
26from chromite.lib import stats_unittest
27
Ryan Cuiafd6c5c2012-07-30 17:48:22 -070028from chromite.scripts import deploy_chrome
29
Ryan Cuief91e702013-02-04 12:06:36 -080030
Brian Harringe7524372012-12-23 02:02:56 -080031# TODO(build): Finish test wrapper (http://crosbug.com/37517).
32# Until then, this has to be after the chromite imports.
33import mock
34
Ryan Cuiafd6c5c2012-07-30 17:48:22 -070035
36# pylint: disable=W0212
37
38_REGULAR_TO = ('--to', 'monkey')
39_GS_PATH = 'gs://foon'
40
41
42def _ParseCommandLine(argv):
43 return deploy_chrome._ParseCommandLine(['--log-level', 'debug'] + argv)
44
45
46class InterfaceTest(cros_test_lib.OutputTestCase):
47 """Tests the commandline interface of the script."""
48
Ryan Cui686ec052013-02-12 16:39:41 -080049 BOARD = 'lumpy'
50
Ryan Cuiafd6c5c2012-07-30 17:48:22 -070051 def testGsLocalPathUnSpecified(self):
52 """Test no chrome path specified."""
53 with self.OutputCapturer():
54 self.assertRaises2(SystemExit, _ParseCommandLine, list(_REGULAR_TO),
55 check_attrs={'code': 2})
56
57 def testGsPathSpecified(self):
58 """Test case of GS path specified."""
59 argv = list(_REGULAR_TO) + ['--gs-path', _GS_PATH]
60 _ParseCommandLine(argv)
61
62 def testLocalPathSpecified(self):
63 """Test case of local path specified."""
Mike Frysingerd6e2df02014-11-26 02:55:04 -050064 argv = list(_REGULAR_TO) + ['--local-pkg-path', '/path/to/chrome']
Ryan Cuiafd6c5c2012-07-30 17:48:22 -070065 _ParseCommandLine(argv)
66
67 def testNoTarget(self):
68 """Test no target specified."""
69 argv = ['--gs-path', _GS_PATH]
Ryan Cuief91e702013-02-04 12:06:36 -080070 self.assertParseError(argv)
71
72 def assertParseError(self, argv):
Ryan Cuiafd6c5c2012-07-30 17:48:22 -070073 with self.OutputCapturer():
74 self.assertRaises2(SystemExit, _ParseCommandLine, argv,
75 check_attrs={'code': 2})
76
Ryan Cuief91e702013-02-04 12:06:36 -080077 def testStagingFlagsNoStrict(self):
78 """Errors out when --staging-flags is set without --strict."""
79 argv = ['--staging-only', '--build-dir=/path/to/nowhere',
Ryan Cui686ec052013-02-12 16:39:41 -080080 '--board=%s' % self.BOARD, '--staging-flags=highdpi']
Ryan Cuief91e702013-02-04 12:06:36 -080081 self.assertParseError(argv)
82
83 def testStrictNoBuildDir(self):
84 """Errors out when --strict is set without --build-dir."""
85 argv = ['--staging-only', '--strict', '--gs-path', _GS_PATH]
86 self.assertParseError(argv)
87
Ryan Cui686ec052013-02-12 16:39:41 -080088 def testNoBoardBuildDir(self):
89 argv = ['--staging-only', '--build-dir=/path/to/nowhere']
90 self.assertParseError(argv)
91
Thiago Goncales12793312013-05-23 11:26:17 -070092 def testMountOptionSetsTargetDir(self):
93 argv = list(_REGULAR_TO) + ['--gs-path', _GS_PATH, '--mount']
94 options, _ = _ParseCommandLine(argv)
95 self.assertIsNot(options.target_dir, None)
96
97 def testMountOptionSetsMountDir(self):
98 argv = list(_REGULAR_TO) + ['--gs-path', _GS_PATH, '--mount']
99 options, _ = _ParseCommandLine(argv)
100 self.assertIsNot(options.mount_dir, None)
101
102 def testMountOptionDoesNotOverrideTargetDir(self):
103 argv = list(_REGULAR_TO) + ['--gs-path', _GS_PATH, '--mount',
104 '--target-dir', '/foo/bar/cow']
105 options, _ = _ParseCommandLine(argv)
106 self.assertEqual(options.target_dir, '/foo/bar/cow')
107
108 def testMountOptionDoesNotOverrideMountDir(self):
109 argv = list(_REGULAR_TO) + ['--gs-path', _GS_PATH, '--mount',
110 '--mount-dir', '/foo/bar/cow']
111 options, _ = _ParseCommandLine(argv)
112 self.assertEqual(options.mount_dir, '/foo/bar/cow')
113
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700114
115class DeployChromeMock(partial_mock.PartialMock):
Steve Funge984a532013-11-25 17:09:25 -0800116 """Deploy Chrome Mock Class."""
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700117
118 TARGET = 'chromite.scripts.deploy_chrome.DeployChrome'
David James88e6f032013-03-02 08:13:20 -0800119 ATTRS = ('_KillProcsIfNeeded', '_DisableRootfsVerification')
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700120
David James88e6f032013-03-02 08:13:20 -0800121 def __init__(self):
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700122 partial_mock.PartialMock.__init__(self)
Robert Flack1dc7ea82014-11-26 13:50:24 -0500123 self.remote_device_mock = remote_access_unittest.RemoteDeviceMock()
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700124 # Target starts off as having rootfs verification enabled.
Ryan Cuie18f24f2012-12-03 18:39:55 -0800125 self.rsh_mock = remote_access_unittest.RemoteShMock()
David James88e6f032013-03-02 08:13:20 -0800126 self.rsh_mock.SetDefaultCmdResult(0)
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700127 self.MockMountCmd(1)
Pawel Osciak577773a2013-03-05 10:52:12 -0800128 self.rsh_mock.AddCmdResult(
129 deploy_chrome.LSOF_COMMAND % (deploy_chrome._CHROME_DIR,), 1)
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700130
131 def MockMountCmd(self, returnvalue):
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700132 self.rsh_mock.AddCmdResult(deploy_chrome.MOUNT_RW_COMMAND,
David James88e6f032013-03-02 08:13:20 -0800133 returnvalue)
134
135 def _DisableRootfsVerification(self, inst):
136 with mock.patch.object(time, 'sleep'):
137 self.backup['_DisableRootfsVerification'](inst)
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700138
Ryan Cui4d6fca92012-12-13 16:41:56 -0800139 def PreStart(self):
Robert Flack1dc7ea82014-11-26 13:50:24 -0500140 self.remote_device_mock.start()
Ryan Cui4d6fca92012-12-13 16:41:56 -0800141 self.rsh_mock.start()
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700142
Ryan Cui4d6fca92012-12-13 16:41:56 -0800143 def PreStop(self):
144 self.rsh_mock.stop()
Robert Flack1dc7ea82014-11-26 13:50:24 -0500145 self.remote_device_mock.stop()
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700146
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700147 def _KillProcsIfNeeded(self, _inst):
148 # Fully stub out for now.
149 pass
150
151
Ryan Cuicbd9bb62013-04-30 11:17:02 -0700152class MainTest(cros_test_lib.MockLoggingTestCase):
Steve Funge984a532013-11-25 17:09:25 -0800153 """Main tests."""
Ryan Cuicbd9bb62013-04-30 11:17:02 -0700154
155 def setUp(self):
156 self.PatchObject(deploy_chrome.DeployChrome, 'Perform', autospec=True)
157 self.stats_module_mock = stats_unittest.StatsModuleMock()
158 self.StartPatcher(self.stats_module_mock)
159
160 def testStatsUpload(self, call_count=1):
161 """The stats upload path."""
162 deploy_chrome.main(['--board=lumpy', '--staging-only',
163 '--build-dir=/tmp/abc'])
164 self.assertEquals(stats.StatsUploader._Upload.call_count, call_count)
165
166 def testStatsUploadError(self):
167 """Don't upload stats if we fail to create it."""
168 self.stats_module_mock.stats_mock.init_exception = True
169 with cros_test_lib.LoggingCapturer():
170 self.testStatsUpload(call_count=0)
171
172
Ryan Cuief91e702013-02-04 12:06:36 -0800173class DeployTest(cros_test_lib.MockTempDirTestCase):
Steve Funge984a532013-11-25 17:09:25 -0800174 """Setup a deploy object with a GS-path for use in tests."""
175
Ryan Cuief91e702013-02-04 12:06:36 -0800176 def _GetDeployChrome(self, args):
177 options, _ = _ParseCommandLine(args)
Ryan Cuia56a71e2012-10-18 18:40:35 -0700178 return deploy_chrome.DeployChrome(
179 options, self.tempdir, os.path.join(self.tempdir, 'staging'))
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700180
181 def setUp(self):
Ryan Cuif1416f32013-01-22 18:43:41 -0800182 self.deploy_mock = self.StartPatcher(DeployChromeMock())
Ryan Cuief91e702013-02-04 12:06:36 -0800183 self.deploy = self._GetDeployChrome(
David James88e6f032013-03-02 08:13:20 -0800184 list(_REGULAR_TO) + ['--gs-path', _GS_PATH, '--force'])
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700185
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700186
David James88e6f032013-03-02 08:13:20 -0800187class TestDisableRootfsVerification(DeployTest):
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700188 """Testing disabling of rootfs verification and RO mode."""
189
David James88e6f032013-03-02 08:13:20 -0800190 def testDisableRootfsVerificationSuccess(self):
191 """Test the working case, disabling rootfs verification."""
192 self.deploy_mock.MockMountCmd(0)
193 self.deploy._DisableRootfsVerification()
Robert Flack1dc7ea82014-11-26 13:50:24 -0500194 self.assertFalse(self.deploy._target_dir_is_still_readonly.is_set())
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700195
196 def testDisableRootfsVerificationFailure(self):
197 """Test failure to disable rootfs verification."""
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700198 self.assertRaises(cros_build_lib.RunCommandError,
David James88e6f032013-03-02 08:13:20 -0800199 self.deploy._DisableRootfsVerification)
Robert Flack1dc7ea82014-11-26 13:50:24 -0500200 self.assertFalse(self.deploy._target_dir_is_still_readonly.is_set())
David James88e6f032013-03-02 08:13:20 -0800201
202
203class TestMount(DeployTest):
204 """Testing mount success and failure."""
205
206 def testSuccess(self):
207 """Test case where we are able to mount as writable."""
Robert Flack1dc7ea82014-11-26 13:50:24 -0500208 self.assertFalse(self.deploy._target_dir_is_still_readonly.is_set())
David James88e6f032013-03-02 08:13:20 -0800209 self.deploy_mock.MockMountCmd(0)
210 self.deploy._MountRootfsAsWritable()
Robert Flack1dc7ea82014-11-26 13:50:24 -0500211 self.assertFalse(self.deploy._target_dir_is_still_readonly.is_set())
David James88e6f032013-03-02 08:13:20 -0800212
213 def testMountError(self):
214 """Test that mount failure doesn't raise an exception by default."""
Robert Flack1dc7ea82014-11-26 13:50:24 -0500215 self.assertFalse(self.deploy._target_dir_is_still_readonly.is_set())
216 self.PatchObject(remote_access.RemoteDevice, 'IsPathWritable',
217 return_value=False, autospec=True)
David James88e6f032013-03-02 08:13:20 -0800218 self.deploy._MountRootfsAsWritable()
Robert Flack1dc7ea82014-11-26 13:50:24 -0500219 self.assertTrue(self.deploy._target_dir_is_still_readonly.is_set())
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700220
221 def testMountRwFailure(self):
David James88e6f032013-03-02 08:13:20 -0800222 """Test that mount failure raises an exception if error_code_ok=False."""
223 self.assertRaises(cros_build_lib.RunCommandError,
224 self.deploy._MountRootfsAsWritable, error_code_ok=False)
Robert Flack1dc7ea82014-11-26 13:50:24 -0500225 self.assertFalse(self.deploy._target_dir_is_still_readonly.is_set())
226
227 def testMountTempDir(self):
228 """Test that mount succeeds if target dir is writable."""
229 self.assertFalse(self.deploy._target_dir_is_still_readonly.is_set())
230 self.PatchObject(remote_access.RemoteDevice, 'IsPathWritable',
231 return_value=True, autospec=True)
232 self.deploy._MountRootfsAsWritable()
233 self.assertFalse(self.deploy._target_dir_is_still_readonly.is_set())
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700234
235
Ryan Cuief91e702013-02-04 12:06:36 -0800236class TestUiJobStarted(DeployTest):
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700237 """Test detection of a running 'ui' job."""
238
Ryan Cuif2d1a582013-02-19 14:08:13 -0800239 def MockStatusUiCmd(self, **kwargs):
240 self.deploy_mock.rsh_mock.AddCmdResult('status ui', **kwargs)
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700241
242 def testUiJobStartedFalse(self):
243 """Correct results with a stopped job."""
Ryan Cuif2d1a582013-02-19 14:08:13 -0800244 self.MockStatusUiCmd(output='ui stop/waiting')
245 self.assertFalse(self.deploy._CheckUiJobStarted())
246
247 def testNoUiJob(self):
248 """Correct results when the job doesn't exist."""
249 self.MockStatusUiCmd(error='start: Unknown job: ui', returncode=1)
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700250 self.assertFalse(self.deploy._CheckUiJobStarted())
251
252 def testCheckRootfsWriteableTrue(self):
253 """Correct results with a running job."""
Ryan Cuif2d1a582013-02-19 14:08:13 -0800254 self.MockStatusUiCmd(output='ui start/running, process 297')
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700255 self.assertTrue(self.deploy._CheckUiJobStarted())
256
257
Ryan Cuief91e702013-02-04 12:06:36 -0800258class StagingTest(cros_test_lib.MockTempDirTestCase):
259 """Test user-mode and ebuild-mode staging functionality."""
260
261 def setUp(self):
Ryan Cuief91e702013-02-04 12:06:36 -0800262 self.staging_dir = os.path.join(self.tempdir, 'staging')
263 self.build_dir = os.path.join(self.tempdir, 'build_dir')
Ryan Cui686ec052013-02-12 16:39:41 -0800264 self.common_flags = ['--build-dir', self.build_dir,
265 '--board=lumpy', '--staging-only', '--cache-dir',
266 self.tempdir]
Ryan Cuia0215a72013-02-14 16:20:45 -0800267 self.sdk_mock = self.StartPatcher(cros_chrome_sdk_unittest.SDKFetcherMock())
Ryan Cui686ec052013-02-12 16:39:41 -0800268 self.PatchObject(
269 osutils, 'SourceEnvironment', autospec=True,
270 return_value={'STRIP': 'x86_64-cros-linux-gnu-strip'})
Ryan Cuief91e702013-02-04 12:06:36 -0800271
David Jamesa6e08892013-03-01 13:34:11 -0800272 def testSingleFileDeployFailure(self):
273 """Default staging enforces that mandatory files are copied"""
Ryan Cuief91e702013-02-04 12:06:36 -0800274 options, _ = _ParseCommandLine(self.common_flags)
David Jamesa6e08892013-03-01 13:34:11 -0800275 osutils.Touch(os.path.join(self.build_dir, 'chrome'), makedirs=True)
276 self.assertRaises(
277 chrome_util.MissingPathError, deploy_chrome._PrepareStagingDir,
Daniel Eratc89829c2014-05-12 17:24:21 -0700278 options, self.tempdir, self.staging_dir, chrome_util._COPY_PATHS_CHROME)
Ryan Cuief91e702013-02-04 12:06:36 -0800279
David Jamesa6e08892013-03-01 13:34:11 -0800280 def testSloppyDeployFailure(self):
281 """Sloppy staging enforces that at least one file is copied."""
282 options, _ = _ParseCommandLine(self.common_flags + ['--sloppy'])
283 self.assertRaises(
284 chrome_util.MissingPathError, deploy_chrome._PrepareStagingDir,
Daniel Eratc89829c2014-05-12 17:24:21 -0700285 options, self.tempdir, self.staging_dir, chrome_util._COPY_PATHS_CHROME)
David Jamesa6e08892013-03-01 13:34:11 -0800286
287 def testSloppyDeploySuccess(self):
288 """Sloppy staging - stage one file."""
289 options, _ = _ParseCommandLine(self.common_flags + ['--sloppy'])
290 osutils.Touch(os.path.join(self.build_dir, 'chrome'), makedirs=True)
Steve Funge984a532013-11-25 17:09:25 -0800291 deploy_chrome._PrepareStagingDir(options, self.tempdir, self.staging_dir,
Daniel Eratc89829c2014-05-12 17:24:21 -0700292 chrome_util._COPY_PATHS_CHROME)
David Jamesa6e08892013-03-01 13:34:11 -0800293
Ryan Cuief91e702013-02-04 12:06:36 -0800294 def testEmptyDeployStrict(self):
David Jamesa6e08892013-03-01 13:34:11 -0800295 """Strict staging fails when there are no files."""
Ryan Cuief91e702013-02-04 12:06:36 -0800296 options, _ = _ParseCommandLine(
297 self.common_flags + ['--gyp-defines', 'chromeos=1', '--strict'])
Ryan Cui686ec052013-02-12 16:39:41 -0800298
Ryan Cuief91e702013-02-04 12:06:36 -0800299 self.assertRaises(
300 chrome_util.MissingPathError, deploy_chrome._PrepareStagingDir,
Daniel Eratc89829c2014-05-12 17:24:21 -0700301 options, self.tempdir, self.staging_dir, chrome_util._COPY_PATHS_CHROME)
Steve Funge984a532013-11-25 17:09:25 -0800302
303
304class DeployTestBuildDir(cros_test_lib.MockTempDirTestCase):
Daniel Erat1ae46382014-08-14 10:23:39 -0700305 """Set up a deploy object with a build-dir for use in deployment type tests"""
Steve Funge984a532013-11-25 17:09:25 -0800306
307 def _GetDeployChrome(self, args):
308 options, _ = _ParseCommandLine(args)
309 return deploy_chrome.DeployChrome(
310 options, self.tempdir, os.path.join(self.tempdir, 'staging'))
311
312 def setUp(self):
313 self.staging_dir = os.path.join(self.tempdir, 'staging')
314 self.build_dir = os.path.join(self.tempdir, 'build_dir')
315 self.deploy_mock = self.StartPatcher(DeployChromeMock())
316 self.deploy = self._GetDeployChrome(
317 list(_REGULAR_TO) + ['--build-dir', self.build_dir,
318 '--board=lumpy', '--staging-only', '--cache-dir',
319 self.tempdir, '--sloppy'])
320
Daniel Erat1ae46382014-08-14 10:23:39 -0700321 def getCopyPath(self, source_path):
322 """Return a chrome_util.Path or None if not present."""
323 paths = [p for p in self.deploy.copy_paths if p.src == source_path]
324 return paths[0] if paths else None
Steve Funge984a532013-11-25 17:09:25 -0800325
Daniel Erat1ae46382014-08-14 10:23:39 -0700326class TestDeploymentType(DeployTestBuildDir):
Steve Funge984a532013-11-25 17:09:25 -0800327 """Test detection of deployment type using build dir."""
328
Daniel Erat9813f0e2014-11-12 11:00:28 -0700329 def testEnvoyDetection(self):
330 """Check for an envoy deployment"""
331 osutils.Touch(os.path.join(self.deploy.options.build_dir, 'envoy_shell'),
332 makedirs=True)
333 self.deploy._CheckDeployType()
334 self.assertTrue(self.getCopyPath('envoy_shell'))
335 self.assertFalse(self.getCopyPath('app_shell'))
336 self.assertFalse(self.getCopyPath('chrome'))
337
Daniel Erat1ae46382014-08-14 10:23:39 -0700338 def testAppShellDetection(self):
339 """Check for an app_shell deployment"""
340 osutils.Touch(os.path.join(self.deploy.options.build_dir, 'app_shell'),
Steve Funge984a532013-11-25 17:09:25 -0800341 makedirs=True)
342 self.deploy._CheckDeployType()
Daniel Erat1ae46382014-08-14 10:23:39 -0700343 self.assertTrue(self.getCopyPath('app_shell'))
344 self.assertFalse(self.getCopyPath('chrome'))
Daniel Erat9813f0e2014-11-12 11:00:28 -0700345 self.assertFalse(self.getCopyPath('envoy_shell'))
Steve Funge984a532013-11-25 17:09:25 -0800346
Daniel Erat1ae46382014-08-14 10:23:39 -0700347 def testChromeAndAppShellDetection(self):
Daniel Erat9813f0e2014-11-12 11:00:28 -0700348 """Check for a chrome deployment when app_shell/envoy_shell also exist."""
Steve Fung63d705d2014-03-16 03:14:03 -0700349 osutils.Touch(os.path.join(self.deploy.options.build_dir, 'chrome'),
350 makedirs=True)
Daniel Erat1ae46382014-08-14 10:23:39 -0700351 osutils.Touch(os.path.join(self.deploy.options.build_dir, 'app_shell'),
Steve Fung63d705d2014-03-16 03:14:03 -0700352 makedirs=True)
Daniel Erat9813f0e2014-11-12 11:00:28 -0700353 osutils.Touch(os.path.join(self.deploy.options.build_dir, 'envoy_shell'),
354 makedirs=True)
Steve Fung63d705d2014-03-16 03:14:03 -0700355 self.deploy._CheckDeployType()
Daniel Erat1ae46382014-08-14 10:23:39 -0700356 self.assertTrue(self.getCopyPath('chrome'))
Daniel Erat9813f0e2014-11-12 11:00:28 -0700357 self.assertFalse(self.getCopyPath('app_shell'))
358 self.assertFalse(self.getCopyPath('envoy_shell'))
Steve Fung63d705d2014-03-16 03:14:03 -0700359
Steve Funge984a532013-11-25 17:09:25 -0800360 def testChromeDetection(self):
361 """Check for a regular chrome deployment"""
362 osutils.Touch(os.path.join(self.deploy.options.build_dir, 'chrome'),
363 makedirs=True)
364 self.deploy._CheckDeployType()
Daniel Erat1ae46382014-08-14 10:23:39 -0700365 self.assertTrue(self.getCopyPath('chrome'))
Daniel Erat9813f0e2014-11-12 11:00:28 -0700366 self.assertFalse(self.getCopyPath('app_shell'))
367 self.assertFalse(self.getCopyPath('envoy_shell'))
Ryan Cuief91e702013-02-04 12:06:36 -0800368
Ryan Cuiafd6c5c2012-07-30 17:48:22 -0700369if __name__ == '__main__':
370 cros_test_lib.main()