Unit Testing API

I’m trying to understand the Unit Testing API (Unit Testing API - Legato Docs) but the documentation only covers writing tests but doesn’t discuss how to run them. I’m new to embedded Linux development so maybe I’m just missing something that is obvious to others. Has anyone else successfully used the Unit Testing API? How do you run the tests? Where are the tests run? (QEMU, Real Hardware).

Thanks

Hi mmcmillan,

Generally speaking, unit tests are grouped in legato/apps/test and their directories are added to the main build in legato/apps/test/CMakeLists.txt. So, if you add a custom unit test, please add it to this make file.

Now, there is a script file in the root of Legato project called run-test, you can use it to compile the unit test for localhost or for a specific target.
Example:
./run-test host-ut //This command will build and run all the unit tests

Otherwise, you can also build your tests using make in Legato root (make tests_localhost, make tests_wp76xx) and compiled tests can gathered from legato/build/localhost/tests/bin

Hope this helps,
Thanks,