1# Copyright 2018 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 5from autotest_lib.client.common_lib import error 6from autotest_lib.client.common_lib.cros import tpm_utils 7from autotest_lib.server import autotest 8from autotest_lib.server.cros.update_engine import update_engine_test 9 10class autoupdate_NonBlockingOOBEUpdate(update_engine_test.UpdateEngineTest): 11 """Try a non-forced autoupdate during OOBE.""" 12 version = 1 13 14 _NON_CRITICAL_ERROR = 'finished OmahaRequestAction with code ' \ 15 'ErrorCode::kNonCriticalUpdateInOOBE' 16 17 def cleanup(self): 18 self._host.run('rm %s' % self._CUSTOM_LSB_RELEASE, ignore_status=True) 19 super(autoupdate_NonBlockingOOBEUpdate, self).cleanup() 20 21 22 def run_once(self, full_payload=True, job_repo_url=None): 23 """ 24 Trys an autoupdate during ChromeOS OOBE without a deadline. 25 26 @param full_payload: True for a full payload. False for delta. 27 @param job_repo_url: Used for debugging locally. This is used to figure 28 out the current build and the devserver to use. 29 The test will read this from a host argument 30 when run in the lab. 31 32 """ 33 tpm_utils.ClearTPMOwnerRequest(self._host) 34 self._host.run('ls /home/chronos/.oobe_completed', ignore_status=True) 35 36 # veyron_rialto is a medical device with a different OOBE that auto 37 # completes so this test is not valid on that device. 38 if 'veyron_rialto' in self._host.get_board(): 39 raise error.TestNAError('Rialto has a custom OOBE. Skipping test.') 40 41 update_url = self.get_update_url_for_test(job_repo_url, 42 full_payload=full_payload, 43 critical_update=False) 44 45 # Call client test to start the OOBE update. 46 client_at = autotest.Autotest(self._host) 47 client_at.run_test('autoupdate_StartOOBEUpdate', image_url=update_url, 48 full_payload=full_payload, critical_update=False) 49 50 # Ensure that the update failed as expected. 51 err_str = 'Update did not fail with kNonCriticalUpdateInOOBE' 52 self._check_update_engine_log_for_entry(self._NON_CRITICAL_ERROR, 53 raise_error=True, 54 err_str=err_str) 55