Skip to content

Commit 4687e50

Browse files
committed
Improve unit testing instructions.
1 parent e1f22e4 commit 4687e50

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

UNITTESTS/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,11 @@ Use Mbed CLI to build and run unit tests. For advanced use, you can run CMake an
162162
1. Move to the build directory `cd UNITTESTS/build`.
163163
1. Run CMake using a relative path to `UNITTESTS` folder as the argument. So from `UNITTESTS/build` use `cmake ..`:
164164
- 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.
166168
- 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.
168170

169171
#### Run tests directly with CTest
170172

@@ -177,9 +179,19 @@ Run a test binary in the build directory to run a unit test suite. To run multip
177179
1. Add test executables into the list.
178180
1. Run them.
179181

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+
180187
### Get code coverage
181188

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.
183195

184196
### Troubleshooting
185197

0 commit comments

Comments
 (0)