1# Lint as: python2, python3 2# Copyright 2018 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import logging 7 8from autotest_lib.client.common_lib.cros import kernel_utils 9from autotest_lib.server.cros.update_engine import update_engine_test 10 11class autoupdate_Cellular(update_engine_test.UpdateEngineTest): 12 """ 13 Tests auto updating over cellular. 14 15 Usually with AU tests we use a lab devserver to hold the payload, and to be 16 the omaha instance that DUTs ping. However, over cellular they will not be 17 able to reach the devserver. So we will need to put the payload on a 18 public google storage location. We will setup an omaha instance on the DUT 19 (via autoupdate_CannedOmahaUpdate) that points to the payload on GStorage. 20 21 """ 22 version = 1 23 24 def _check_for_cellular_entries_in_update_log(self): 25 """Check update_engine.log for log entries about cellular.""" 26 logging.info('Making sure we have cellular entries in update_engine ' 27 'log.') 28 line1 = ('Allowing updates over cellular as permission preference is ' 29 'set to true.') 30 line2 = 'We are connected via cellular, Updates allowed: Yes' 31 self._check_update_engine_log_for_entry([line1, line2], 32 raise_error=True) 33 34 35 def cleanup(self): 36 """Clean up the test state.""" 37 self._set_update_over_cellular_setting(False) 38 super(autoupdate_Cellular, self).cleanup() 39 40 41 def run_once(self, job_repo_url=None, full_payload=True): 42 """ 43 Runs the autoupdate test over cellular once. 44 45 @param job_repo_url: The URL of the current build. 46 @param full_payload: Whether the payload should be full or delta. 47 48 """ 49 payload_url = self.get_payload_for_nebraska( 50 job_repo_url, full_payload=full_payload, public_bucket=True) 51 active, inactive = kernel_utils.get_kernel_state(self._host) 52 self._set_update_over_cellular_setting(True) 53 self._run_client_test_and_check_result('autoupdate_CannedOmahaUpdate', 54 payload_url=payload_url, 55 use_cellular=True) 56 self._check_for_cellular_entries_in_update_log() 57 self._host.reboot() 58 rootfs_hostlog, _ = self._create_hostlog_files() 59 self.verify_update_events(self._FORCED_UPDATE, rootfs_hostlog) 60 kernel_utils.verify_boot_expectations(inactive, host=self._host) 61