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