1# Copyright 2021 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 5import logging 6 7from autotest_lib.client.common_lib.error import TestFail 8from autotest_lib.server.cros import chrome_sideloader 9 10AUTHOR = 'ChromeOS SW Engprod Team ([email protected])' 11NAME = 'tast.nearby-share-cb2cb-chrome-from-tls' 12TIME = 'MEDIUM' 13TEST_TYPE = 'Server' 14MAX_RESULT_SIZE_KB = 1024 * 1024 15PY_VERSION = 3 16 17# tast.py uses binaries installed from autotest_server_package.tar.bz2. 18REQUIRE_SSP = True 19 20# This mount point controls the version of chrome to use 21CHROME_MOUNT_POINT = '/opt/google/chrome' 22# Location to put the sideloaded chrome artifacts 23CHROME_DIR = '/usr/local/chrome' 24 25DOC = ''' 26Runs the Tast Nearby Share remote tests with a custom chrome binary. 27 28These Nearby Share tests require two chromebooks, so we must provision 29both DUTs with the custom chrome binary before the tests are kicked off. 30 31This test is used by Chrome builder for Nearby Share CI/CQ purposes. 32A chrome builder creates a chrome binary and artifacts, 33which is in turn provisioned to both DUTs through TLS. 34 35Tast tests uses the sideloaded version of chrome for testing. 36 37''' 38 39 40def run(machine): 41 primary_dut = hosts.create_host(machine) 42 companions = hosts.create_companion_hosts(companion_hosts) 43 44 if not companions: 45 raise TestFail('Missing companion hosts') 46 47 secondary_dut = companions[0] 48 49 logging.info("Running %s on primary_dut: %s and companion_host:%s", NAME, 50 primary_dut, secondary_dut) 51 52 # Setup both DUTs to use the chrome binary from TLS 53 for host in [primary_dut, secondary_dut]: 54 chrome_sideloader.setup_host( 55 host, CHROME_DIR, CHROME_MOUNT_POINT) 56 57 # Register a clean up callback to reset the chrome mount. 58 def cleanup(): 59 for host in [primary_dut, secondary_dut]: 60 chrome_sideloader.cleanup_host( 61 host, CHROME_DIR, CHROME_MOUNT_POINT) 62 job.add_post_run_hook(cleanup) 63 64 job.run_test('tast', 65 host=primary_dut, 66 test_exprs=['("group:nearby-share-cq")'], 67 download_data_lazily=False, 68 ignore_test_failures=False, 69 max_run_sec=3600, 70 companion_duts={'cd1': secondary_dut}, 71 command_args=args 72 ) 73 74 75parallel_simple(run, machines) 76