codecoup / auto-pts

The Bluetooth PTS automation framework
GNU General Public License v2.0
0 stars 2 forks source link

Table of Contents

Introduction

The Bluetooth Profile Tuning Suite (PTS) is a Bluetooth testing tool provided by Bluetooth SIG. The PTS is a Windows program that is normally used in manual mode via its GUI.

auto-pts is the Bluetooth PTS automation framework. auto-pts uses PTSControl COM API of PTS to automate testing.

Over 460 test cases have been automated for Zephyr OS and Mynewt OS which reduced testing time from one man-month to 9 hours. auto-pts has been used to automate testing of three Bluetooth stacks thus far:

Architecture

auto-pts server: Implemented in Python 3. Runs on Windows and provides over-the-network XML-RPC interface to PTS.

auto-pts client: Implemented in Python 3. Runs on GNU/Linux, communicates with the auto-pts server (to start/stop test cases, to send response to PTS inquiries) and communicates with the Implementation Under Test to take appropriate actions.

Implementation Under Test (IUT): It is the host running Bluetooth stack to be tested, this could be an emulator or real hardware. The IUT is controlled by using Bluetooth Test Protocol.

Bluetooth Test Protocol (BTP): Used to communicate with the IUT. See doc/btp_spec.txt

Update: Now for Zephyr you can run auto-pts client and server both under Windows 10: Zephyr with AutoPTS step-by-step setup tutorial

Linux Prerequisites

  1. socat that is used to transfer BTP data stream from UART's tty file.

    sudo apt-get install python-setuptools socat
  2. Additionally, install required Python modules with:

    python3 -m pip install --user -r autoptsclient_requirements.txt
  3. Download and install latest nrftools (version >= 10.12.1) from site https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools/Download and run default install.

Windows Prerequisites

To be able to run PTS in automation mode, there should be no PTS instances running in the GUI mode. Hence, before running these scripts close the PTS GUI.

  1. Install required modules with:

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

PTS Workspace Setup

Before running any scripts you have to create a workspace in the PTS, add needed projects to the workspace and configure PICs and PIXITs.

Alternatively, you can use auto-pts workspaces. Auto-pts provides ready PTS workspaces with readily configured PICS in the "workspaces" directory. The list of available workspaces:

Running in Client/Server Mode

The auto-pts framework uses a client server architecture. With this setup the PTS automation server runs on Windows and the client runs on GNU/Linux.

The command below starts AutoPTS server on Windows:

python.exe autoptsserver.py

There are separate autoptsclient-*.py scripts to lunch AutoPTS Client depending on the tested stack.

Testing Zephyr Host Stack on QEMU

Start a proxy for Bluetooth adapter by using btproxy tool from BlueZ:

sudo bluez/tools/btproxy -u -z

Then start the AutoPTS Client using e.g. own workspace file:

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

Testing Zephyr combined (controller + host) build on nRF52:

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

Testing Mynewt build on nRF52:

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

Testing BlueZ on Linux:

See ptsprojects/bluez/README.md

Running AutoPTSClientBot

AutoPTSClientBot has been added to automate running test cases on various configurations and reporting the results.

Key features

Configuration

The Bot configuration file is located in bot . Sample files bot/config.py.zephyr.sample and bot/config.py.mynewt.sample are provided. The file contains setup and project-specific configuration.

This may contain few sections:

Installation

Install required Python modules with:

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

Usage

./autoptsclient_bot.py

Zephyr with AutoPTS step-by-step setup tutorial

Check out the guide how to set up AutoPTS for Zephyr + nRF52 under:

IRC Channel on freenode.net

Our IRC channel on freenode.net is #autopts

Slack Channel

First join Zephyr Slack Workspace Then join our Channel #auto-pts

Or join using direct link auto-pts