faft: Skip repeated USB test image check

USB disk content only needs to be verified once per run. Let's skip
repeated check.

BUG=chrome-os-partner:34392
TEST=Run a test suite. Check second call to assert_test_image_in_usb
returns instantly.

Change-Id: I89a9395d55ab3878d71978c9c98be19a3eea29c4
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36048
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/faftsequence.py b/server/cros/faftsequence.py
index abf1c02..c15e707 100644
--- a/server/cros/faftsequence.py
+++ b/server/cros/faftsequence.py
@@ -135,8 +135,12 @@
 
     # True if this is the first test in the same run
     _first_test = True
+
     _setup_invalidated = False
 
+    # True if the image inside USB stick is confirmed a test image
+    _usb_test_image_checked = False
+
 
     def initialize(self, host, cmdline_args, use_pyauto=False, use_faft=False):
         # Parse arguments from command line
@@ -323,6 +327,9 @@
         Raises:
           error.TestError: if USB disk not detected or not a test image.
         """
+        if FAFTSequence._usb_test_image_checked:
+            return
+
         # TODO(waihong@chromium.org): We skip the check when servod runs in
         # a different host since no easy way to access the servo host so far.
         # Should find a way to work-around it.
@@ -340,6 +347,7 @@
                 raise error.TestError(
                         'An USB disk should be plugged in the servo board.')
         self.assert_test_image_in_path(usb_dev)
+        FAFTSequence._usb_test_image_checked = True
 
 
     def get_server_address(self):