1#!/usr/bin/env python3 2# 3# Copyright (C) 2020 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); you may not 6# use this file except in compliance with the License. You may obtain a copy of 7# the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14# License for the specific language governing permissions and limitations under 15# the License. 16 17from acts import signals 18from acts.base_test import BaseTestClass 19from acts import asserts 20 21 22class HwinfoTest(BaseTestClass): 23 def setup_class(self): 24 super().setup_class() 25 self.dut = self.fuchsia_devices[0] 26 27 def test_get_device_info(self): 28 """Verify that getting the hardware device information of a Fuchsia 29 device does not return an error. 30 31 Steps: 32 1. Get the hardware device info of a Fuchsia device. 33 34 Expected Result: 35 No errors in getting the hardware info. 36 37 Returns: 38 signals.TestPass if no errors 39 signals.TestFailure if there are any errors during the test. 40 41 TAGS: Hardware 42 Priority: 2 43 """ 44 result = self.dut.hwinfo_lib.getDeviceInfo() 45 if result.get("error") is None: 46 self.log.info("HW info found: {}".format(result)) 47 signals.TestPass(result.get("result")) 48 else: 49 signals.TestFailure(result.get("error")) 50 51 def test_get_product_info(self): 52 """Verify that getting the hardware product information of a Fuchsia 53 device does not return an error. 54 55 Steps: 56 1. Get the hardware product info of a Fuchsia device. 57 58 Expected Result: 59 No errors in getting the hardware product info. 60 61 Returns: 62 signals.TestPass if no errors 63 signals.TestFailure if there are any errors during the test. 64 65 TAGS: Hardware 66 Priority: 2 67 """ 68 result = self.dut.hwinfo_lib.getProductInfo() 69 if result.get("error") is None: 70 self.log.info("HW info found: {}".format(result)) 71 signals.TestPass(result.get("result")) 72 else: 73 signals.TestFailure(result.get("error")) 74 75 def test_get_board_info(self): 76 """Verify that getting the hardware board information of a Fuchsia 77 device does not return an error. 78 79 Steps: 80 1. Get the hardware board info of a Fuchsia device. 81 82 Expected Result: 83 No errors in getting the hardware board info. 84 85 Returns: 86 signals.TestPass if no errors 87 signals.TestFailure if there are any errors during the test. 88 89 TAGS: Hardware 90 Priority: 2 91 """ 92 result = self.dut.hwinfo_lib.getBoardInfo() 93 if result.get("error") is None: 94 self.log.info("HW info found: {}".format(result)) 95 signals.TestPass(result.get("result")) 96 else: 97 signals.TestFailure(result.get("error")) 98