scripts: Always restart ash on deploying lacros by default
This CL lets Ash restart on deploying lacros by default.
lacros-only mode requires ash to restart, otherwise rsync fails with
ETXTBSY error.
Since we are deprecating lacros side-by-side and lacros primary and
moving on to lacros-only, we should set restart_ui by default.
For users who don't want to restart_ui, added an option
`--skip-restart-ui` which will always skip restarting Ash.
BUG=chromium:1450153
TEST=./run_tests deploy_chrome_unittest.py
Change-Id: I663e179f0d36af8c52de70dbf0ac01cf66fe32d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4574550
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
Commit-Queue: Eriko Kurimoto <elkurin@chromium.org>
Tested-by: Eriko Kurimoto <elkurin@chromium.org>
diff --git a/scripts/deploy_chrome_unittest.py b/scripts/deploy_chrome_unittest.py
index c376ebc..206bdf7 100644
--- a/scripts/deploy_chrome_unittest.py
+++ b/scripts/deploy_chrome_unittest.py
@@ -131,6 +131,23 @@
self.assertFalse(options.dostrip)
self.assertEqual(options.target_dir, deploy_chrome.LACROS_DIR)
+ def testLacrosWithLacrosOnly(self):
+ """Test lacros invocation with skip restarting ui."""
+ argv = [
+ "--lacros",
+ "--build-dir",
+ "/path/to/nowhere",
+ "--device",
+ "monkey",
+ "--board",
+ "atlas",
+ "--skip-restart-ui",
+ ]
+ options = _ParseCommandLine(argv)
+ self.assertTrue(options.lacros)
+ self.assertEqual(options.target_dir, deploy_chrome.LACROS_DIR)
+ self.assertTrue(options.skip_restart_ui)
+
def assertParseError(self, argv):
with self.OutputCapturer():
self.assertRaises2(
@@ -828,30 +845,16 @@
self.deploy._CheckDeviceFreeSpace = mock.Mock()
self.deploy._KillAshChromeIfNeeded = mock.Mock()
- def testConfNotModified(self):
- """When the conf file is not modified we don't restart chrome ."""
+ def testLacros(self):
+ """When no flag is set, Ash should be restarted."""
self.prepareDeploy()
- self.deploy.Perform()
- self.deploy._KillAshChromeIfNeeded.assert_not_called()
- self.assertFalse(self._ran_start_command)
-
- def testConfModified(self):
- """When the conf file is modified we restart chrome."""
- self.prepareDeploy()
-
- # We intentionally add '\n' to MODIFIED_CONF_FILE to simulate echo
- # adding a newline when invoked in the shell.
- self.rc.AddCmdResult(
- partial_mock.In(deploy_chrome.ENABLE_LACROS_VIA_CONF_COMMAND),
- stdout=deploy_chrome.MODIFIED_CONF_FILE + "\n",
- )
self.deploy.Perform()
self.deploy._KillAshChromeIfNeeded.assert_called()
self.assertTrue(self._ran_start_command)
- def testSkipModifyingConf(self):
- """SKip modifying the config file when the argument is specified."""
+ def testSkipRestartUi(self):
+ """When skip_restart_ui is enabled, Ash should not be restarted."""
self.prepareDeploy(
_ParseCommandLine(
[
@@ -861,16 +864,11 @@
"/path/to/nowhere",
"--device",
"monkey",
- "--skip-modifying-config-file",
+ "--skip-restart-ui",
]
)
)
- self.rc.AddCmdResult(
- partial_mock.In(deploy_chrome.ENABLE_LACROS_VIA_CONF_COMMAND),
- stdout=deploy_chrome.MODIFIED_CONF_FILE + "\n",
- )
-
self.deploy.Perform()
self.deploy._KillAshChromeIfNeeded.assert_not_called()
self.assertFalse(self._ran_start_command)