@@ -162,9 +162,11 @@ Use Mbed CLI to build and run unit tests. For advanced use, you can run CMake an
162
162
1 . Move to the build directory ` cd UNITTESTS/build ` .
163
163
1 . Run CMake using a relative path to ` UNITTESTS ` folder as the argument. So from ` UNITTESTS/build ` use ` cmake .. ` :
164
164
- Add ` -g [generator] ` if generating other than Unix Makefiles such in case of MinGW use ` -g "MinGW Makefiles" ` .
165
- - Add ` -DCOVERAGE:True ` to add coverage compiler flags.
165
+ - Add ` -DCMAKE_MAKE_PROGRAM=<value> ` , ` -DCMAKE_CXX_COMPILER=<value> ` and ` -DCMAKE_C_COMPILER=<value> ` to use a specific make program and compilers.
166
+ - Add ` -DCMAKE_BUILD_TYPE=Debug ` to build a debug build.
167
+ - Add ` -DCOVERAGE=True ` to add coverage compiler flags.
166
168
- See the [ CMake manual] ( https://cmake.org/cmake/help/v3.0/manual/cmake.1.html ) for more information.
167
- 1 . Run a make program (Make, Gmake, Mingw32-make and so on) to build the tests.
169
+ 1 . Run a make program to build the tests.
168
170
169
171
#### Run tests directly with CTest
170
172
@@ -177,9 +179,19 @@ Run a test binary in the build directory to run a unit test suite. To run multip
177
179
1 . Add test executables into the list.
178
180
1 . Run them.
179
181
182
+ ### Debugging
183
+
184
+ 1 . Use Mbed CLI to build a debug build. For advanced use, run CMake directly with ` -DCMAKE_BUILD_TYPE=Debug ` and then run a make program.
185
+ 1 . Run GDB with a test executable as an argument to debug unit tests.
186
+
180
187
### Get code coverage
181
188
182
- Use Mbed CLI to generate code coverage reports. For advanced use, you can run Gcovr or any other code coverage tool directly in the build directory.
189
+ Use Mbed CLI to generate code coverage reports. For advanced use, follow these steps:
190
+
191
+ 1 . Run CMake with both ` -DCMAKE_BUILD_TYPE=Debug ` and ` -DCOVERAGE=True ` .
192
+ 1 . Run a make program to build the tests.
193
+ 1 . Run the tests.
194
+ 1 . Run Gcovr or any other code coverage tool directly in the build directory.
183
195
184
196
### Troubleshooting
185
197
0 commit comments