firmware_Cr50DeviceState: Check for S3 support

Check if DUT supports S3. Skip S3 testing if S3 is not supported by DUT.

BUG=b:200302478
TEST=Guybrush with fw 14292 skips S3 testing

Change-Id: I7e95cdbe2cc90e92b3a371dbd4a69cd4631ae1c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/3232075
Tested-by: Rob Barnes <robbarnes@google.com>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Commit-Queue: Rob Barnes <robbarnes@google.com>
diff --git a/server/site_tests/firmware_Cr50DeviceState/firmware_Cr50DeviceState.py b/server/site_tests/firmware_Cr50DeviceState/firmware_Cr50DeviceState.py
index 1f49420..c383dd6 100644
--- a/server/site_tests/firmware_Cr50DeviceState/firmware_Cr50DeviceState.py
+++ b/server/site_tests/firmware_Cr50DeviceState/firmware_Cr50DeviceState.py
@@ -513,15 +513,11 @@
         client_at = autotest.Autotest(self.host)
         client_at.run_test('login_LoginSuccess')
 
-        # Check if the device supports S0ix. The exit status will be 0 if it
-        # does 1 if it doesn't.
-        result = self.host.run('check_powerd_config --suspend_to_idle',
-                ignore_status=True)
-        if not result.exit_status:
+        if self.s0ix_supported:
             self.verify_state('S0ix')
 
-        # Enter S3
-        self.verify_state('S3')
+        if self.s3_supported:
+            self.verify_state('S3')
 
         # Enter G3
         self.verify_state('G3')
@@ -540,6 +536,15 @@
             self.cr50.ccd_disable(raise_error=True)
 
         self.ccd_enabled = self.cr50.ccd_is_enabled()
+        # Check if the device supports S0ix.
+        self.s0ix_supported = not self.host.run(
+                'check_powerd_config --suspend_to_idle',
+                ignore_status=True).exit_status
+        # Check if the device supports S3.
+        self.s3_supported = not self.host.run(
+                'grep -q deep /sys/power/mem_sleep',
+                ignore_status=True).exit_status
+
         self.run_through_power_states()
 
         if supports_dts_control: