How to run the multi_bluetooth tests?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Simpler1
Posts: 14
Joined: Wed Jan 06, 2021 6:30 pm

How to run the multi_bluetooth tests?

Post by Simpler1 » Fri Jan 15, 2021 9:51 pm

I'm looking at the the files in the

Code: Select all

tests/multi_bluetooth
directory and I'm trying to figure out how to run these tests.

I'm relatively new to MicroPython (and even Python in general), but I don't see where the instance0() or intance1() functions are ever executed.

The

Code: Select all

run-tests
file doesn't seem to even try to run the bluetooth tests.

I'm working with an ESP32-CAM board if that is relevant.

Any background would be appreciated.

Thanks

User avatar
jimmo
Posts: 2232
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: How to run the multi_bluetooth tests?

Post by jimmo » Sat Jan 16, 2021 11:11 pm

Simpler1 wrote:
Fri Jan 15, 2021 9:51 pm
The run-tests file doesn't seem to even try to run the bluetooth tests.
The multitests are run by `run-multitests.py` instead, which will spin up the required number of MicroPython sessions (either using the Unix port or using a real device over a UART).

Here's an example that will test a connected ESP32 on ttyUSB0 and PYBD on ttyACM0

./run-multitests.py -i pyb:/dev/ttyACM0 -i pyb:/dev/ttyUSB0 multi_bluetooth/ble_characteristic.py

I use this a lot with the BLE support in the Unix port... e.g. with a USB UART connected to a HCI controller. This is an example of running that against a connected PYBD. Note the second instance "-i" flag is implicit (it will use the Unix port).

env MICROPY_MICROPYTHON=../ports/unix/micropython-nimble-h4 ./run-multitests.py -i pyb:/dev/ttyACM0 multi_bluetooth/ble_characteristic.py

Generally you want to run the tests in both directions (so both devices have a chance to be both central and peripheral). Add the "-p2" flag to do that.

Note that not all the BLE multitests will pass on ESP32 right now as not all features are implemented (pairing/bonding/l2cap).

Simpler1
Posts: 14
Joined: Wed Jan 06, 2021 6:30 pm

Re: How to run the multi_bluetooth tests?

Post by Simpler1 » Sun Jan 17, 2021 3:22 pm

Thanks jimmo, I'll try this out.

Post Reply