1# Copyright 2019 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""" 5Test which updates chameleond on the Bluetooth Peer device 6 7This is not a test per se. This 'test' checks if the chameleond commit on the 8Bluetooth peer device and updates it if it below the expected value. 9 10The expected commit and the installation bundle is downloaded from google cloud 11storage. 12""" 13 14from autotest_lib.client.common_lib import error 15from autotest_lib.server import test 16from autotest_lib.server.cros.bluetooth import bluetooth_peer_update 17 18class bluetooth_PeerUpdate(test.test): 19 """ 20 This test updates chameleond on Bluetooth peer devices 21 22 """ 23 24 version = 1 25 26 def run_once(self, host, btpeer_args=[]): 27 """ Update Bluetooth peer device 28 29 @param host: the DUT, usually a chromebook 30 """ 31 try: 32 self.host = host 33 self.host.initialize_btpeer(btpeer_args=btpeer_args) 34 commit = None 35 (_, commit) = bluetooth_peer_update.get_latest_commit() 36 if commit is None: 37 raise error.TestFail('Unable to get current commit') 38 if not bluetooth_peer_update.download_installation_files(self.host, 39 commit): 40 raise error.TestFail('Unable to download installation files ') 41 bluetooth_peer_update.update_peers(self.host, commit) 42 finally: 43 if not bluetooth_peer_update.cleanup(host, commit): 44 raise error.TestFail('Cleanup failed') 45