| <html devsite><head> |
| |
| <meta name="book_path" value="/_book.yaml"/> |
| |
| <meta name="project_path" value="/_project.yaml"/> |
| </head> |
| <body> |
| |
| <!-- |
| Copyright 2018 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <h1 id="testing_and_debugging" class="page-title">测试和调试</h1> |
| |
| <p>本文将介绍如何使用 ASOP 中提供的工具测试和调试 WLAN 实现。</p> |
| |
| <h2 id="testing">测试</h2> |
| |
| <p>为了测试 WLAN 框架,AOSP 提供了一系列单元测试、集成测试 (ACTS) 和 CTS 测试。</p> |
| |
| <h3 id="unit_tests">单元测试</h3> |
| |
| <p>AOSP 包括针对默认 WLAN 框架的功能测试和单元测试:这两项测试均适用于 WLAN Manager(应用端代码)和 WLAN 服务。</p> |
| |
| <p>WLAN Manager 测试:</p> |
| |
| <ul> |
| <li>位于 <code>frameworks/base/wifi/tests</code> 中</li> |
| <li><p>使用以下 shell 可执行文件运行(有关更多执行选项,请参阅文件):</p> |
| <pre class="prettyprint"><code>% ./frameworks/base/wifi/tests/runtest.sh |
| </code></pre></li> |
| </ul> |
| |
| <p>WLAN 服务测试:</p> |
| |
| <ul> |
| <li>位于 <code>frameworks/opt/net/wifi/tests/wifitest</code> 中</li> |
| <li><p>使用以下 shell 可执行文件运行(有关更多执行选项,请参阅文件):</p> |
| <pre class="prettyprint"><code>% ./frameworks/opt/net/wifi/tests/wifitests/runtest.sh |
| </code></pre></li> |
| </ul> |
| |
| <h3 id="android_comms_test_suite">Android 通讯测试套件</h3> |
| |
| <p>Android 通讯测试套件 (ACTS) 用于执行对连接堆栈(例如 WLAN、蓝牙和移动网络服务)的自动测试。该测试工具需要 adb 和 Python,您可以在以下位置找到它:<code>tools/test/connectivity/acts</code>。</p> |
| |
| <p>您可以在以下位置找到针对 WLAN 的 ACTS 测试:<code>tools/test/connectivity/acts/tests/google/wifi</code>,而且同一目录下还包含以下示例测试配置:<code>example_config.json</code>。</p> |
| |
| <h3 id="cts_tests">CTS 测试</h3> |
| |
| <p><a href="/compatibility/cts/">兼容性测试套件</a> (CTS) 包括针对 WLAN 框架的测试。这些测试位于以下位置:<code>cts/tests/tests/net/src/android/net/wifi</code>。WLAN CTS 测试要求在测试开始运行时将受测设备与接入点相关联。</p> |
| |
| <h2 id="enhanced_logging_options">增强型日志记录选项</h2> |
| |
| <p>Android 9 改进了 WLAN 日志记录功能,以便更轻松地调试 WLAN 问题。在 Android 9 中,驱动程序/固件环形缓冲区可以始终处于开启状态。在检测到错误状态时,可能会自动触发错误报告(仅限 userdebug 和 eng 版本)。如果您使用的是最新 WLAN HAL(1.2 版),则固件调试缓冲区存储在 HAL 中而不是框架内,以节省 IPC 费用。</p> |
| |
| <h3 id="implementation">实现</h3> |
| |
| <p>有关参考实现,请参阅供应商 HAL 中的<a href="https://android.googlesource.com/platform/hardware/interfaces/+/master/wifi/">默认实现</a>。</p> |
| |
| <p>您可以通过将资源 <code>config_wifi_enable_wifi_firmware_debugging</code> 设置为 false 来停用固件日志记录。</p> |
| |
| <h3 id="integration_test_acts">集成测试 (ACTS)</h3> |
| |
| <p>您可以在以下位置找到集成测试:<code>/tools/test/connectivity/acts/tests/google/wifi/WifiDiagnosticsTest.py</code>。</p> |
| |
| <p>对于 userdebug 版本,已验证的固件转储会保留在闪存中相应的 tombstone 目录下。在创建错误报告时,Dumpstate 就是从此目录中收集的。</p> |
| |
| <h3 id="manual_test">手动测试</h3> |
| |
| <p>运行以下手动测试,以验证 <a href="https://source.android.com/devices/tech/debug/#debuggerd">tombstone 目录</a>中的旧文件是否已被删除。</p> |
| |
| <ol> |
| <li>开启 WLAN。</li> |
| <li>连接到网络。</li> |
| <li>生成<a href="setup/contribute/read-bug-reports">错误报告</a>。</li> |
| <li>检查 bugreport zip 文件并验证 <code>/lshal-debug/[email protected]__IWifi_default.txt</code> 中是否包含已归档的固件日志。</li> |
| </ol> |
| |
| </body></html> |