-
Notifications
You must be signed in to change notification settings - Fork 18
Running the Mbed Greentea Tests Locally
This page will show you how to compile and run the Mbed OS Greentea tests on your local machine. Greentea tests are the tests which get loaded and run on a connected Mbed board, so this procedure will let you check how well Mbed OS actually works on a board you have.
Note: These instructions use the command line, but this can also be done using an IDE by opening the mbed-os folder as a project and adding the needed CMake options.
- Make sure the toolchain is set up, per this page.
- Connect the Mbed device to your machine, and find what serial port it uses (e.g. COM3 or /dev/ttyACM0). On Linux, this page can help you configure the tty device and permissions correctly.
- Clone this repository and open a terminal there.
- You can also use the mbed-os submodule of another project, if you have one handy
- Install both the normal Python requirements and the ones for the greentea tests:
python3 -m pip install -r tools/requirements.txt
python3 -m pip install -r tools/requirements-ci-build.txt
(use python
instead of python3
if on Windows)
- Create a build dir and enter it:
mkdir build_<your target> && cd build_<your target>
(where <your target>
is replaced by your Mbed target name, e.g. NUCLEO_F429ZI)
- Run CMake:
cmake .. -GNinja -DMBED_TARGET=<your target> -DCMAKE_BUILD_TYPE=Develop -DMBED_BUILD_GREENTEA_TESTS=ON -DMBED_GREENTEA_SERIAL_PORT=<your serial port> -DUPLOAD_METHOD=<your upload method>
Replace <your serial port>
with the serial port you found in step 1.
Replace <your upload method>
with the upload method you wish to use. The CI runner is integrated with the upload method system, so whatever you select here will get used during the test run. Note: you can also pass other upload method related options in this command, such as setting the STM32CUBE_PROBE_SN
to select a specific device.
- Run the build:
ninja
If everything is set up correctly, you should see a bunch of Mbed OS tests get linked.
- Run the tests:
ctest . --output-on-failure
You should see a bunch of tests get executed on your hardware! This process normally takes 15-30 min. Note: It's normal to see tests show as skipped, this is because the test is trying to test something that doesn't exist on your MCU.