# Copyright 2017 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.

from autotest_lib.server import utils

AUTHOR = "mruthven"
NAME = "firmware_Cr50DeepSleepStress"
PURPOSE = "Verify deep sleep"
TIME = "Long"
TEST_TYPE = "server"

DOC = """
Cr50 should enter deep sleep every time the system goes into S3. Run
power_SuspendStress and verify the deep sleep count matches the number of
suspend iterations.
"""

args_dict = utils.args_to_dict(args)
servo_args = hosts.CrosHost.get_servo_arguments(args_dict)

def run(machine):
    host = hosts.create_host(machine, servo_args=servo_args)

    duration = int(args_dict.get("duration", 600))
    suspend_iterations = int(args_dict.get("suspend_iterations", 0))

    job.run_test("firmware_Cr50DeepSleepStress", host=host,
                 duration=duration, suspend_iterations=suspend_iterations,
                 cmdline_args=args)

parallel_simple(run, machines)