blob: 440b08e9cca07a8f807dd48982dccad4771d2301 [file] [log] [blame]
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import time
from autotest_lib.client.common_lib import error
from autotest_lib.server.cros.faft.firmware_test import FirmwareTest
class firmware_ECSharedMem(FirmwareTest):
Servo based EC shared memory test.
version = 1
def initialize(self, host, cmdline_args):
super(firmware_ECSharedMem, self).initialize(host, cmdline_args)
# Don't bother if there is no Chrome EC.
if not self.check_ec_capability():
raise error.TestNAError("Nothing needs to be tested on this device")
# Only run in normal mode
self.switcher.setup_mode('normal')"chan 0")
def cleanup(self):
try:"chan 0xffffffff")
except Exception as e:
logging.error("Caught exception: %s", str(e))
super(firmware_ECSharedMem, self).cleanup()
def shared_mem_checker(self):
"""Return whether there is still EC shared memory available.
match ="shmem",
shmem_size = int(match[1])"EC shared memory size if %d bytes", shmem_size)
if shmem_size <= 0:
return False
elif shmem_size <= 256:
logging.warning("EC shared memory is less than 256 bytes")
return True
def jump_checker(self):
"""Check for available EC shared memory after jumping to RW image.
""""sysjump RW")
return self.shared_mem_checker()
def run_once(self):
"""Execute the main body of the test.
""""Check shared memory in normal operation and crash EC.")
'custom','crash unaligned'))"Check shared memory after crash and system jump.")
self.check_state([self.shared_mem_checker, self.jump_checker])
self.switcher.mode_aware_reboot('custom', self.sync_and_ec_reboot)