firmware_ECReset: catch ec hibernate issues

BUG=none
BRANCH=none
TEST=none

Change-Id: I29e74598e7d53ae96be89b6903f11e6c23cb1bd7
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/1366342
Reviewed-by: Kevin Shelton <kmshelton@chromium.org>
Commit-Queue: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
diff --git a/server/site_tests/firmware_Cr50ECReset/firmware_Cr50ECReset.py b/server/site_tests/firmware_Cr50ECReset/firmware_Cr50ECReset.py
index 45123f5..c6550ec 100644
--- a/server/site_tests/firmware_Cr50ECReset/firmware_Cr50ECReset.py
+++ b/server/site_tests/firmware_Cr50ECReset/firmware_Cr50ECReset.py
@@ -119,10 +119,24 @@
             raise error.TestFail('Could not release the EC from reset')
         self.guarantee_ec_is_up()
 
+    def check_ec_hibernate(self):
+        """Verify EC hibernate"""
+        try:
+            self.ec_hibernate()
+        except error.TestError, e:
+            if 'Could not put the EC into hibernate' in str(e):
+                raise error.TestNAError("EC hibernate doesn't work.")
+        finally:
+            self.guarantee_ec_is_up()
+
 
     def run_once(self):
         """Make sure 'cr50 ecrst' works as intended."""
         failed_wake = []
+        # The test needs to be able to hibernate the EC. Make sure it works as
+        # intended before running the test.
+        self.check_ec_hibernate()
+
         # Open cr50 so the test has access to ecrst
         self.fast_open(True)