Check TPM and use a factory install shim to restore for firmware update tests

After autoupdate, the firmware version will be updated in TPM. To recover, the
client needs a reboot with a facotry install shim.

BUG=chromium-os:35258
TEST=run_remote_tests.sh

Change-Id: I11afa96586b80bc8177d31042fc3bb27c9d4266f
Reviewed-on: https://gerrit.chromium.org/gerrit/35822
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/client/cros/faft_client.py b/client/cros/faft_client.py
index 76b4b22..923712f 100644
--- a/client/cros/faft_client.py
+++ b/client/cros/faft_client.py
@@ -423,6 +423,11 @@
         return self._bios_handler.get_section_version(section)
 
 
+    def get_tpm_firmware_version(self):
+        """Retrieve tpm firmware body version."""
+        return self._tpm_handler.get_fw_version()
+
+
     def _modify_firmware_version(self, section, delta):
         """Modify firmware version for the requested section, by adding delta.
 
@@ -449,14 +454,14 @@
         """Increase firmware version for the requested section."""
         self._modify_firmware_version(section, 1)
 
-    def retrieve_firmware_version(self, section):
-        """Return firmware version."""
-        return self._bios_handler.get_section_version(section)
-
-    def retrieve_firmware_datakey_version(self, section):
+    def get_firmware_datakey_version(self, section):
         """Return firmware data key version."""
         return self._bios_handler.get_section_datakey_version(section)
 
+    def get_tpm_firmware_datakey_version(self):
+        """Retrieve tpm firmware data key version."""
+        return self._tpm_handler.get_fw_body_version()
+
     def retrieve_kernel_subkey_version(self,section):
         """Return kernel subkey version."""
         return self._bios_handler.get_section_kernel_subkey_version(section)
@@ -813,8 +818,9 @@
                     chromeos-firmwareupdate-[append]
         """
         self.run_shell_command(
-            '/bin/sh %s --mode autoupdate --noupdate_ec'
-            % os.path.join(self._temp_path,
+            '/bin/sh %s --mode autoupdate '
+            '--noupdate_ec --nocheck_rw_compatible'
+                % os.path.join(self._temp_path,
                            'chromeos-firmwareupdate-%s' % append))
 
 
@@ -838,8 +844,8 @@
     def run_firmware_recovery(self):
         """Recovery to original shellball."""
         self.run_shell_command(
-            '/bin/sh %s --mode recovery --noupdate_ec' % os.path.join(
-                self._temp_path, 'chromeos-firmwareupdate'))
+            '/bin/sh %s --mode recovery --noupdate_ec --nocheck_rw_compatible'
+                % os.path.join(self._temp_path, 'chromeos-firmwareupdate'))
 
 
     def get_temp_path(self):