Support specifying a given shellball when running firmware update FAFTs
Provide an argument "shellball" in the firmware update FAFTs. If the arguemnt
is left blank, it used /usr/sbin/chromeos-firmwareupdate as shellball.
This version only modifies one test case.
BUG=chrome-os-partner:14361
TEST=run_remote_tests.sh -a "shellball=[given_shellball]" [test]
Change-Id: If517bd69dade0ce00fecc1e1e87fed56076449c4
Reviewed-on: https://gerrit.chromium.org/gerrit/34266
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Commit-Ready: Chun-Ting Chang <ctchang@chromium.org>
Tested-by: Chun-Ting Chang <ctchang@chromium.org>
diff --git a/server/cros/faftsequence.py b/server/cros/faftsequence.py
index 57637e1..c08c5ad 100644
--- a/server/cros/faftsequence.py
+++ b/server/cros/faftsequence.py
@@ -1442,3 +1442,35 @@
self.wait_for_client()
logging.info('Successfully restore firmware.')
+
+
+ def setup_firmwareupdate_shellball(self, shellball=None):
+ """Deside a shellball to use in firmware update test.
+
+ Check if there is a given shellball, and it is a shell script. Then,
+ send it to the remote host. Otherwise, use
+ /usr/sbin/chromeos-firmwareupdate.
+
+ Args:
+ shellball: path of a shellball or default to None.
+
+ Returns:
+ Path of shellball in remote host.
+ If use default shellball, reutrn None.
+ """
+ updater_path = None
+ if shellball:
+ # Determine the firmware file is a shellball or a raw binary.
+ is_shellball = (utils.system_output("file %s" % shellball).find(
+ "shell script") != -1)
+ if is_shellball:
+ logging.info('Device will update firmware with shellball %s'
+ % shellball)
+ temp_dir = self.faft_client.create_temp_dir('shellball_')
+ temp_shellball = os.path.join(temp_dir, 'updater.sh')
+ self._client.send_file(shellball, temp_shellball)
+ updater_path = temp_shellball
+ else:
+ raise error.TestFail(
+ 'The given shellball is not a shell script.')
+ return updater_path