blob: 74bf597ad7052673d3ebbc3983ebbf5c59527070 [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 pexpect
from autotest_lib.client.common_lib import error
from autotest_lib.server.cros.faftsequence import FAFTSequence
class firmware_ECAdc(FAFTSequence):
"""
Servo based EC ADC test.
"""
version = 1
# Repeat read count
READ_COUNT = 200
def _check_read(self):
"""Read EC internal temperature by EC ADC.
Raises:
error.TestFail: Raised when read fails.
"""
try:
t = int(self.send_uart_command_get_output("ectemp",
["EC temperature is (\d+) K"])[0].group(1))
if t < 273 or t > 373:
raise error.TestFail("Abnormal EC temperature %d K" % t)
except pexpect.TIMEOUT:
raise error.TestFail("Error reading EC internal temperature")
def run_once(self, host=None):
if not self.check_ec_capability(['adc_ectemp']):
return
logging.info("Reading EC internal temperature for %d times." %
self.READ_COUNT)
for i in xrange(self.READ_COUNT):
self._check_read()