AOSP中提供的Wi-Fi 和 Bluetooth測試,調試工具

 

本文主要介紹如何使用AOSP中提供的工具測試,調試Wi-Fi 和 Bluetooth。

Bluetooth

Unit tests in AOSP

AOSP includes functional and unit tests for the default Bluetooth stack. These tests are located in system/bt/test. To run the AOSP tests, do the following:

Stop the Android runtime: adb shell stop

From the test directory, run the shell executable file and include options if you want to run a specific test or test suite: ./run_unit_tests.sh TEST_GROUP_NAME TEST_NAME OPTIONS

When the tests finish, re-enable the Android runtime: adb shell start
The list of test names can be found in the file system/bt/test/run_unit_tests.sh.

Debugging options

AOSP provides different methods of debugging a device's Bluetooth stack, including logs and bug reports. These methods may not work for issues that cannot be reproduced or for audio issues, which can be affected by multiple parts of the platform and device.

Debugging with bug reports

To check the Bluetooth service status using dumpsys, use the following command: adb shell dumpsys bluetooth_manager
By default, all log messages are trace level 2. To find out more about the logging levels and change the logging levels for different profiles, look in system/bt/conf/bt_stack.conf

To extract snoop logs from the bug report, use the  btsnooz  script.
Get btsnooz.py
Extract the text version of the bug report. Run btsnooz.py on the text version of the bug report:
btsnooz.py BUG_REPORT.txt > BTSNOOP.log

Debugging with logs

In Android 4.4 and later, you can manually collect BTSnoop logs, which resemble the snoop format in RFC 1761. These logs capture the Host Controller Interface (HCI) packets. For most Android devices, the logs are stored in data/misc/bluetooth/logs.

For privacy reasons, always-on, "in-memory" BTSnoop only logs non-personal information and events. To log all data, the user needs to enable Bluetooth HCI snoop by doing the following:

 

 

WiFi

 

  1. Enable Developer options on the device.
  2. In the Developer options menu, activate the Enable Bluetooth HCI snoop log toggle.
  3. Restart Bluetooth for logging to take effect.

To test the Wi-Fi framework, AOSP provides a mix of unit tests, integration tests (ACTS), and CTS tests.

Unit tests

AOSP includes functional and unit tests for the default Wi-Fi framework: both for the Wi-Fi Manager (app-side code) and the Wi-Fi Service.

Wi-Fi Manager tests:

Located in frameworks/base/wifi/tests

Run using the following shell executable (read the file for more execution options):

% ./frameworks/base/wifi/tests/runtest.sh

Wi-Fi Service tests:

 

Manual test

Run this manual test to verify that old files in the tombstone directory are being deleted.

 

 

Android Comms Test Suite

The Android Comms Test Suite (ACTS) performs automated testing of connectivity stacks, such as Wi-Fi, Bluetooth, and cellular services. The testing tool requires adb and Python, and it can be found in tools/test/connectivity/acts.

The ACTS tests for Wi-FI are found in tools/test/connectivity/acts/tests/google/wifi, with an example test configuration in the same directory: example_config.json.

CTS Tests

The Compatibility Test Suite (CTS) includes tests for the Wi-Fi framework. These are located in cts/tests/tests/net/src/android/net/wifi. The Wi-Fi CTS tests require the device-under-test to be associated with an Access Point at the start of the test run.

Enhanced logging options for debugging

Android 9 improves Wi-Fi logging to make it easier to debug Wi-Fi issues. In Android 9, driver/firmware ring buffers can always be on. Bug reports may automatically be triggered when a bad state is detected (only in userdebug and eng builds). When the latest Wi-Fi HAL (version 1.2) is used, firmware debug buffers are stored in the HAL instead of the framework to save IPC costs.

Implementation

For a reference implementation, see the default implementation in the vendor HAL.

You can disable firmware logging by setting the resource, config_wifi_enable_wifi_firmware_debugging, to false.

Integration test (ACTS)

The integration test can be found at /tools/test/connectivity/acts/tests/google/wifi/WifiDiagnosticsTest.py.

Verified firmware dumps are persisted in the appropriate tombstone directory in flash for userdebug builds. Dumpstate collects from this directory when creating a bug report.

 

 

 

 

 

 

 

 

 

 

 

  1. Located in frameworks/opt/net/wifi/tests/wifitest
  2. Run using the following shell executable (read the file for more execution options):

    % ./frameworks/opt/net/wifi/tests/wifitests/runtest.sh
    

     

  3. Turn on Wi-Fi.
  4. Connect to a network.
  5. Generate a bug report.
  6. Inspect the bugreport zip file and verify that /lshal-debug/[email protected]__IWifi_default.txt holds the archived firmware logs.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章