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 5import logging 6from autotest_lib.client.common_lib import error 7from autotest_lib.server import test 8 9 10class infra_MultiDutsWithAndroid(test.test): 11 """ 12 Verify the test can create correct host type for Android devices. 13 14 """ 15 version = 1 16 17 def _verify_adb(self, dut): 18 logging.info("Starting to verify basic adb actions.") 19 dut.restart_adb_server() 20 dut.ensure_device_connectivity() 21 ip_address = dut.get_wifi_ip_address() 22 logging.info("Ip address from Android device: %s", ip_address) 23 24 def run_once(self, host, companions): 25 """ 26 Starting point of this test. 27 28 Note: base class sets host as self._host. 29 30 """ 31 self.host = host 32 android_device_tested = False 33 for dut in companions: 34 if hasattr(dut, 'phone_station'): 35 dut_out = dut.phone_station.run('echo True').stdout.strip() 36 if dut_out != 'True': 37 raise error.TestError( 38 'phone station stdout != True (got: %s)', dut_out) 39 self._verify_adb(dut) 40 android_device_tested = True 41 if not android_device_tested: 42 raise error.TestError( 43 'No Android host detected from companion duts.') 44