Add option to deploy Chrome to stateful partition
Flag --mount-dir <mount_dir> allows Chrome to be deployed in target_dir,
specified by --target-dir, and then bind mounted on mount_dir.
Flag --mount puts deploy_chrome in mount state. If no target directory
is specified, it sets to /mnt/stateful_partition/opt/google/chrome;
if no mount directory is specified, it sets it to /opt/google/chrome.
Deploying chrome without --target-dir or the mount flags will still deploy it,
by default, to /opt/google/chrome.
NOTE: As of now, the default mount directory is not created by the script.
TEST=None
BUG=None
Change-Id: I2ed05967cd9e045e0aad8cfcaa537f284282d74c
Signed-off-by: Thiago Goncales <thiagog@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56490
Reviewed-by: Ryan Cui <rcui@chromium.org>
diff --git a/scripts/deploy_chrome_unittest.py b/scripts/deploy_chrome_unittest.py
index 8901e95..b7035bc 100755
--- a/scripts/deploy_chrome_unittest.py
+++ b/scripts/deploy_chrome_unittest.py
@@ -85,6 +85,28 @@
argv = ['--staging-only', '--build-dir=/path/to/nowhere']
self.assertParseError(argv)
+ def testMountOptionSetsTargetDir(self):
+ argv = list(_REGULAR_TO) + ['--gs-path', _GS_PATH, '--mount']
+ options, _ = _ParseCommandLine(argv)
+ self.assertIsNot(options.target_dir, None)
+
+ def testMountOptionSetsMountDir(self):
+ argv = list(_REGULAR_TO) + ['--gs-path', _GS_PATH, '--mount']
+ options, _ = _ParseCommandLine(argv)
+ self.assertIsNot(options.mount_dir, None)
+
+ def testMountOptionDoesNotOverrideTargetDir(self):
+ argv = list(_REGULAR_TO) + ['--gs-path', _GS_PATH, '--mount',
+ '--target-dir', '/foo/bar/cow']
+ options, _ = _ParseCommandLine(argv)
+ self.assertEqual(options.target_dir, '/foo/bar/cow')
+
+ def testMountOptionDoesNotOverrideMountDir(self):
+ argv = list(_REGULAR_TO) + ['--gs-path', _GS_PATH, '--mount',
+ '--mount-dir', '/foo/bar/cow']
+ options, _ = _ParseCommandLine(argv)
+ self.assertEqual(options.mount_dir, '/foo/bar/cow')
+
class DeployChromeMock(partial_mock.PartialMock):