faft: Check to ensure an install shim inserted before fw update tests

Since the fw update tests do real TPM update and require an install shim
inserted during the tests. The install shim is used to reset TPM and makes
the system available again (no rollback error).

This CL adds check to ensure an install shim inserted and gets the
fw update tests back.

BUG=chromium-os:36303
TEST=Insert USB with a Chrome OS test image, ran tests and got an error.
TEST=Insert USB with an install shim image, ran tests and passed.

Change-Id: I0849864a4bdafc62282b35b30e7683334453eb2c
Reviewed-on: https://gerrit.chromium.org/gerrit/37975
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Yusuf Mohsinally <mohsinally@google.com>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/faftsequence.py b/server/cros/faftsequence.py
index 23ac54b..1c53ab2 100644
--- a/server/cros/faftsequence.py
+++ b/server/cros/faftsequence.py
@@ -347,35 +347,40 @@
             raise error.TestFail('Timed out waiting for DUT reboot')
 
 
-    def assert_test_image_in_path(self, image_path):
+    def assert_test_image_in_path(self, image_path, install_shim=False):
         """Assert the image of image_path be a Chrome OS test image.
 
         Args:
           image_path: A path on the host to the test image.
+          install_shim: True to verify an install shim instead of a test image.
 
         Raises:
-          error.TestError: if the image is not a test image.
+          error.TestError: if the image is not a test (install shim) image.
         """
         try:
             build_ver, build_hash = lab_test.VerifyImageAndGetId(
                     os.environ['CROS_WORKON_SRCROOT'],
-                    image_path)
+                    image_path,
+                    install_shim=install_shim)
             logging.info('Build of image: %s %s', build_ver, build_hash)
         except ChromeOSTestError:
             raise error.TestError(
-                    'An USB disk containning a test image should be plugged '
-                    'in the servo board.')
+                    'An USB disk containning a %s image should be plugged '
+                    'in the servo board.' %
+                    ('install shim' if install_shim else 'test'))
 
 
-    def assert_test_image_in_usb_disk(self, usb_dev=None):
+    def assert_test_image_in_usb_disk(self, usb_dev=None, install_shim=False):
         """Assert an USB disk plugged-in on servo and a test image inside.
 
         Args:
           usb_dev: A string of USB stick path on the host, like '/dev/sdc'.
                    If None, it is detected automatically.
+          install_shim: True to verify an install shim instead of a test image.
 
         Raises:
-          error.TestError: if USB disk not detected or not a test image.
+          error.TestError: if USB disk not detected or not a test (install shim)
+                           image.
         """
         if self.check_setup_done('usb_check'):
             return
@@ -396,11 +401,11 @@
             if not usb_dev:
                 raise error.TestError(
                         'An USB disk should be plugged in the servo board.')
-        self.assert_test_image_in_path(usb_dev)
+        self.assert_test_image_in_path(usb_dev, install_shim=install_shim)
         self.mark_setup_done('usb_check')
 
 
-    def setup_usbkey(self, usbkey, host=None):
+    def setup_usbkey(self, usbkey, host=None, install_shim=False):
         """Setup the USB disk for the test.
 
         It checks the setup of USB disk and a valid ChromeOS test image inside.
@@ -411,9 +416,10 @@
                   required.
           host: Optional, True to mux the USB disk to host, False to mux it
                 to DUT, default to do nothing.
+          install_shim: True to verify an install shim instead of a test image.
         """
         if usbkey:
-            self.assert_test_image_in_usb_disk()
+            self.assert_test_image_in_usb_disk(install_shim=install_shim)
         elif host is None:
             # USB disk is not required for the test. Better to mux it to host.
             host = True