| # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import logging |
| |
| from autotest_lib.client.bin import test |
| from autotest_lib.client.bin import utils |
| from autotest_lib.client.common_lib import error |
| from autotest_lib.client.common_lib.cros.network import interface |
| from autotest_lib.client.cros.networking import shill_proxy |
| |
| |
| class network_WlanDriver(test.test): |
| """ |
| Ensure wireless devices have the expected associated kernel driver. |
| """ |
| version = 1 |
| EXPECTED_DRIVER = { |
| 'Atheros AR9280': { |
| '3.4': 'wireless/ath/ath9k/ath9k.ko', |
| '3.8': 'wireless-3.4/ath/ath9k/ath9k.ko' |
| }, |
| 'Atheros AR9382': { |
| '3.4': 'wireless/ath/ath9k/ath9k.ko', |
| '3.8': 'wireless-3.4/ath/ath9k/ath9k.ko' |
| }, |
| 'Intel 7260': { |
| '3.8': 'wireless/iwl7000/iwlwifi/iwlwifi.ko', |
| '3.10': 'wireless-3.8/iwl7000/iwlwifi/iwlwifi.ko', |
| '3.14': 'wireless-3.8/iwl7000/iwlwifi/iwlwifi.ko', |
| '4.4': 'wireless/iwl7000/iwlwifi/iwlwifi.ko' |
| }, |
| 'Intel 7265': { |
| '3.8': 'wireless/iwl7000/iwlwifi/iwlwifi.ko', |
| '3.10': 'wireless-3.8/iwl7000/iwlwifi/iwlwifi.ko', |
| '3.14': 'wireless-3.8/iwl7000/iwlwifi/iwlwifi.ko', |
| '3.18': 'wireless/iwl7000/iwlwifi/iwlwifi.ko' |
| }, |
| 'Atheros AR9462': { |
| '3.4': 'wireless/ath/ath9k_btcoex/ath9k_btcoex.ko', |
| '3.8': 'wireless-3.4/ath/ath9k_btcoex/ath9k_btcoex.ko' |
| }, |
| 'Qualcomm Atheros QCA6174': { |
| '3.18': 'wireless/ar10k/ath/ath10k/ath10k_core.ko', |
| '3.18': 'wireless/ar10k/ath/ath10k/ath10k_pci.ko' |
| }, |
| 'Qualcomm Atheros NFA344A/QCA6174': { |
| '3.18': 'wireless/ar10k/ath/ath10k/ath10k_core.ko', |
| '3.18': 'wireless/ar10k/ath/ath10k/ath10k_pci.ko' |
| }, |
| 'Marvell 88W8797 SDIO': { |
| '3.4': 'wireless/mwifiex/mwifiex_sdio.ko', |
| '3.8': 'wireless-3.4/mwifiex/mwifiex_sdio.ko' |
| }, |
| 'Marvell 88W8887 SDIO': { |
| '3.14': 'wireless-3.8/mwifiex/mwifiex_sdio.ko' |
| }, |
| 'Marvell 88W8897 PCIE': { |
| '3.8': 'wireless/mwifiex/mwifiex_pcie.ko', |
| '3.10': 'wireless-3.8/mwifiex/mwifiex_pcie.ko' |
| }, |
| 'Marvell 88W8897 SDIO': { |
| '3.8': 'wireless/mwifiex/mwifiex_sdio.ko', |
| '3.10': 'wireless-3.8/mwifiex/mwifiex_sdio.ko', |
| '3.14': 'wireless-3.8/mwifiex/mwifiex_sdio.ko', |
| '3.18': 'wireless/mwifiex/mwifiex_sdio.ko' |
| }, |
| 'Broadcom BCM4354 SDIO': { |
| '3.8': 'wireless/brcm80211/brcmfmac/brcmfmac.ko', |
| '3.14': 'wireless-3.8/brcm80211/brcmfmac/brcmfmac.ko' |
| }, |
| 'Broadcom BCM4356 PCIE': { |
| '3.10': 'wireless-3.8/brcm80211/brcmfmac/brcmfmac.ko' |
| }, |
| 'Marvell 88W8997 PCIE': { |
| '4.4': 'wireless/marvell/mwifiex/mwifiex_pcie.ko', |
| }, |
| } |
| |
| |
| def run_once(self): |
| """Test main loop""" |
| # full_revision looks like "3.4.0". |
| full_revision = utils.system_output('uname -r') |
| # base_revision looks like "3.4". |
| base_revision = '.'.join(full_revision.split('.')[:2]) |
| logging.info('Kernel base is %s', base_revision) |
| |
| proxy = shill_proxy.ShillProxy() |
| device_obj = proxy.find_object('Device', |
| {'Type': proxy.TECHNOLOGY_WIFI}) |
| if device_obj is None: |
| raise error.TestNAError('Found no recognized wireless device') |
| |
| device = device_obj.GetProperties()['Interface'] |
| net_if = interface.Interface(device) |
| device_description = net_if.device_description |
| if not device_description: |
| raise error.TestFail('Device %s is not supported' % device) |
| |
| device_name, module_path = device_description |
| logging.info('Device name %s, module path %s', device_name, module_path) |
| if not device_name in self.EXPECTED_DRIVER: |
| raise error.TestFail('Unexpected device name %s' % |
| device_name) |
| |
| if not base_revision in self.EXPECTED_DRIVER[device_name]: |
| raise error.TestNAError('Unexpected base kernel revision %s with device name %s' % |
| (base_revision, device_name)) |
| |
| expected_driver = self.EXPECTED_DRIVER[device_name][base_revision] |
| if module_path != expected_driver: |
| raise error.TestFail('Unexpected driver for %s/%s; got %s but expected %s' % |
| (base_revision, device_name, |
| module_path, expected_driver)) |