external_auto-pts:基于 Bluetooth SIG PTS 的自动化测试框架项目

用户可通过该项目自动化蓝牙测试流程,提升测试效率。它利用PTSControl COM API实现测试自动化,支持Zephyr、Mynewt等蓝牙协议栈,可运行460多个测试用例,采用客户端/服务器架构,支持跨平台协作与结果报告生成。【此简介由AI生成】

分支5Tags4
文件最后提交记录最后更新时间
add .github .gitee6 个月前
chore: add openvela-reviewer team to CODEOWNERS Append @open-vela/openvela-reviewer so the team can review PRs.21 天前
common: Refactor sync mechanism New sync mechanism allows us to specify delay for each wid, honors order of sync elements, fixes tests that require two instances of PTS. This also required changes in Callback Thread. Now there is a separate callback thread for each PTS instance. This allows us to apply delay to each PTS instance individually, without blocking whole test execution.6 个月前
btp: use OwnAddrType in GAP Connect6 个月前
images: architecture diagram: align text location with icon7 年前
bluetooth: pts: startup the nuttx simulate at init Signed-off-by: chao.an <anchao@xiaomi.com>6 个月前
btp: use OwnAddrType in GAP Connect6 个月前
new script to check coding style7 年前
pycodestyle fixes: btpclient.py7 年前
wid: Remove sleep This behavior is replaced by synchronization mechanism.6 个月前
Prepare auto-pts for EATT testing Author: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl> Date: Wed Apr 22 11:32:28 2020 +0200 Prepare auto-pts for EATT testing -EATT test cases are as follows: 1. GATT/SR/GAC/BI-01-C 2. GATT/CL/GAR/BV-11-C 3. GATT/SR/GAR/BV-12-C 4. GATT/CL/GAS/BV-04-C 5. GATT/SR/GAR/BV-11-C 6. GATT/CL/GAR/BV-10-C 7. GATT/SR/GAW/BV-12-C 8. GATT/CL/GAW/BI-37-C 9. GATT/SR/GAW/BV-13-C 10. GATT/SR/GAW/BV-14-C 11. GATT/CL/GAW/BV-10-C 12. GATT/SR/GPM/BV-05-C -Edited workspace to enable these tests (for GATT/SR/GAC/BI-01-C TSPC_GATT_2_3 should be disabled seperately) -Added appropriate wids -corrected hdl_wid_76 -Errata was filed for tests 2, 3, 7, 10, 11 -test 6. requires corrections in auto-pts -test 12 passes all checks, but isn't finishing6 个月前
common: Add initial test case statistics - duration This adds calculation of mean test duration that is stored in sqlite database.7 年前
Set license: GPLv2 for GNU/Linux part, BSD for Windows part8 年前
bluez: Add README This patch adds BKM for BlueZ.6 个月前
new TODO file7 年前
common: Refactor sync mechanism New sync mechanism allows us to specify delay for each wid, honors order of sync elements, fixes tests that require two instances of PTS. This also required changes in Callback Thread. Now there is a separate callback thread for each PTS instance. This allows us to apply delay to each PTS instance individually, without blocking whole test execution.6 个月前
common: Refactor sync mechanism New sync mechanism allows us to specify delay for each wid, honors order of sync elements, fixes tests that require two instances of PTS. This also required changes in Callback Thread. Now there is a separate callback thread for each PTS instance. This allows us to apply delay to each PTS instance individually, without blocking whole test execution.6 个月前
bluetooth: pts: add nuttx simulate support Command line: sudo ./autoptsclient-zephyr.py zephyr-master $PWD/nuttx -l LOCAL_IP -i SERVER_IP -t TTYDEV -b sim Signed-off-by: chao.an <anchao@xiaomi.com>6 个月前
autoptsclient_bot.py: Add Mynewt project6 个月前
common: Recover PTS in case of XML RPC error XML RPC error usually means that the PTS instance has crashed and we were not able to recover it from server side, so we should try to do that from client side. This PR improves stability.6 个月前
Updated README.md and imports - Iron Python is not supported, deleted autopts.py - Autopts.py description is no longer in README - Added missing python modules to requirements (both server and client) - config.py.mynewt.sample fixes (probably some remnants from config.py.zephyr.sample)6 个月前
server: Print local IP address on start6 个月前
Updated README.md and imports - Iron Python is not supported, deleted autopts.py - Autopts.py description is no longer in README - Added missing python modules to requirements (both server and client) - config.py.mynewt.sample fixes (probably some remnants from config.py.zephyr.sample)6 个月前
New config file Used to store common configs of the auto-pts server and client8 年前
ptscontrol: Remove duplicated variable6 个月前
ptscontrol: Refactor server side to use PTS COM interface This fixes issue using PTS provided Interop.PTSControl.dll, by removing dependency upon this file. With this PTS COM is used directly via Dispatch based COM object. The IronPython dependency has been removed so that rin this script with Python 3.6 个月前

目录

引言

蓝牙配置调整套件(PTS)是由蓝牙 SIG 提供的蓝牙测试工具。PTS 是一个 Windows 程序,通常通过其 GUI 以手动模式使用。

auto-pts 是蓝牙 PTS 自动化框架。auto-pts 使用 PTSControl COM API 来自动化测试。

目前已为 Zephyr OS 和 Mynewt OS 自动化了超过 460 个测试用例,将测试时间从一个月缩短至 9 小时。auto-pts 已经用于自动化测试以下三种蓝牙堆栈:

  • BlueZ
  • Zephyr BLE
  • Mynewt NimBLE

架构

auto-pts 服务器:使用 Python 3 实现。在 Windows 上运行,并提供面向网络的 XML-RPC 接口与 PTS 通信。

auto-pts 客户端:使用 Python 2.7 实现。在 GNU/Linux 上运行,与 auto-pts 服务器(用于启动/停止测试用例,向 PTS 发送响应)通信,并与被测试的实施(IUT)进行通信,以采取适当的操作。

被测试的实施(IUT):运行要测试的蓝牙堆栈的主机,这可以是模拟器或真实硬件。IUT 通过使用蓝牙测试协议进行控制。

蓝牙测试协议(BTP):用于与 IUT 通信。参见 doc/btp_spec.txt

Linux 预先要求

  1. socat,用于从 UART 的 tty 文件传输 BTP 数据流。

     sudo apt-get install python-setuptools socat
    
  2. 此外,使用以下命令安装所需的 Python 模块:

     python2 -m pip install --user -r autoptsclient_requirements.txt
    

Windows 预先要求

为了能够在自动化模式下运行 PTS,不应有 PTS 实例在 GUI 模式下运行。因此,在运行这些脚本之前,请关闭 PTS GUI。

  1. 使用以下命令安装所需模块:

     python.exe -m pip install --user -r autoptsserver_requirements.txt
    

PTS 工作空间设置

在运行任何脚本之前,您需要在 PTS 中创建一个工作空间,将所需项目添加到工作空间中,并配置 PICs 和 PIXITs。

或者,您可以使用 auto-pts 工作空间。Auto-pts 在 "workspaces" 目录中提供了预先配置好的 PTS 工作空间。可用工作空间列表如下:

  • bluez
    • Mynewt Nimble 主机
    • zephyr-master
    • zephyr-v1.14
    • zephyr-v2.2.0

在客户端/服务器模式下运行

auto-pts 框架使用客户端服务器架构。在这种设置中,PTS 自动化服务器在 Windows 上运行,客户端在 GNU/Linux 上运行。

以下命令在 Windows 上启动 AutoPTS 服务器:

python.exe autoptsserver.py

根据测试的堆栈,有单独的 autoptsclient-*.py 脚本来启动 AutoPTS 客户端。

在 QEMU 上测试 Zephyr 主机堆栈

使用 BlueZ 的 btproxy 工具为蓝牙适配器启动一个代理:

sudo bluez/tools/btproxy -u -z

然后使用例如自己的工作空间文件来启动 AutoPTS 客户端:

./autoptsclient-zephyr.py "C:\Users\USER_NAME\Documents\Profile Tuning Suite\PTS_PROJECT\PTS_PROJECT.pqw6" zephyr.elf -i SERVER_IP -l LOCAL_IP

在 nRF52 上测试 Zephyr 组合(控制器 + 主机)构建

./autoptsclient-zephyr.py zephyr-master /zephyr.elf -i SERVER_IP -l LOCAL_IP -t /dev/ttyACM0 -b nrf52

在 nRF52 上测试 Mynewt 构建

./autoptsclient-mynewt.py "Mynewt Nimble Host" -i SERVER_IP -l LOCAL_IP -t /dev/ttyACM0 -b nordic_pca10056

在 Linux 上测试 BlueZ

参见 ptsprojects/bluez/README.md

运行 AutoPTSClientBot

AutoPTSClientBot 被添加用于自动化在各种配置上运行测试用例并报告结果。

主要功能

  • 获取最新的项目源代码
  • 通过 "iut_config" 的 "overlay" 对项目配置文件应用更改以适应 "test_cases"
  • 构建 ZephyrOS/MynewtOS 镜像
  • 烧录板子
  • 运行所有测试用例
  • 存档测试执行日志
  • 将结果存储在 Excel 工作表文件中
    • 测试用例状态
    • 饼图
  • 将文件发送到 Google Drive
  • 发送电子邮件

配置

机器人配置文件位于 bot 目录中。提供了示例文件 bot/config.py.zephyr.samplebot/config.py.mynewt.sample。文件包含设置和项目特定配置。

这可能包含以下几个部分:

  • name - AutoPTS 项目名称
  • auto_pts - AutoPTS 配置
    • server_ip - AutoPTSServer IP 地址
    • client_port - 本地 AutoPTSClient 端口
    • project_path - 项目源目录路径
    • workspace - 要使用的 PTS 工作空间路径
    • board - 使用的 IUT。目前仅支持 nrf52
    • enable_max_logs - 启用调试日志
    • retry - 每个测试的最大重试次数
    • bd_addr - IUT 蓝牙地址(可选)
  • mail - 邮件配置(可选)
    • sender - 发件人电子邮件地址
    • smtp_host, smtp_port - 发件人 SMTP 配置
    • name - 用于消息底部
    • passwd - 发件人邮箱密码。当使用 Google 账户时,需要 允许不太安全的应用访问账户
    • recipients - 电子邮件地址列表
  • gdrive - GDrive 配置(可选)
    • root_directory_id - 根目录 ID,可以从 URL 中获取,https://drive.google.com/drive/u/0/folders/<GoogleDriveDirID>
    • credentials_file - 访问 Google 账户的凭据文件路径。更多信息请阅读 此处
  • iut_config - IUT 配置覆盖。这用于对 IUT 配置应用特定于测试用例的更改。它由配置名称和相关的键:值对组成的字典构成:
    • overlay - 要应用的配置更改
    • test_cases - 使用此配置运行的测试用例
  • scheduler - 计划程序配置(可选)
    • weekday: "time" 字典。

安装

使用以下命令安装所需的 Python 模块:

pip2 install --user -r bot/requirements.txt

使用

./autoptsclient_bot.py

在 freenode.net 上的 IRC 频道

我们在 freenode.net 上的 IRC 频道是 #autopts

项目介绍

用户可通过该项目自动化蓝牙测试流程,提升测试效率。它利用PTSControl COM API实现测试自动化,支持Zephyr、Mynewt等蓝牙协议栈,可运行460多个测试用例,采用客户端/服务器架构,支持跨平台协作与结果报告生成。【此简介由AI生成】

定制我的领域