Home | History | Annotate | Download | only in sequences
      1 # Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 AUTHOR = "Chrome OS Team"
      6 NAME = "Power Requirements tests"
      7 ATTRIBUTES = "suite:power_requirements"
      8 SUITE = "power_requirements"
      9 TIME = "LONG"
     10 TEST_CATEGORY = "Functional"
     11 TEST_CLASS = "suite"
     12 TEST_TYPE = "server"
     13 DEPENDENCIES = "rpm"
     14 
     15 DOC = """
     16 This test suite runs automated power tests that should all pass. These tests
     17 take a long time (several hours) to run and are intended to ensure that the DUT
     18 complies with the power subsection of our CrOS Requirements doc.
     19 
     20 Current tests with runtimes are:
     21   power_BatteryCharge : <= 3 hours
     22   power_Standby       : 12 hours
     23 
     24 """
     25 # TODO(tbroch) Deprecate this control file when SUITES= mechanism detailed @
     26 #    https://sites.google.com/a/chromium.org/dev/chromium-os/testing/test-suites
     27 #    has ability to assure power states pre/post conditions.
     28 from autotest_lib.server import site_host_attributes
     29 from autotest_lib.client.common_lib import error
     30 
     31 def _run_client_test(machine):
     32     client = hosts.create_host(machine)
     33     client_attributes = site_host_attributes.HostAttributes(machine)
     34     client_at = autotest.Autotest(client)
     35     if client.has_power():
     36         client.power_on()
     37     else:
     38         raise error.TestNAError("No power switch configured")
     39 
     40     # TODO(tbroch): Add power_Standby here once there's a mechanism to postpone
     41     # autotest server from checking that DUT is still alive via network
     42 
     43     # Run the full 60/20/10/10 load test, draining a full battery
     44     client_at.run_test('power_BatteryCharge', percent_target_charge=100,
     45                        max_run_time=60*60*6, tag='CHARGE_100')
     46     client.power_off()
     47     try:
     48         if hasattr(client_attributes, 'wifi'):
     49             ap, sec, pw = client_attributes.wifi.split(',')
     50             client_at.run_test('power_LoadTest', loop_count=12, loop_time=3600,
     51                                force_wifi=True, wifi_ap=ap, wifi_sec=sec,
     52                                wifi_pw=pw, tag='WIFI_full')
     53         else:
     54             client_at.run_test('power_LoadTest', loop_count=12, loop_time=3600,
     55                                check_network=False, tag='WIRED_full')
     56     finally:
     57         client.power_on()
     58 
     59     # From client/site_tests/suite_HWQual/control.battery_charge_time
     60     max_hours = 3
     61     percent_charge_delta = 94.0
     62     time_limit = max_hours * 60 * 60 * percent_charge_delta / 100.0
     63     # battery must be at least 80% of design capacity
     64     percent_battery_wear_allowed = .20
     65 
     66     client_at.run_test('power_BatteryCharge', tag='full',
     67                  max_run_time=time_limit,
     68                  percent_charge_to_add=100,
     69                  percent_initial_charge_max=5,
     70                  use_design_charge_capacity=False,
     71                  constraints=[
     72                      '1.0 - ah_charge_full / ah_charge_full_design <= %f' %
     73                          percent_battery_wear_allowed,
     74                      'percent_final_charge - percent_initial_charge >= %f' %
     75                          percent_charge_delta,
     76                  ])
     77 
     78 job.parallel_on_machines(_run_client_test, machines)
     79