Home | History | Annotate | Download | only in sequences
      1 # Copyright (c) 2011 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 daily tests"
      7 ATTRIBUTES = "suite:power_daily"
      8 TIME = "LONG"
      9 TEST_CATEGORY = "Functional"
     10 TEST_CLASS = "suite"
     11 TEST_TYPE = "server"
     12 DEPENDENCIES = "power:battery, rpm"
     13 
     14 DOC = """
     15 This test suite runs automated power tests that should all pass. These tests
     16 take a long time (several hours) to run and are run only once a day.
     17 """
     18 
     19 from autotest_lib.server import site_host_attributes
     20 from autotest_lib.client.common_lib import error, global_config
     21 
     22 def _run_client_test(machine):
     23     client = hosts.create_host(machine)
     24     client_attributes = site_host_attributes.HostAttributes(client.hostname)
     25     client_at = autotest.Autotest(client)
     26 
     27     job.run_test('power_RPMTest', verify=True, host=client,
     28                  power_sequence=[True], tag='RPM_ON1')
     29 
     30     # Charge the battery to at least 50% in preparation for the consumption
     31     # test. Charging the battery from empty to full can take up to 4 hours.
     32     client_at.run_test('power_BatteryCharge', percent_target_charge=50,
     33                        max_run_time=60*60*4, tag='CHARGE_50')
     34 
     35     job.run_test('power_RPMTest', verify=True, host=client,
     36                  power_sequence=[False], tag='RPM_OFF1')
     37 
     38     try:
     39         client_at.run_test('power_Consumption')
     40     finally:
     41         job.run_test('power_RPMTest', verify=True, host=client,
     42                      power_sequence=[True], tag='RPM_ON2')
     43 
     44     # Charge the battery to at least 99% in preparation for the load
     45     # test. Charging the battery from empty to full can take up to 4 hours.
     46     client_at.run_test('power_BatteryCharge', percent_target_charge=67,
     47                        max_run_time=60*60*4, tag='CHARGE_67')
     48 
     49     # Run 1 iteration (1hr) of power_LoadTest daily.  See suite control.power
     50     # for full drain parameters
     51     # TODO (snanda):
     52     # 1. Make the test login automatically to facebook and gmail
     53     # 2. Add audiovideo_V4L2 webcam test
     54     job.run_test('power_RPMTest', verify=True, host=client,
     55                  power_sequence=[False], tag='RPM_OFF2')
     56 
     57     try:
     58         client_at.run_test('power_LoadTest', loop_count=1, loop_time=3600,
     59                            check_network=False, tag='WIRED_1hr')
     60         wifi_ap = utils.get_wireless_ssid(machine)
     61         wifi_sec = global_config.global_config.get_config_value('CLIENT',
     62                 'wireless_security', default=None)
     63         wifi_pw = global_config.global_config.get_config_value('CLIENT',
     64                 'wireless_password', default=None)
     65         if wifi_ap:
     66             client_at.run_test('power_LoadTest', loop_count=1, loop_time=3600,
     67                                force_wifi=True, wifi_ap=wifi_ap,
     68                                wifi_sec=wifi_sec, wifi_pw=wifi_pw,
     69                                tag='WIFI_1hr')
     70     finally:
     71         job.run_test('power_RPMTest', verify=True, host=client,
     72                      power_sequence=[True], tag='RPM_ON3')
     73 
     74 
     75 job.parallel_on_machines(_run_client_test, machines)
     76