How to add Firmware/src/systemcmds/tests to target

How to add Firmware/src/systemcmds/tests to building target? I want to run tests example of this directory,but I don’t konw how to make it.Any one can help me?

The tests are in px4fmu-v2_test, px4fmu-v4_default, and posix_sitl_default.

This is how it’s added to those targets.
https://github.com/PX4/Firmware/blob/master/cmake/configs/nuttx_px4fmu-v2_test.cmake#L73
https://github.com/PX4/Firmware/blob/master/cmake/configs/nuttx_px4fmu-v4_default.cmake#L75
https://github.com/PX4/Firmware/blob/master/cmake/configs/posix_sitl_default.cmake#L81

1 Like

I have tried it in your way,but the file i modified is named of px4fmu-v2_default.And when built to 100%,it occur to report an error that there is no definition of test_main.

Hi,I have tried what you said.But there is a error :no reference of tests_main

I download the latest version code and try to build it.But it does occur the same error which report that
(.rodata. g_builtin+ 0x3dc)undefined reference to ‘tests_main’.which version of gcc do you use?

Can you post the build output?
You’ll probably have to comment out a few other modules to get tests to fit in px4fmu-v2_default.