1*9c5db199SXin Li# Copyright 2022 The Chromium OS Authors. All rights reserved. 2*9c5db199SXin Li# Use of this source code is governed by a BSD-style license that can be 3*9c5db199SXin Li# found in the LICENSE file. 4*9c5db199SXin Li 5*9c5db199SXin LiAUTHOR = 'ChromeOS SW Engprod Team ([email protected])' 6*9c5db199SXin LiNAME = 'tast.cross-device.local' 7*9c5db199SXin LiTIME = 'MEDIUM' 8*9c5db199SXin LiTEST_TYPE = 'Server' 9*9c5db199SXin LiMAX_RESULT_SIZE_KB = 1024 * 1024 10*9c5db199SXin LiPY_VERSION = 3 11*9c5db199SXin Li 12*9c5db199SXin Li# tast.py uses binaries installed from autotest_server_package.tar.bz2. 13*9c5db199SXin LiREQUIRE_SSP = True 14*9c5db199SXin Li 15*9c5db199SXin LiDOC = '''Run the Tast Cross Device test suite with Skylab's Android support locally. 16*9c5db199SXin Li 17*9c5db199SXin LiThis control file will setup the chromebook and android phone for you if you want to run locally. 18*9c5db199SXin LiLocally means kicking off via test_that to run against either: 19*9c5db199SXin Li1. One of the scheduling units / RF boxes in the lab. 20*9c5db199SXin Li2. At your desk when using the chromebook as a fake labstation. 21*9c5db199SXin LiYou can use #2 to test the e2e adb-over-wifi flow without having a labstation at home. 22*9c5db199SXin LiNOTE: 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*9c5db199SXin Li 24*9c5db199SXin LiYou need to specify the wifi network details below that the chromebook and phone should be on together. 25*9c5db199SXin Li 26*9c5db199SXin LiThese args are expected to be passed to test_that: 27*9c5db199SXin Li--args="phone_station=$PHONE_HOST android_serial=$ANDROID_SERIAL_NUMBER" 28*9c5db199SXin Li 29*9c5db199SXin LiWhen using port forwarding to locahost, the expected args are: 30*9c5db199SXin Li--args="phone_station=locahost android_station_ssh_port=$FORWARDED_PORT android_serial=$ANDROID_SERIAL_NUMBER" 31*9c5db199SXin Li 32*9c5db199SXin Li''' 33*9c5db199SXin Li 34*9c5db199SXin Lifrom autotest_lib.server import utils 35*9c5db199SXin Lifrom autotest_lib.server.cros.crossdevice import cross_device_util 36*9c5db199SXin Li 37*9c5db199SXin Lidef run(machine): 38*9c5db199SXin Li # Wifi details that chromebook will connect to. 39*9c5db199SXin Li ssid = '<SET NETWORK NAME>' 40*9c5db199SXin Li password = '<SET PASSWORD>' 41*9c5db199SXin Li 42*9c5db199SXin Li # Get host objects for each device. 43*9c5db199SXin Li host = hosts.create_host(machine) 44*9c5db199SXin Li args_dict = utils.args_to_dict(args) 45*9c5db199SXin Li android_args = hosts.AndroidHost.get_android_arguments(args_dict) 46*9c5db199SXin Li phone = hosts.AndroidHost('local_phone', android_args=android_args) 47*9c5db199SXin Li 48*9c5db199SXin Li # Configure devices for crossdevice tests. 49*9c5db199SXin Li cross_device_util.connect_to_wifi(host, ssid, password) 50*9c5db199SXin Li ip_address = phone.setup_for_cross_device_tests() 51*9c5db199SXin Li 52*9c5db199SXin Li # Pass the phones adb-over-tcp "serial" (e.g 192.168.0.30:5555) to Tast as a global var. 53*9c5db199SXin Li ip_address_arg = 'crossdevice.PhoneIP=%s:5555' % ip_address 54*9c5db199SXin Li 55*9c5db199SXin Li job.run_test('tast', 56*9c5db199SXin Li host=host, 57*9c5db199SXin Li test_exprs=['("group:cross-device")'], 58*9c5db199SXin Li ignore_test_failures=True, max_run_sec=10800, 59*9c5db199SXin Li command_args=args, 60*9c5db199SXin Li varslist=[ip_address_arg]) 61*9c5db199SXin Liparallel_simple(run, machines) 62