cr50_test: download each image separately

The device images, the eraseflashinfo image, and the debug image are
used to restore separate things. This change downloads each image
separately, so one failure won't prevent the following state from
getting saved.

BUG=none
TEST=Flash random image on cr50. Make sure provision_Cr50Update passes
even though it can't download the original image.

Change-Id: Ica176c9d89f92734ce1e5d59d14de308e881659a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2026374
Reviewed-by: Dana Goyette <dgoyette@chromium.org>
Commit-Queue: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
diff --git a/server/cros/faft/cr50_test.py b/server/cros/faft/cr50_test.py
index 1b3428c..c36930f 100644
--- a/server/cros/faft/cr50_test.py
+++ b/server/cros/faft/cr50_test.py
@@ -111,21 +111,27 @@
 
         # We successfully saved the device state
         self._saved_state |= self.INITIAL_IMAGE_STATE
+        # Try and download all images necessary to restore cr50 state.
         try:
             self._save_dbg_image(full_args.get('cr50_dbg_image_path', ''))
             self._saved_state |= self.DBG_IMAGE
+        except Exception as e:
+            logging.warning('Error saving DBG image: %s', str(e))
+            if restore_cr50_image:
+                raise error.TestNAError('Need DBG image: %s' % str(e))
+        try:
             self._save_original_images(full_args.get('release_path', ''))
             self._saved_state |= self.DEVICE_IMAGES
+        except Exception as e:
+            logging.warning('Error saving ChromeOS image cr50 firmware: %s',
+                            str(e))
+        try:
             self._save_eraseflashinfo_image(
                     full_args.get('cr50_eraseflashinfo_image_path', ''))
             self._saved_state |= self.ERASEFLASHINFO_IMAGE
         except Exception as e:
-            logging.warning('Error saving images: %s', str(e))
-            if (restore_cr50_image and
-                not self._saved_cr50_state(self.DBG_IMAGE)):
-                raise error.TestNAError('Need DBG image: %s' % str(e))
-            elif (restore_cr50_board_id and
-                  self._saved_cr50_state(self.ERASEFLASHINFO_IMAGE)):
+            logging.warning('Error saving eraseflashinfo image: %s', str(e))
+            if restore_cr50_board_id:
                 raise error.TestNAError('Need eraseflashinfo image: %s' %
                                         str(e))