blob: 2d64257b09340fe3f8a9f09c56e970055d1c8c82 [file] [log] [blame]
# Copyright (c) 2013 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
from autotest_lib.client.bin import test, utils
from autotest_lib.client.common_lib import error
from autotest_lib.client.cros.power import sys_power
class power_MemorySuspend(test.test):
"""Suspend the system via memory_suspend_test."""
version = 1
def initialize(self):
utils.system('stop ui', ignore_status=True)
def run_once(self, num_suspends=1, max_spurious_wakeup_ratio=0.01):
spurious_wakeup_count = 0
max_spurious_wakeup = num_suspends * max_spurious_wakeup_ratio
for _ in range(num_suspends):
except sys_power.SpuriousWakeupError:
spurious_wakeup_count += 1
if spurious_wakeup_count > max_spurious_wakeup:
raise error.TestFail('Too many SpuriousWakeupError.')
if spurious_wakeup_count > 0:"Have %d SpuriousWakeupError", spurious_wakeup_count)
keyval = { 'numSpuriousWakeupError' : spurious_wakeup_count }
def cleanup(self):
utils.system('start ui')