Commit 995ae9fd authored by Mark Wang's avatar Mark Wang Committed by Chris Friedt
Browse files

tests: bluetooth: add key persistence test cases



add key persistence test cases

Signed-off-by: default avatarMark Wang <yichang.wang@nxp.com>
parent d53f324c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
set(NO_QEMU_SERIAL_BT_SERVER 1)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(bluetooth)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
+74 −0
Original line number Diff line number Diff line
.. _bluetooth_classic_smp_key_persist_tests:

Bluetooth Classic SMP Key Save Tests
##################################

Overview
********

This test suite uses ``bumble`` for testing Bluetooth Classic communication between a host
PC (running :ref:`Twister <twister_script>`) and a device under test (DUT) running Zephyr.

Prerequisites
*************

The test suite has the following prerequisites:

* The ``bumble`` library installed on the host PC.
The Bluetooth Classic controller on PC side is required. Refer to getting started of `bumble`_
for details.

The HCI transport for ``bumble`` can be configured as follows:

* A specific configuration context can be provided along with the ``usb_hci`` fixture separated by
  a ``:`` (i.e. specify fixture ``usb_hci:usb:0`` to use the ``usb:0`` as hci transport for
  ``bumble``).
* The configuration context can be overridden using the `hci transport`_ can be provided using the
  ``--hci-transport`` test suite argument (i.e. run ``twister`` with the
  ``--pytest-args=--hci-transport=usb:0`` argument to use the ``usb:0`` as hci transport for
  ``bumble``).

Building and Running
********************

Running on mimxrt1170_evk@B/mimxrt1176/cm7
==========================================

Running the test suite on :ref:`mimxrt1170_evk` relies on configuration of ``bumble``.

On the host PC, a HCI transport needs to be required. Refer to `bumble platforms`_ page of
``bumble`` for details.

For example, on windows, a PTS dongle is used. After `WinUSB driver`_ has been installed,
the HCI transport would be USB transport interface ``usb:<index>``.

If the HCI transport is ``usb:0`` and debug console port is ``COM4``, the test suite can be
launched using Twister:

.. code-block:: shell

   west twister -v -p mimxrt1170_evk@B/mimxrt1176/cm7 --device-testing --device-serial COM4 -T tests/bluetooth/classic/smp_key_persist -O smp_key_persist --force-platform --west-flash --west-runner=jlink -X usb_hci:usb:0

Running on Hardware
===================

Running the test suite on hardware requires a HCI transport connected to the host PC.

The test suite can be launched using Twister. Below is an example for running on the
:zephyr:board:`mimxrt1170_evk@B/mimxrt1176/cm7`:

.. code-block:: shell

   west twister -v -p mimxrt1170_evk@B/mimxrt1176/cm7 --device-testing --device-serial COM4 -T tests/bluetooth/classic/smp_key_persist -O smp_key_persist --force-platform --west-flash --west-runner=jlink -X usb_hci:usb:0

.. _bumble:
   https://google.github.io/bumble/getting_started.html

.. _hci transport:
   https://google.github.io/bumble/transports/index.html

.. _bumble platforms:
   https://google.github.io/bumble/platforms/index.html

.. _WinUSB driver:
   https://google.github.io/bumble/platforms/windows.html
+4 −0
Original line number Diff line number Diff line
#select NXP NW612 Chipset
CONFIG_BT_NXP_NW612=y

CONFIG_ENTROPY_GENERATOR=y
+11 −0
Original line number Diff line number Diff line
/*
 * Copyright 2024 NXP
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/ {
	chosen {
		zephyr,sram = &dtcm;
	};
};
+24 −0
Original line number Diff line number Diff line
CONFIG_BT=y
CONFIG_BT_CLASSIC=y
CONFIG_BT_SMP=y
CONFIG_BT_SHELL=y
CONFIG_LOG=y
CONFIG_ZTEST=y
CONFIG_REBOOT=y
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y
# CONFIG_FLASH=y
# CONFIG_FLASH_MAP=y
# CONFIG_NVS=y
# CONFIG_SETTINGS_NVS=y
# CONFIG_SETTINGS=y
# CONFIG_BT_SETTINGS=y
# CONFIG_MPU_ALLOW_FLASH_WRITE=y

CONFIG_BT_DEVICE_NAME="smp_key_persist"

CONFIG_BT_CREATE_CONN_TIMEOUT=30
CONFIG_BT_PAGE_TIMEOUT=0xFFFF
Loading