1# Copyright 2022 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 5AUTHOR = 'ChromeOS SW Engprod Team ([email protected])' 6NAME = 'tast.cross-device.local' 7TIME = 'MEDIUM' 8TEST_TYPE = 'Server' 9MAX_RESULT_SIZE_KB = 1024 * 1024 10PY_VERSION = 3 11 12# tast.py uses binaries installed from autotest_server_package.tar.bz2. 13REQUIRE_SSP = True 14 15DOC = '''Run the Tast Cross Device test suite with Skylab's Android support locally. 16 17This control file will setup the chromebook and android phone for you if you want to run locally. 18Locally means kicking off via test_that to run against either: 191. One of the scheduling units / RF boxes in the lab. 202. At your desk when using the chromebook as a fake labstation. 21You can use #2 to test the e2e adb-over-wifi flow without having a labstation at home. 22NOTE: Labstations store their adb keys at /var/lib/android_keys (and this gets wiped during login) so you need to click accept manually for the setups adb connection. 23 24You need to specify the wifi network details below that the chromebook and phone should be on together. 25 26These args are expected to be passed to test_that: 27--args="phone_station=$PHONE_HOST android_serial=$ANDROID_SERIAL_NUMBER" 28 29When using port forwarding to locahost, the expected args are: 30--args="phone_station=locahost android_station_ssh_port=$FORWARDED_PORT android_serial=$ANDROID_SERIAL_NUMBER" 31 32''' 33 34from autotest_lib.server import utils 35from autotest_lib.server.cros.crossdevice import cross_device_util 36 37def run(machine): 38 # Wifi details that chromebook will connect to. 39 ssid = '<SET NETWORK NAME>' 40 password = '<SET PASSWORD>' 41 42 # Get host objects for each device. 43 host = hosts.create_host(machine) 44 args_dict = utils.args_to_dict(args) 45 android_args = hosts.AndroidHost.get_android_arguments(args_dict) 46 phone = hosts.AndroidHost('local_phone', android_args=android_args) 47 48 # Configure devices for crossdevice tests. 49 cross_device_util.connect_to_wifi(host, ssid, password) 50 ip_address = phone.setup_for_cross_device_tests() 51 52 # Pass the phones adb-over-tcp "serial" (e.g 192.168.0.30:5555) to Tast as a global var. 53 ip_address_arg = 'crossdevice.PhoneIP=%s:5555' % ip_address 54 55 job.run_test('tast', 56 host=host, 57 test_exprs=['("group:cross-device")'], 58 ignore_test_failures=True, max_run_sec=10800, 59 command_args=args, 60 varslist=[ip_address_arg]) 61parallel_simple(run, machines) 62